# Tagged Questions

234 views

### Calculate laser bounce inside polygon

I am trying to calculate the reflection of a laser within a polygon. My current calculations are probably quite long-winded because I'm building on line intersection and other functions. The problem ...
75 views

### How can I test if a point is behind a polygon in 2D?

In order to improve the performance of my visibility graph generator I am trying to figure out the following. Given the image below; is there a way to find out if a point is 'behind' the polygon? For ...
103 views

### How to calculate a bounding rectangle of a polygon?

Polygon poly = new Polygon(); poly.getPoints().setAll(5d, 15d, 15d, 25d, 5d, 30d); How do I calculate the Polygon's height and width? There is no poly.getWidth() or poly.getHeight() method in ...
65 views

### What do the 6 points stand for in Polygon().getPoints().setAll?

I have the following code to create a polygon: Polygon poly = new Polygon(); poly.getPoints().setAll(14d, 17d, 26d, 17d, 20d, 27d); // What do these mean? What do these 6 points stand for?
122 views

### Moai: Clipping an image to a polygon

I'm using Moai SDK. I have an image and some random convex 2D polygons. I want to show only the parts of the image inside these polygons. Here's an example image: The same, shown only where the ...
346 views

### Would it be more efficient to handle 2D collision detection with polygons, rather than both squares/polygons?

I'm working on a 2D game engine and I'm trying to get collision detection as efficient as possible. One thing I've noted is that I have a Rectangle Collision collider, a Shape (polygon) collider and a ...
220 views

### Subdividing a polygon into boxes of varying size

I would like to be pointed to information / resources for creating algorithms like the one illustrated on this blog, which is a subdivision of a polygon (in my case a voronoi cell) into several boxes ...
268 views

### How do I get the areas enclosed by an arbitrary 2D shape?

In my game I want users to be able to draw arbitrary 2D shapes of any length around game objects. The shapes must be closed and drawn with a single stroke that does not overlap. For example: I ...
102 views

### How to render polygons of arbitrary shape? [duplicate]

I am trying to render a plane with nodes. FYI : Nodes know what other nodes it is being attached to. I can think of a way to render them as long as they are aligned in a circular pattern; have a ...
376 views

### How to make a stack stable? Need help for an explicit resting contact scheme (2-dimensional)

Previously, I struggle with the sequential impulse-based method I developed. Thanks to jedediah referring me to this paper, I managed to rebuild the codes and implement the simultaneous impulse based ...
254 views

### Is there any heuristic to polygonize a closed 2D raster shape with n triangles?

Let's say we have a 2D image black on white that shows a closed geometric shape. Is there any (not naive brute force) algorithm that approximates that shape as closely as possible with n triangles? ...
404 views

### 2D SAT Collision Detection not working when using certain polygons (With example)

My SAT algorithm falsely reports that collision is occurring when using certain polygons. I believe this happens when using a polygon that does not contain a right angle. Here is a simple diagram of ...
1k views

### What is a good way to determine if a vector is between two other vectors?

I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, ...
752 views

### I need help with 2D collision response (of stacking rotating polygons, with friction and gravity, for a game)

Hi I am looking for suggestions on how to write a collision response for game programming purpose (so not a scientific simulation). I am dealing with 2D polygons that are rotating, and I want them to ...