polygon

Where can I find line buffering code?

I can't find any code for doing this. The only places I can find it is in GIS APIs. Preferably in java, but I can port other languages too. I'd even settle for a overview of all the formulas required. ...

How to insert polygon with hole in WKT (well known text) format into postgis table?

I have a table in postgis, which has 4 columns: ID, name, the_geom, SRID. I need to write an SQL query which will insert this exterior polygon (Element 1) in the table named "woods", ID = 44, the name of that exterior polygon is "oak", and SRID is "4412". The coordinate values for Element 1 and Element 2 (the hole): Element 1= [P1(6,15)...

Traversing the boundary points of a polygon made of connected triangles

Hello I have a two dimensional polygon mesh made of connected triangles represented like this: vertex array: V = A, B, C, D, E, ... index array, triangle vertex indices in groups of 3 in counter-clockwise-order: I = 0, 4, 3, ... (so that e.g. V[0], V[4], V[3] which is A-E-D forms a triangle) Example mesh Now i want to traverse ...

How to draw a Polygon with X sides (all equal length & angles)

I am looking to calculate the X and Y points of each point on a polygon, given the number of sides, and the fact that all sides are equal. I would also have the width and height constraints of the entire shape. If it helps any, I would be doing this in Java (most likely using Line2D). ...

Draw a self intersecting polygon on the HTML Canvas.

I'm looking for a way to draw a self intersecting polygon with holes, I'm using the HTML Canvas element. So given 5 points, I want to draw the red one below. This question is essentially the same thing. Note: I don't want to do this using line intersections and adding more points, the actual paths I will be using will be curved. ...

Draw polygon x meters around a point

How can I create a polygon(only a square in my case) around a given point(lat/lang) x meters around the given point. It's just a visual representation of a geofence but I dont need all the calculations whether a point is outside a geofence or not. I tried using the code below but its creating a rectangle instead of a square and I'm not e...

Using a C function in Objective-C (for iPhone)

'lo all. I am a self-described admitted noob in iPhone programming (having a much longer perl & web background -- 30 years)...but took the plunge last week and bought a couple of good books. After cramming and reading well over 1000 pages -- and understanding it pretty well, I am well on my way to a good first Native iPhone app. My pro...

How do you create a polygon shape in a KML that is positioned in the air?

I need to be able to place a polygon object with a given height into a KML that will be located above the ground. I'm looking to display airspace information into a KML and each airspace has a low altitude and and high altitude value. The closest thing I have been able to do so far is to create two polygons with different altitudes t...

General Polygon Clipper: Attach data to vertex

How can I attach data to a gpc_vertex instance? I am planning to attach vertex indices to the gpc_vertex itself in order to build a Direct3D IndexBuffer later on... ...

General Polygon Clipper: Triangulate without additional vertices

I am using GPC to break up polygons into triangles. However, GPC is very obviously creating additional vertices while generating triangles. Is there a way to avoid this? ...

How to draw polygons with CGPath?

Hello, I have been reading thru the documentation however it is not immediatly clear to me how to draw a polygon using CGPath. All I need to do is to draw CGPath around something like this: __ \ \ \ \ \__\ Could anyone please provide an snippet on how to do this? Additionally I assume CGPathContainsPoint will help me determine...

Contact simplex between 2D convex polygons

How do I find the point/line of contact between two convex intersecting 2D polygons? I have implemented both the Separating-Axis test and the GJK algorithm, but neither of these return the contact simplex between the shapes (although the EPA extension to GJK will give me penetration distance). edit: This is for a physics engine, so I n...

A simple algorithm for polygon intersection

I'm looking for a very simple algorithm for computing the polygon intersection/clipping. That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be maximal among all possible polygons. I don't mind the run time (I have a few very small polygons), I can also afford getting an approximation...

OpenGL polygon stipple

Hi, i'm wondering how a array of 32x32 is mapped to a bitmap. The following arrays represents a bitmap. I know that each row of the array represents row of the bitmap. The first row of the array is the last row of the bitmap, and so on, up to the last row of the array that is the first row of the bitmap, but how this works? GLubyte myIn...

How do I arbitrarily distort a textured polygon?

I'd like to write a program that lets me arbitrarily distort a textured polygon by dragging its vertices. I want the texture to distort fluidly and without overlap, assuming the new polygon doesn't intersect itself. I should also be able to repeat the process with the new shape, and with a minimum amount of loss. Are there any algorithm...

Point on Polygon (Longitude/Latitude) in .NET

Hi I need some help for my problem ;): I've got a polygon definied with 3 or more longitude/latitude points. Now I've got another longitude/latitude point and I need to check if this point is in the polygon area or not. I need this function in .NET. Can anyone help me? Thank you very much for your help. ...

How do I make a triangle space with text written for the iPhone?

I want to draw a triangle and elide text in the shape. I can restrict the triangle to an equilateral triangle and a fixed orientation ('upside down' or 'upside up'). Then I want to insert arbitrary text in the triangle such that the eliding is on word boundaries and not clipped. Any simple algorithms? What methods are available in Ob...

Drawing resizable (not intersecting) polygons

Hello everyone, I have been searching everywhere but I could not find an answer. I need to have drawing resizable polygons with mouse interaction but I do not want irregular, overlapping or intersecting polygons in the end. Here is a simple example of drawing resizable polygons http://www.wolfpil.de/polygon.html You can easily cre...

How to sort points in a Google maps polygon so that lines do not cross?

I am trying to make a map where a user can outline any shape they would like. But I am running into an issue where users can select points that will make the lines of the polygon cross and exclude area's that I would like to include. To see what i'm talking about go to this page and take the following steps: click 4 points to make ...

Does XNA have a Polygon, like Rectangle?

I'm making a game where there is only a certain space the player can move around. I want to represent this space with a polygon of some sort. The main question I would ask of it is whether it contains a given point. (Like rect.intersect()) Does XNA have any way to do this? ...