Tag Info

New answers tagged

1

Have a look at this. It works through some very clear diagrams. http://www.mathopenref.com/coordpolygonarea2.html They are just calculating area and you are enumerating points. However you can adapt these ideas. Look carefully at 'A More Complex Case' and how the horizontal lines divide the polygon into a set of trapezoids (if you recognize a triangle as ...


1

You could possibly treat it as a graph traversal problem. If you treat adjacent points as 'children' of each other and add each child of your boundary points to a list of open nodes (ie. unvisited nodes), then your enumerator could explore this list. In case you're unfamiliar with search algorithms, this would probably look something like: For each point; ...


1

Every polygon can be represented as lines[L] with interception points[P].For each line you calculate weather it is above or below a point Pn(n is the index of array P) which is not part of the line Lm.When you measure all the lines you save the result in one dimensional bool array V[number_lines].When you have a random point A.Then you make for loop for ...


9

You will need to process all the points at least once so if this check is done only once there isn't much you can do to speed up the test other than brute-forcing it using parallelism. If the test is going to be run multiple times there are ways to pre-calculate tables to help, such as a grid of cells marked as [definitely inside (green in image), outside ...


7

What you are seeking is a solution to the "point-in-polygon" problem. It is described in Wikipedia here:           You can find C code following the links to Computational Geometry in C, or at many other locations found by searching for "point-in-polygon" code.


0

You can achieve certain effects with shapes that would be more difficult with sprites. For example if you want a circle line or a pathway to be drawn in certain amount of time, or an image shattering to several pieces. These are that came to my mind at the moment, but obviously, you can think up anything.


4

Because 3D libraries like OpenGL and DirectX draw everything using triangles, including sprites. You put a texture (image) on triangles, put two triangles side by side to make a square and that's how you draw a "sprite" with OpenGL or Direct3D. The sprites are drawn using triangles, its not for collisions, its simply for drawing them.



Top 50 recent answers are included