polygon

Saving and accessing a lot of ROI polygons (IDL, ImageJ, Java?, XML?)

I need to save and re-load thousands of ROI polygons on a stack of images, actually a 30-frame-per second movie for 30+ minutes, so at least 54,000 frames. There can be multiple ROIs on a single image (frame) in the stack, and the size and number of vertices for each ROI is different. The ROI polygons are tracking the edges of shapes a...

Finding the 'foot' of an altitude of a triangle in 3D space

A little backstory, currently I'm working on implementing a triangle rendering system in Expression2 to create .obj models. One of the limitations I'm currently experiencing is that I cannot create polygons the old-fashioned way, rather, I'm having to create Isosceles triangles, and cut part of it off. My current problem is that I'm ...

Breaking a concave polygon into convex ones.

I'm using a game physics library (Box2D) which only supports convex polygon shapes. However, I'd like the level builder to be able to just specify concave polygons without having to worry about that. So, how can I automatically break apart a concave polygon into convex ones (or even all triangles). Speed would be cool, but ease of imple...

Drawing elements on an MKMapView of a specified size in meters

I'm attempting to draw a circle around a point on a mapview, which I have successfully done, but not quite the way I wanted to. The CG methods are always going to be drawing relative to the screen size, and basically I want to draw things in meters, not pixels. Anyone have experience doing this? ...

Reduce number of points in line

I'm searching for algorithms to reduce the LOD of polylines, lines (looped or not) of nodes. In simple words, I want to take hi-resolution coastline data and be able to reduce its LOD hundred- or thousandfold to render it in small-scale. I found polygon reduction algorithms (but they require triangles) and Laplacian smoothing, but that...

OpenGL Coordinate system confusion

Maybe I set up GLUT wrong. Basically I want verticies to be reletive to their size in pixels. Ex:right now if I create a hexagon, it hakes up the whole screen even though the units are 6. #include <iostream> #include <stdlib.h> //Needed for "exit" function #include <cmath> //Include OpenGL header files, so that we can use OpenGL #ifdef ...

GIS: Converting multi polygons to multiple features

Hi, I am involved in a GIS project. I have a base map file (shape file) that contains the road layer for a large portion of a town. The problem is that the shape file contains only two features each containing around 500000 points each. The features are multipolygons containing a large no of polygons inside. I wish to convert it to numer...

Calculate pixels within a polygon

In an assignment for school do we need to do some image recognizing, where we have to find a path for a robot. So far have we been able to find all the polygons in the image, but now we need to generate a pixel map, that be used for an astar algorithm later. We have found a way to do this, show below, but the problem is that is very slo...

Arrange points in sequence.

I have some points in 3D which are in a single plane. I want to arrange them in clock wise or counter clockwise order. The points can create a concave or convex polygon in a single plane. Can any body give any suggestions? ...

Drawing a polygon around groups of datapoints in MATLAB

I have a set of datapoints each of which belongs to a certain cluster (group). I need to draw a polygon around each of these clusters. Does anyone knows how to do it? It doesn't matter if I use or not use the actual datapoints for drawing the polygon. I just need them to be wrapped in a polygon. ...

Drawing an empty polygon given a set of points on a Map Overylay (Android 2.1)

Hi, I've set of n points and I want to draw a n-sided polygon using these points. I tried using android.graphics.path (please see below). Path path = new Path(); Vertex currVtx; for (int j = 0; j < vertices.size(); j++) { currVtx = vertices.get(j); if (!currVtx.hasLatLong()) continue; Point currentScreenPoint = getScreenPoi...

Linear-time algorithms for sorting vertices in polygon contours

I figured out an algorithm that lets me turn my holed polygons into trapezoids in linear time if I have vertex indices sorted from lowest coordinate to highest. I get simple polygons as contours. They have certain order that might be exploited most of the time. So giving these conditions, is there a near-linear-time algorithm on sortin...

Diagonal of polygon is inside or outside?

I have three consecutive points of polygon, say p1,p2,p3. Now I wanted to know whether the orthogonal between p1 and p3 is inside the polygon or outside the polygon. I am doing it by taking three vectors v1,v2 and v3. And the point before the point p1 in polygon say p0. v1 = (p0 - p1) v2 = (p2 - p1) v3 = (p3 - p1) With reference t...

how to subtract circle from an arbitrary polygon

Given an arbitary polygon with vertices stored in either clockwise/counterclockwise fashion (depicted as a black rectangle in the diagram), I need to be able to subtract an arbitrary number of circles (in red on the diagram) from that polygon. Removing a circle could possibly split the polygon into two seperate polygons (as depicted by t...

How do I find the most complex convex polygon enclosing a set of points?

I have a list of (about 200-300) 2d points. I know needs to find the polygon that encloses all of them. The polygon has to be convex, and it should be as complex as possible (i.e. not a rectangular bounding box). It should find this in as low as possible time, but there are no restrictions on memory. You may answer in pseudocode or any ...

Google maps : How to open an InfoWindow for a Polygon by clicking on it?

Hello ! I have a simple question, but i can't find the answer in the Google Maps API documentation... I have a map with 13 polygons drawed by the API. Here is an exemple of one of these polygons : var zone_up_montblanc = new GPolygon([ new GLatLng(46.21270329318585, 6.134903900311617), new GLatLng(46.20538443787925, ...

3D Mesh Joining

I have 2 (or more) intersecting meshes, which require joining into 1 mesh object. I want to have some control over the resulting seam vertex insertion, so looking to write myself rather than use a library. Has anyone come across some open source code to base the algorithm on / ideas on the process? Initial impressions are: 1. Present in...

Drawing and filling different polygons at the same time in MATLAB

Hi,I have the code below. It load a CSV file into memory. This file contains the coordinates for different polygons.Each row of this file has X,Y coordinates and a string which tells that to which polygon this datapoint belongs. for example a polygone named "Poly1" with 100 data points has 100 rows in this file like : Poly1,X1,Y1 Poly...

Problem drawing a polygon on data clusters in MATLAB

Hi, I have some data points which I have devided into them into some clusters with some clustering algorithms as the picture below:(it might takes some time for the image to appear) Each color represents different cluster. I have to draw polygons around each cluster. I use convhull for this reason. But as you can see the polygon for t...

How to convert a GEOS MultiLineString to Polygon using Python?

I am developing a GeoDjango application where users can upload map files and do some basic mapping operations like querying features inside polygons. I recognized that users happen to upload "MultiLineString"s instead of "Polygon"s sometimes. This causes the queries expecting closed geometries to fail. What is the best way to convert...