tesselation

How to convert a polygon to a set on non-overlapping triangles?

廉价感情. 提交于 2019-12-06 09:32:19
I have a coordinate set of 2D points that form a closed polygon. I need to generate a set of 2D triangles that distribute the polygon completely. There are no constrains as such except that the triangles should fill the area of polygon completely. It would be even more helpful if it is a standard algorithm I could implement. As mentioned above, Delaunay triangulation is a rather complicated algorithm for this task. If you accept O(n^2) running time, you may try Ear Clipping algorithm which is much more easier to understand and to code. The basic idea is the following. Every polygon with >= 4

Efficient Packing Algorithm for Regular Polygons

时光怂恿深爱的人放手 提交于 2019-12-06 00:05:13
问题 I'm looking for a packing algorithm which will reduce a regular polygon into rectangles and right triangles. The algorithm should attempt to use as few such shapes as possible and should be relatively easy to implement (given the difficulty of the challenge). If possible, the answer to this question should explain the general heuristics used in the suggested algorithm. 回答1: I think the answer is fairly simple for regular polygons. Find an axis of symmetry, and draw a line between each vertex

Covering Earth with Hexagonal Map Tiles

痞子三分冷 提交于 2019-12-04 07:24:07
问题 Many strategy games use hexagonal tiles. One of the main advantages is that the distance between the center of any tile and all its neighboring tiles is the same. I was wondering if anyone has any thoughts on marrying a hexagonal tile system with the traditional geographic system (longitude/latitude). I think it would be interesting to cover a globe with hexagonal tiles and be able to map a geographic coordinate to a tile. Has anyone seen anything remotely close to this before? UPDATE I'm

Finding voronoi regions that contain a list of arbitrary coordinates

百般思念 提交于 2019-12-04 07:06:29
I am working with an algorithm that, for each iteration, needs to find which region of a Voronoi diagram a set of arbirary coordinats belong to. that is, which region each coordinate is located within. (We can assume that all coordinates will belong to a region, if that makes any difference.) I don't have any code that works in Python yet, but the the pseudo code looks something like this: ## we are in two dimensions and we have 0<x<1, 0<y<1. for i in xrange(1000): XY = get_random_points_in_domain() XY_candidates = get_random_points_in_domain() vor = Voronoi(XY) # for instance scipy.spatial

Efficient Packing Algorithm for Regular Polygons

给你一囗甜甜゛ 提交于 2019-12-04 04:30:45
I'm looking for a packing algorithm which will reduce a regular polygon into rectangles and right triangles. The algorithm should attempt to use as few such shapes as possible and should be relatively easy to implement (given the difficulty of the challenge). If possible, the answer to this question should explain the general heuristics used in the suggested algorithm. Tom Sirgedas I think the answer is fairly simple for regular polygons. Find an axis of symmetry, and draw a line between each vertex and its mirror. This divides the polygon into trapezoids. Each trapezoid can be turned into a

C++ 2D tessellation library?

。_饼干妹妹 提交于 2019-12-03 06:27:00
I've got some convex polygons stored as an STL vector of points (more or less). I want to tessellate them really quickly, preferably into fairly evenly sized pieces, and with no "slivers". I'm going to use it to explode some objects into little pieces. Does anyone know of a nice library to tessellate polygons (partition them into a mesh of smaller convex polygons or triangles)? I've looked at a few I've found online already, but I can't even get them to compile. These academic type don't give much regard for ease of use. balint.miklos CGAL has packages to solve this problem. The best would be

Covering Earth with Hexagonal Map Tiles

▼魔方 西西 提交于 2019-12-02 13:56:45
Many strategy games use hexagonal tiles. One of the main advantages is that the distance between the center of any tile and all its neighboring tiles is the same. I was wondering if anyone has any thoughts on marrying a hexagonal tile system with the traditional geographic system (longitude/latitude). I think it would be interesting to cover a globe with hexagonal tiles and be able to map a geographic coordinate to a tile. Has anyone seen anything remotely close to this before? UPDATE I'm looking for a way to subdivide the surface of a sphere so that each division has the same surface area.

Force GLUtesselator to generate only GL_TRIANGLES?

泄露秘密 提交于 2019-12-01 06:51:02
It's pretty hard to render the data I generate, if I want to use one vertex array format only. I tried to provide GLU_TESS_EDGE_FLAG_DATA callback, but it made my program crash. (also tried without "_DATA" in end, same effect). How can I get it to generate GL_TRIANGLES only? gluTessCallback() , GLU_TESS_EDGE_FLAG : ... if a non-NULL edge flag callback is provided ... fans and strips are converted to independent triangles. This is what I've been using: struct TessContext { ~TessContext() { for( size_t i = 0; i < combined.size(); ++i ) { delete[] combined[i]; } } typedef std::pair< double,

Force GLUtesselator to generate only GL_TRIANGLES?

房东的猫 提交于 2019-12-01 04:15:07
问题 It's pretty hard to render the data I generate, if I want to use one vertex array format only. I tried to provide GLU_TESS_EDGE_FLAG_DATA callback, but it made my program crash. (also tried without "_DATA" in end, same effect). How can I get it to generate GL_TRIANGLES only? 回答1: gluTessCallback(), GLU_TESS_EDGE_FLAG : ... if a non-NULL edge flag callback is provided ... fans and strips are converted to independent triangles. This is what I've been using: struct TessContext { ~TessContext() {

Tessellating an arbitrary polygon by tiling triangles

一曲冷凌霜 提交于 2019-11-30 09:24:20
I need to fill an arbitrary polygon using a near-uniform tiling of triangles. How would I do this? You may provide either references to existing algorithms or even simply ideas or hints of your own. The following is presumed: The polygon may be convex (but bonus points if you come up with an algorithm that works for concave shapes) The polygon has an arbitrary number of edges (3 or more) The amount of tessellation (preferably the number of vertices added by the algorithm) should be parametrized The polygon's edges may be divided by the algorithm Triangles should be nearly uniform in size and