polygon

Techniques for drawing coplanar polygons in OpenGL

I'm going to have meshes with several coplanar polygons, all lying in a certain plane, that I'm not going to be able to eliminate. These polygons have a specific draw order. Some polygons are behind other polygons. If I turn off depth testing I'll have the effect I want, but I want to be able to position this mesh in a 3D scene. I do...

Calculate coordinates of a regular polygon's vertices

I am writing a program in which I need to draw polygons of an arbitrary number of sides, each one being translated by a given formula which changes dynamically. There is some rather interesting mathematics involved but I am stuck on this probelm. How can I calculate the coordinates of the vertices of a regular polygon (one in which all ...

Simplified concave-hulls

Problem: Given: n points that are strongly correlated to a 3d k-sided non-convex polygon, where n >> k Find: the best fit concave-hull that matches the original geometry of the points Attempted solutions: Warning: pseudocode segments = [] for each point in image: #segment points into planes via comparing approximate normals ...

Looking for a fast polygon rendering algorithm

I am working with a Microchip dsPIC33FJ128GP802. It's a small DSP-based microcontroller, and it doesn't have much power (40 million instructions per second). I'm looking for a way to render a convex (i.e. simple) polygon. I am only dealing with 2D shapes, integer math, and set or clear pixels (i.e. 1 bit per pixel.) I already have routin...

Overlapping polygons on 2D plane

i would like to build a dynamic data structure that can hold a list of polygons and return a list of polygons that overlaps a specified rectangle. i looked into bst trees (and quad trees) but these dont seem to work too well when the polygons overlap heavily. any good ideas i should check out before i roll my own nonsense? edit lets ...

How to do correct polygon rotation? ( in C# though it applies to anything )

Hi I'm using this C# code to rotate polygons in my app - they do rotate but also get skewed along the way which is not what i want to happen. All the polygons are rectangles with four corners defined as 2D Vectors, public Polygon GetRotated(float radians) { Vector origin = this.Center; Polygon ret = new Polygon(...

GEvent over kml

if I catch polygons in a kml with geoXml = new GGeoXml("http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml"); how I can applicate listerners (onclick,overmouse,etc) over this polygons? ...

Find the outline of a union of grid-aligned squares

How to get the co-ordinates of the outline shape formed using smaller grid blocks. For example, If I used 32x32 unit blocks for construct a shape (any shape). Then how can I get overall co-ordinates of the shape, including the negative spaces. For example: One could arrange the blocks like this: (each block is 32x32 and coordinates ref...

WPF Polygon to bitmap

How to convert the wpf polygon shape as bitmap image. am tryint to send as Visual parameter to change as bitmap, but it doesnt seems to be working. is there any other way to convert the WPF polygon to bitmap???? am using like below RenderTargetBitmap RTbmap = new RenderTargetBitmap((int)yellowPolygon.Width, (int)yellowPolygon....

Algorithm to convert vertices of a triangular strip to polygon

I have an array with vertices representing a triangular strip. I need to convert it into polygon. There are many solution to do the reverse, but I failed to find one for the above problem. Or it could be too easy and I just cannot see it. Please help. OpenGL=compatible, see http://en.wikipedia.org/wiki/Triangle_strip Example: for thi...

Polygon shape usercontrol

Hi Is there any way to set style for my UserControl to look like polygon, for example triangle or sth more sophisticated? I was reading that in WPF there is almost no limits when it comes to modifing graphical interface ...

Reading in polygons from a Object File Format (.off) file

Hi I need to read in a list of polygons from a Object File Format (.off) file (in c++). The format of .off files is basically like this: Header infomation x y z //co-ords for each vertex ... NVertices v1 v2 v3 ... vN //Number of vertices for each polygon, //followed by each vertex's index ... .off files all...

How to merge a large set of polygons with Boost Polygon?

I am looking for a way, using Boost Polygon, to read in a large set of polygons from a file, and output the resulting merge or union to a result file. In this case the polygons touch but do not overlap. I can put the data in any format. Not sure if there is a standard used by Boost Polygon. I am also looking for more documentation on the...

How can I tell if two polygons intersect?

Hello, Imagine I have the coordinate of 4 points that form a polygon. These points are represented using PointF in C#. If I have 2 polygons (using 8 points), how can I tell if they intersect? Rectangle class has a method called IntersectsWith but I couldn't find something similar for GraphicsPath or Region. Any advice would be grea...

Java: How can I split a Polygon by a Line?

As shown below, Is it possible to split a Polygon by a Line? (In to two Polygons). If the line didn't go all the way across the polygon it would probably fail (return null) Is this possible? If so, how would I do this? ...

How to attach a simple data.frame to a spatialpolygondataframe in R?

Hi, I have (again) a problem with combining data frames in R. But this time, one is a spatial.polygon.data.frame(SPDF) and the other one is usual data.frame (DF). The SPDF has around 1000 rows the DF only 400. Both have a common column, QDGC Now, I tried oo <- merge(SPDF,DF, by="QDGC", all=T) but this only results in a normal data...

SciPy Create 2D Polygon Mask

I need to create a numpy 2D array which represents a binary mask of a polygon, using standard Python packages. input: polygon vertices, image dimensions output: binary mask of polygon (numpy 2D array) (Larger context: I want to get the distance transform of this polygon using scipy.ndimage.morphology.distance_transform_edt.) Can any...

Finding the points of an Image (PNG) to make a polygon

If I have an image (PNG) is there anyway to find the polygon representation of that image? I am using Cocos2d and SpaceManager to build an iPhone application. There are many images that are polygon in shape. I need to give those images the characteristics of a polygon. Language => Objective C ...

vb6: fill polygon with gradient

hi, can anyone tell me if it's possible to fill a polygon with a gradient under vb6? thx ...

Expand fill of convex polygon

I have a convex polygon P1 of N points. This polygon could be any shape or proportion (as long as it is still convex). I need to compute another polygon P2 using the original polygons geometry, but "expanded" by a given number of units. What might the algorithm be for expanding a convex polygon? ...