computational-geometry

Convert polygons into mesh

半世苍凉 提交于 2021-02-07 00:00:20
问题 I have a lot of polygons. Ideally, all the polygons must not overlap one other, but they can be located adjacent to one another. But practically, I would have to allow for slight polygon overlap ( defined by a certain tolerance) because all these polygons are obtained from user hand drawing input, which is not as machine-precised as I want them to be. My question is, is there any software library components that: Allows one to input a range of polygons Check if the polygons are overlapped

Efficient Packing Algorithm for Irregular Polygons

我们两清 提交于 2021-02-06 03:51:32
问题 I'm looking for a packing algorithm which will reduce an irregular 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). It should also prefer rectangles over triangles where possible. If possible, the answer to this question should explain the general heuristics used in the suggested algorithm. This should run in deterministic time for irregular

Efficient Packing Algorithm for Irregular Polygons

ぃ、小莉子 提交于 2021-02-06 03:50:29
问题 I'm looking for a packing algorithm which will reduce an irregular 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). It should also prefer rectangles over triangles where possible. If possible, the answer to this question should explain the general heuristics used in the suggested algorithm. This should run in deterministic time for irregular

Generating points in area with at least X gap length in-between

我与影子孤独终老i 提交于 2021-02-06 03:47:43
问题 I am trying to come up with a method for generating X amount of random points in a given area (in my case a square). The one thing that makes this such an issue is that each point has to be at least Y units away from all other points. What springs to mind at first is (in c#) to check the distance between the new point and all existing points: while(points.Count < pointsToGenerate) { Point newPoint = NewPoint(); bool addPoint = true; foreach(Point p in points) { if((p - newPoint).Length() <

Generating points in area with at least X gap length in-between

你。 提交于 2021-02-06 03:47:06
问题 I am trying to come up with a method for generating X amount of random points in a given area (in my case a square). The one thing that makes this such an issue is that each point has to be at least Y units away from all other points. What springs to mind at first is (in c#) to check the distance between the new point and all existing points: while(points.Count < pointsToGenerate) { Point newPoint = NewPoint(); bool addPoint = true; foreach(Point p in points) { if((p - newPoint).Length() <

How do I find the Pareto-optimal points in O(nh) and O(nlog(h)) complexity?

心已入冬 提交于 2021-01-29 04:00:37
问题 Can anybody suggest an algorithm to find Pareto-optimal points (to form a staircase) just as given in diagram in O(n*h) and O(n*log(h)) time complexity, where h is the number of Pareto-optimal points? I used gift wrapping algorithm to solve this (in O(n*h) ), but it only finds convex hulls type of staircase and misses those points who form concave angles. 回答1: To put suggestion in one place. Idea is to use divide and conquer strategy. If we can find pareto point P which splits rest of pareto

Line Segement Intersection — works sometimes, sometimes not

倖福魔咒の 提交于 2021-01-28 17:51:33
问题 I'd like to display the point of intersection of two line segments. The Segments are animated, so they start and stop to intersect, based on progress. Therefore I have this code: class LineSegment { constructor(x1,y1,x2,y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } contains (x,y) { const x1 = Math.min(this.x1, this.x2), y1 = Math.min(this.y1, this.y2), x2 = Math.max(this.x1, this.x2), y2 = Math.max(this.y1, this.y2), dot = ((x - x1) * (y2 - y1)) - ((y - y1) * (x2 - x1)) ;

Line Segement Intersection — works sometimes, sometimes not

北城余情 提交于 2021-01-28 17:42:40
问题 I'd like to display the point of intersection of two line segments. The Segments are animated, so they start and stop to intersect, based on progress. Therefore I have this code: class LineSegment { constructor(x1,y1,x2,y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } contains (x,y) { const x1 = Math.min(this.x1, this.x2), y1 = Math.min(this.y1, this.y2), x2 = Math.max(this.x1, this.x2), y2 = Math.max(this.y1, this.y2), dot = ((x - x1) * (y2 - y1)) - ((y - y1) * (x2 - x1)) ;

Line Segement Intersection — works sometimes, sometimes not

纵然是瞬间 提交于 2021-01-28 17:42:07
问题 I'd like to display the point of intersection of two line segments. The Segments are animated, so they start and stop to intersect, based on progress. Therefore I have this code: class LineSegment { constructor(x1,y1,x2,y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } contains (x,y) { const x1 = Math.min(this.x1, this.x2), y1 = Math.min(this.y1, this.y2), x2 = Math.max(this.x1, this.x2), y2 = Math.max(this.y1, this.y2), dot = ((x - x1) * (y2 - y1)) - ((y - y1) * (x2 - x1)) ;

Line Segement Intersection — works sometimes, sometimes not

自古美人都是妖i 提交于 2021-01-28 17:39:50
问题 I'd like to display the point of intersection of two line segments. The Segments are animated, so they start and stop to intersect, based on progress. Therefore I have this code: class LineSegment { constructor(x1,y1,x2,y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } contains (x,y) { const x1 = Math.min(this.x1, this.x2), y1 = Math.min(this.y1, this.y2), x2 = Math.max(this.x1, this.x2), y2 = Math.max(this.y1, this.y2), dot = ((x - x1) * (y2 - y1)) - ((y - y1) * (x2 - x1)) ;