computational-geometry

How to tell if a line intersects a polygon in C#?

可紊 提交于 2019-11-30 09:19:15
I have a question very similar to this: How to know if a line intersects a plane in C#? I am searching for a method (in C#) that tells if a line is intersecting an arbitrary polygon. I think the algorithm by Chris Marasti-Georg was very helpful, but missing the most important method, i.e. line to line intersection. Does anyone know of a line intersection method to complete Chris Marasti-Georg's code or have anything similar? Is there a built-in code for this in C#? This method is for use with the Bing Maps algorithm enhanced with a forbidden area feature. The resulting path must not pass

Why storing data only in the leaf nodes of a balanced binary-search tree?

我与影子孤独终老i 提交于 2019-11-30 09:09:43
I have bought a nice little book about computational geometry. While reading it here and there, I often stumbled over the use of this special kind of binary search tree. These trees are balanced and should store the data only in the leaf nodes, whereas inner nodes should only store values to guide the search down to the leaves. The following image shows an example of this trees (where the leaves are rectangles and the inner nodes are circles). I have two questions: What is the advantage of not storing data in the inner nodes? For the purpose of learning, I would like to implement such a tree.

Find rectangles that contain point – Efficient Algorithm

妖精的绣舞 提交于 2019-11-30 08:47:03
Good afternoon. My situation: In two-dimensional space . Input : a set of rectangles ( overlapping rectangles too). Rectangles coordinates are integer type . There are not any constraints on rectangle-size and rectangle-location (only extent of integer). No rectangles have width=0 or height=0. I need to find : all rectangles that contain entered point (with integer coordinates). Questions: What is the efficient structure to keep rectangles? What alghorithm is efficient in this case? And what algorithm is efficient only for adding rectangles without removing? Thanks :-). R-Tree is the best data

Determine the position of a point in 3D space given the distance to N points with known coordinates

久未见 提交于 2019-11-30 07:56:25
I am trying to determine the (x,y,z) coordinates of a point p. What I have are the distances to 4 different points m1, m2, m3, m4 with known coordinates. In detail: what I have is the coordinates of 4 points (m1,m2,m3,m4) and they are not in the same plane: m1: (x1,y1,z1), m2: (x2,y2,z2), m3: (x3,y3,z3), m4: (x4,y4,z4) and the Euclidean distances form m1->p, m2->p, m3->p and m4->p which are D1 = sqrt( (x-x1)^2 + (y-y1)^2 + (z-z1)^2); D2 = sqrt( (x-x2)^2 + (y-y2)^2 + (z-z2)^2); D3 = sqrt( (x-x3)^2 + (y-y3)^2 + (z-z3)^2); D4 = sqrt( (x-x4)^2 + (y-y4)^2 + (z-z4)^2); I am looking for (x,y,z). I

Trilateration in a 2D plane with signal strengths

别来无恙 提交于 2019-11-30 07:22:45
first question to StackOverflow, please be gentle. I am trying to find the equation (and then the algorithm for) the center point of three different points on a 2D cartesian plane, given a certain magnitude or "signal strength". These signal strengths are all on a scale relative to each other, but shouldn't necessary be conflated with "radius" of a circle. Wikipedia entry on trilateration: http://en.wikipedia.org/wiki/Trilateration I've also checked out this thread, but it's a little different than what I need Trilateration using 3 latitude and longitude points, and 3 distances A general

Is there some well-known algorithm which turns user's drawings into smoothed shapes?

 ̄綄美尐妖づ 提交于 2019-11-30 06:53:30
My requirements: A user should be able to draw something by hand. Then after he takes off his pen (or finger) an algorithm smooths and transforms it into some basic shapes. To get started I want to transform a drawing into a rectangle which resembles the original as much as possible. (Naturally this won't work if the user intentionally draws something else.) Right now I'm calculating an average x and y position, and I'm distinguishing between horizontal and vertical lines. But it's not yet a rectangle but some kind of orthogonal lines. I wondered if there is some well-known algorithm for that,

Is there a robust C++ implementation of the Bentley-Ottmann algorithm?

佐手、 提交于 2019-11-30 06:47:07
问题 The Bentley-Ottoman algorithm finds all crossings in a set of line segments. For a well known and important algorithm, it seems quite weird that a C++ implementation of Bentley-Ottmann algorithm — the implementation that can handle all the degenerated cases (i.e., no special assumption on the sweeping line and the number of intersection points, and so on) — is simply not available. The only code I can found is here, but it doesn't seem to handle the generalized case. Is Bentley-Ottmann

How to check if a point (x,y) is inside a polygon in the Cartesian coordinate system? [duplicate]

谁说我不能喝 提交于 2019-11-30 06:37:28
问题 This question already has answers here : Closed 7 years ago . This question already has an answer here: Point in Polygon aka hit test C# Point in polygon Given a random polygon formulated with N line equations in the Cartesian coordinate system, is there any standard formula that is used to check for membership of a point (x,y)? The simple solution is to get all the line formulas and check if point X is below this line, above that line and to the right of the other line, etc. But this will

Algorithm for path simplification and smoothing of 2D trajectories

本小妞迷上赌 提交于 2019-11-30 05:20:00
I'm searching for an algorithm for path simplification and smoothing for 2D trajectories. So I have a ordered list of 2D points. These points should be simplified, e.g. with the Ramer–Douglas–Peucker algorithm. But the output must be smooth, so the resulting path should be constructed from Bezier curves or splines. Is there any modification of the Ramer–Douglas–Peucker algorithm which could handle this? I found a path simplification algorithm in the paper.js library, which does exactly what I'm searching for: http://paperjs.org/examples/path-simplification/ But I was not able to understand the

Mesh Generation for Computational Science in Python

你说的曾经没有我的故事 提交于 2019-11-30 04:00:44
问题 I have a need for a Python module/package that provides a mesh on which I can do computational science? I am not doing graphics, so I don't think the blender package is what I want. Does anyone know of a good package? 回答1: The most useful packages out there are perhaps mshr, pygalmesh, dmsh, pygmsh, and MeshPy. I've created a repo showcasing a number of examples. In addition, there is optimesh for improving the quality of any mesh. (Disclaimer: I'm the author of pygmsh, pygalmesh, dmsh, and