computational-geometry

Geodesic computation on triangle meshes?

老子叫甜甜 提交于 2019-12-01 01:12:21
问题 I am trying to find the distance between two points on a triangulated surface (geodesic distance). It looks like a basic operation and is not trivial. So I am wondering if there are any libraries that do this? My google fo failed, so I would greatly appreciate any pointers. (I am aware of CGAL, scipy.spatial, but I couldn't find anything in the docs, let me know if I missed something there) 回答1: There are many implementation for computing geodesic distance on triangle mesh. Some are

Boolean operations on a SVG pathstring

时光毁灭记忆、已成空白 提交于 2019-11-30 21:52:27
I've come to a conceptually difficult problem. In short, I need to find the vector path of two vector paths combined through different boolean operations. Such as the Union, the Difference, the Intersection, and Subtraction. It would be nice if I could do it similar to how Canvas does it's globalCompositeOperation. How in the world would I go about doing this? There is a JavaScript library that allows for boolean operations on SVG paths under the condition that the path is a polygon. Using a high enough sampling, the beziers can be polygonized to such a high quality that the visual result is

Mesh Generation for Computational Science in Python

房东的猫 提交于 2019-11-30 20:21:01
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? 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 optimesh.) If you're trying to solve FE or CFD style equations on a mesh you can use MeshPy in 2 and 3

Sorting polygon's points

故事扮演 提交于 2019-11-30 19:26:44
I have a convex polygon ABCDE... (it can have any number of points). I need to sort all its vertexes so none of the edges will intersect. example: A _____ B \ / \ / X / \ /___\ C D That polygon in ABCD order has intersecting edges. however in ABDC order: A _____ B | | | | | | | | |___| C D None of the edges intersect so ABDC is the expected output. How can I do this? andand Assuming your points are all on the convex hull of your polygon, you can use the following: Pick the two extreme points with the min and max X value, (call them X min and X max ) and draw the line between them. In the case

Counting integer points inside a sphere of radius R and dimension D

▼魔方 西西 提交于 2019-11-30 16:34:05
I am trying to write an efficient algorithm that counts the number of points inside a Sphere of Radius R and Dimension D. The sphere is always at the origin. Suppose we have a sphere of dimension 2 (circle) with radius 5. My strategy is to generate all possible points within the first quadrant, so for the above example we know that (1,2) is in the circle, so must all + / - combinations of that point which is simply dimension squared. So for each point found in a single quadrant of an n-dimensional sphere we add 2 ^ dimension to the total count. I'm not sure if there is a much more efficient

Counting integer points inside a sphere of radius R and dimension D

 ̄綄美尐妖づ 提交于 2019-11-30 16:19:24
问题 I am trying to write an efficient algorithm that counts the number of points inside a Sphere of Radius R and Dimension D. The sphere is always at the origin. Suppose we have a sphere of dimension 2 (circle) with radius 5. My strategy is to generate all possible points within the first quadrant, so for the above example we know that (1,2) is in the circle, so must all + / - combinations of that point which is simply dimension squared. So for each point found in a single quadrant of an n

random placement of rectangles with no overlaps

别说谁变了你拦得住时间么 提交于 2019-11-30 16:08:34
问题 I am looking for a sound algorithm that would randomly place a given number of rectangles of the same size into a bigger rectangle (canvas). I see two ways to do it: create an empty array that will contain the rectangles already placed on canvas. start with the empty canvas. in a loop, pick a position at random for a new rectangle to be placed. check if the array has a rectangle that overlaps with the new rectangle. if it does not, put the new rectangle in to the array and repeat the loop.

Parameterized function for clothoid

限于喜欢 提交于 2019-11-30 15:20:51
I'm coding renderer for road network, which based on the RoadXML format. Road curves from this format has four types: segment, circle arc, poly line, clotho arc. And I have problem with the last one. Clothoid is the same with Euler spiral and Cornu spiral. In the RoadXML clotho arc is given by three parameters: start curvature, end curvature, length. For arc triangulation I need a function like foo(t), which returns (x, y) coords for t = 0..length. I created similar methods for circle arc without problems, but I can't do it for clotho arc. Part of the problem is that I not totally understand

kNN: training, testing, and validation

泪湿孤枕 提交于 2019-11-30 14:43:10
I am extracting image features from 10 classes with 1000 images each. Since there are 50 features that I can extract, I am thinking of finding the best feature combination to use here. Training, validation and test sets are divided as follows: Training set = 70% Validation set = 15% Test set = 15% I use forward feature selection on the validation set to find the best feature combination and finally use the test set to check the overall accuracy. Could someone please tell me whether I am doing it right? So kNN is an exception to general workflow for building/testing supervised machine learning

How to calculate the mirror point along a line?

半城伤御伤魂 提交于 2019-11-30 14:05:56
In 2D plane, I have a point and a line. How to get the mirror point along this line? Suppose the equation of the line is ax + by + c = 0 . Now imagine a line perpendicular to it, which can be represented by -bx + ay + d = 0 (product of slopes of two perpendicular lines is -1). Now the problem is to find d . Put the co-ordinate of the point on the second line, and you'll get the value of d easily. The second part is, to find a point on the second line which is equidistant as the first point from the first line. For that, you can find the intersection of the two lines. Calculate the differences