polygon

Draw Polygon with GPolygon without GMap

Anyone know how I can draw Polygons with GPolygon from Google Map without having a map, inside other elements? Or anyone know any framework to do it with the same features like GPolygon? I would like to have this "draw polygon" on a custom element, like div: <div id="MyArea"></div> ...

Sort point list into polygon

I have a set of points. This set of points do define a (non convex) polygon but its not ordered. Since it's not ordered I cannot just draw from point to point to draw its border. How can I sort it in a way I can walk through this point list and draw a polygon? My first idea was to use a convex hull but my polygons are, most of the tim...

How to generate half-edge structure representation for a polygonal mesh?

I would like to generate output to display the numeric data of the Half-Edge Structure that is based from an input of polygonal mesh data (in numeric data form). The concept to read the polygonal model basically is like this: For the INPUT, the file is in OFF format and include datas like (a) First part: the number of vertex, number o...

How To Slice a Simple Polygon with a Line

I have a simple polygon (convex or concave, but no holes) that I need to slice into parts with a line segment. I'm not sure how to actually determine how many polygons result after the slice, or how to group the vertices. Basic convex cases the always results in 2 sub-polygons are easy, but how would I deal with a complicated concave sh...

how to get coordinates of a polygon in OpenLayers

I have been looking for how to determine coordinates of the points which consist a polygon(feature) in OpenLayers. Let's say I have created a polygon like the one in this example. I need to know the points which consist the polygon, so I can save them somewhere. I bet it is an easy one. I just couldn't find anything, probably I don't k...

Triangularizing an arbitrary 4-Vertex Polygon

Here's a riddle for you. You have a polygon composed of exactly 4 vertices, call them v1, v2, v3, v4. They are given in any random order. How would you split these vertices into two sets, each defining a triangle, such that both triangles make up the polygon without overlap. The result should look like this: Triangle 1: v1, v2, v3 Tri...

OpenGL ES - How to Draw a filled Polygon?

Hello ! I tried googling and searching on stack but I didn't find anything :-( ( http://stackoverflow.com/questions/2842339/mapping-irregular-shapes-or-other-polygons-cartoons-sprites-to-triangles-in-op ) I want to draw a filled polygon in OpenGL ES on iPad (2D, don't need 3D) (I'm new to OpenGL && OpenGL ES) It seems simple on OpenGL ...

Need a standalone Java library for performing spatial calculations on lat/lon data

I'm looking for a Java library that is capable of performing spatial calculations on sets of lat/lon data. Here are some of the functions that I'm looking for: Calculate the Great Circle distance between two points Determine if a point lies within a simple closed polygon, where the polygon is defined by an ordered list of points Dete...

Concave Polygon Line Clipping without Degenerate Edges

I have search and researched the internet last days to find a suitable method for my problem. Problem: Clip a concave polygon against an infinite line without direction (Actually a polygon against a plane in 3d but the problem is similar i think). Currently i use Sutherland-Hodgman but the resulting polygons sometimes contains zero-are...

How do i get the coordinates of all four corners of a Rectangle?

How can i retrieve OR calculate the coordinates of the NW or SE corners of a Rectangle? I'm using Google Maps API v3 and I know there is the getBounds() method which returns the NE and SW coordinates of the rectangle. I need all four coordinates because KML 2.2 does not have a rectangle schema spec, it only has the polygon schema and ...

Splitting a 3D model with respect to angle of cut

In 3D Max Studios, I recalled there is a function (I couldn't recall the name of the function, sorry) to cut a 3D model into two. For instance, you create a sphere, then you cut it in the middle, leaving 2 half spheres. Now, how about a human body? Imagine a samurai cutting up an enemy at the stomach, now that enemy's model will become 2...

Check whether or not a point is in a polygon (Google Maps API)

So I have a map here How can I, using Google Maps API, detect whether or not a given coordinate is within that polygon? Is that possible? Thanks in advance. ...

Java - filling an overlapping polygon

I'm trying to draw a 5 point star in AWT. Each point in the 2d grid is 72 degrees apart - so I thought I could draw the polygon using only 5 points by ordering the points 144 degrees apart, so the polygon gets fed the points in order 1,3,5,2,4 Unfortunately, this involves a lot of intersecting lines, and the end result is that there are...

Intersect polygon with rectangle and create lines (section cut)

I need an algorithm to intersect a (potentially non-convex) polygon with a rectangle. The rectangle will be parallel to the xy-plane, but the polygon could be any orientation. Furthermore, I don't just need a true/false result, but also the exact points where the polygon intersects the rectangle, so that I can draw lines where the poly...

Java Graphics 2D UI Arrow Head Direction

I want to draw an arrow using Graphic fillpolygon. But my arrow head is in a reverse side. Any idea? int xpoints[] = { 20, 30, 30, 35, 25, 15, 20 }; int ypoints[] = { 10, 10, 30, 30, 45, 30, 30 }; int npoints = 7; g2D.fillPolygon(xpoints, ypoints, npoints); ...

Draw a Polygon using Mouse Points in C#

Hi, I need to be able to draw a polygon using mouse click locations. Here is my current code: //the drawshape varible is called when a button is pressed to select use of this tool if (DrawShape == 4) { Point[] pp = new Point[3]; pp[0] = new Point(e.Location.X, e.Loca...

decrease polygon count in Maya

Hello. I'm making models for games. In 3ds Max there was "polygon cruncher" plugin for reducing number of polygons. Is there something similar for Maya? Or is there any other way to do that? ...

Testing whether a polygon is simple or complex

For a polygon defined as a sequence of (x,y) points, how can I detect whether it is complex or not? A complex polygon has intersections with itself, as shown: Is there a better solution than checking every pair which would have a time complexity of O(N2)? ...

google maps v3 API mouseover with polygons. Not working

I'm trying to get mouseover to work polygons in google maps api v3. I've tried the answer provided in this post: http://stackoverflow.com/questions/1751710/google-maps-v3-api-mouseover-with-polygons This answer should be working, but it's not for me. Can anyone spot the stick in my spokes? Here is my code: <!DOCTYPE html> <html> <he...