computational-geometry

Determining polygon intersection and containment

二次信任 提交于 2019-12-20 12:21:47
问题 I have a set of simple (no holes, no self-intersections) polygons, and I need to check that they don't intersect each other (one can be entirely contained in another; that is okay). I can check this by simply checking the per-vertex inside-ness of one polygon versus other polygons. I also need to determine the containment tree, which is the set of relationships that say which polygon contains any given polygon. Since no polygon can intersect any other, then any contained polygon has a unique

Algorithm or software for slicing a mesh

丶灬走出姿态 提交于 2019-12-20 09:18:49
问题 What is the right approach for slicing a 3D mesh? The mesh are all closed surfaces and the slices need to be binary images of what's inside the mesh. So for example, a mesh representing a sphere and slice images are those of filled circles. I am looking for a software library or algorithm that I can integrate into my current C++ project. 回答1: My open source game library contains an implementation of mesh slicing. It works with the Irrlicht api, but could be rewritten to use a different API

Closest distance between two points(disjoint set)

孤街浪徒 提交于 2019-12-20 09:02:57
问题 This problem is a kind of closest pair between two disjoint set. Upperside picture is expressed this problem. there is two kind of disjoint set, blue dots in -x plane, red dots in +x plane. I want to calculate minimum distance(distance is |y2-y1| + |x2 - x1|) between one blue dot and one red dot , and I think use binary search for finding distance . How to use binary search this kind of problem? I struggle on only expressing binary search two disjoint sets . I have already know for one set ,

Determine non-convex hull of collection of line segments

寵の児 提交于 2019-12-20 08:40:58
问题 I have a computational geometry problem that I feel should have a relatively simple solution, but I can't quite figure it out. I need to determine the non-convex outline of a region defined by several line segments. I'm aware of various non-convex hull algorithms (e.g. alpha shapes), but I don't need a fully general algorithm, as the line segments define a unique solution in most cases. As @Jean-FrançoisCorbett has pointed out, there are cases where there are multiple solutions. I clearly

Choose the closest k points from given n points

匆匆过客 提交于 2019-12-20 08:23:05
问题 You are given a set U of n points on the plane and you can compute distance between any pair of points in constant time. Choose a subset of U called C such that C has exactly k points in it and the distance between the farthest 2 points in C is as small as possible for given k. 1 < k <= n What's the fastest way to do this besides the obvious n-choose-k solution? 回答1: A solution is shown in Finding k points with minimum diameter and related problems - Aggarwal, 1991. The algorithm described

Choose the closest k points from given n points

三世轮回 提交于 2019-12-20 08:23:04
问题 You are given a set U of n points on the plane and you can compute distance between any pair of points in constant time. Choose a subset of U called C such that C has exactly k points in it and the distance between the farthest 2 points in C is as small as possible for given k. 1 < k <= n What's the fastest way to do this besides the obvious n-choose-k solution? 回答1: A solution is shown in Finding k points with minimum diameter and related problems - Aggarwal, 1991. The algorithm described

Dividing a plane of points into two equal halves [closed]

五迷三道 提交于 2019-12-20 08:04:04
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 months ago . Given a 2 dimensional plane in which there are n points. I need to generate the equation of a line that divides the plane such that there are n/2 points on one side and n/2 points on the other. 回答1: I have assumed the points are distinct, otherwise there might not even be such a line. If points are distinct,

Drawing a super-ellipse with a turtle

坚强是说给别人听的谎言 提交于 2019-12-20 05:59:22
问题 Obviously, any shape drawable by other means can be drawn by a turtle. Circles and squares are easy rt 1 fd .0 and if ticks mod 100 = 0 [rt 90] fd 1 Super-ellipses not so much. (regular ellipses are not trivial either.) The Wikipedia article on super-ellipses if you need to be refreshed on the topic. Any input is appreciated. Using a pendown turtle is there way to make a super-ellipse that emerges from turtle movement? 回答1: I have 1/4 of it, I suppose you could piece-wise put the other three

find which tetrahedral element a point belongs to

我是研究僧i 提交于 2019-12-20 04:34:13
问题 I have a tetrahedral mesh of a 3d region. The mesh is defined by two files with extensions .node and .ele which contain data related to nodes and elements (this is the format of output files from tetgen, the 3d Delaunay tetrahedralization program). The .node file contains in each line the node number and the x,y,z co-ordinates of that node. The .ele file contains the element number and node numbers corresponding to its four vertices. Now, given any point (x1,y1,z1), what is the easiest

Cubic Bezier reverse GetPoint equation: float for Vector <=> Vector for float

百般思念 提交于 2019-12-20 04:32:46
问题 Is it possible to get float t back given the resulting value and the four points? If so, how? public static Vector3 GetPoint (Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t) { t = Mathf.Clamp01(t); float oneMinusT = 1f - t; return oneMinusT * oneMinusT * oneMinusT * p0 + 3f * oneMinusT * oneMinusT * t * p1 + 3f * oneMinusT * t * t * p2 + t * t * t * p3; } Code from this Tutorial by Jasper Flick 回答1: It is, and involves implementing root finding for third degree functions. One direct