computational-geometry

iOS: derive angle of tap point given a circle

守給你的承諾、 提交于 2019-12-01 10:27:23
I have got a UIImageView displaying a circle divided in six equal triangles corresponding to: area1 between 0-60 degrees area2 between>60-120 degrees area3 between>120-180 degrees area4 between>180-240 degrees area5 between>240-300 degrees area6 between>300-360 degrees The circle is similar to the following (pardon me for the bad drawing): I would like to derive from the touch point in which area the tap is. For example if the user taps at the top right corner of the circle then the area should be area 2: ">60-120". The input data I got is: width and height of the frame containing the circle

Heuristics to sort array of 2D/3D points according their mutual distance

元气小坏坏 提交于 2019-12-01 08:57:23
问题 Consider array of points in 2D,3D,(4D...) space ( e.g. nodes of unstructured mesh ). Initially the index of a point in array is not related to its position in space. In simple case, assume I already know some nearest neighbor connectivity graph. I would like some heuristics which increase probability that two points which are close to each other in space would have similar index (would be close in array). I understand that exact solution is very hard (perhaps similar to Travelling salesman

Confusion on Delaunay Triangulation and Largest inscribed circle

孤街浪徒 提交于 2019-12-01 07:49:02
问题 I need to find a largest inscribed circle of a convex polygon, I've searched many sites and I get that this can be done by using Delaunay triangulation. I found a thread in CGAL discussion with an algorithm using CGAL: You can compute this easily with CGAL: First, compute the Delaunay triangulation of the points. Then, iterate on all the finite faces of the triangulation. For each finite face f compute its circumcenter c locate c in the triangulation (to speed up things, you can give one

How to correct winding of triangles to counter-clockwise direction of a 3D Mesh model?

ぃ、小莉子 提交于 2019-12-01 06:22:32
First of all let me clear .. I am not asking about 2D mesh, to determine the winding order of 2D mesh its very easy with normal-z direction. Second is, I am not asking any optimized algorithm, I do not worry about the time or speed, I just want to do it with my mesh. When I triangulate a 3D object using Greedy Projection Triangulation algorithm, This problem happens. check the attached images. If I apply 2D approaches to this model using "Calculate Signed Area" or "Cross production of AB and BC vectors of a triangle", it only solves the 2D mesh but how about a 3D mesh? First we need to check

rgl vector diagrams: show right angles for orthogonal vectors

笑着哭i 提交于 2019-12-01 05:56:20
In the matlib package, https://github.com/friendly/matlib/ , I have a function, vectors3d() to draw geometric vector diagrams. The following code gives an example figure showing a unit vector "J" and some of its projections on the X, Y, Z axes. In the calls to segments3d , each argument is a 2 x 3 matrix giving start/end coordinates. if (!require(matlib)) devtools::install_github(friendly/matlib) library(matlib) library(rgl) vec <- rbind(diag(3), c(1,1,1)) rownames(vec) <- c("X", "Y", "Z", "J") open3d() vectors3d(vec, col=c(rep("black",3), "red"), lwd=2) # draw the XZ plane, whose equation is

How to find the largest circle that lies within a sampled boundary?

試著忘記壹切 提交于 2019-12-01 05:38:22
Given sets of 2D points which are the boundaries of an irregular shape, a shape which may not be convex and may have internal holes, is there an algorithm to find the largest circle that fits within the boundaries? I've done a good bit of searching, and I do find algorithms that are close, such as the largest empty circle problem, but none that I have found so far match the constraints I have. Problem is not good defined since set of points don't bound any area. Boundary you mention should be some curve, probably polygon. Without that you can't say that there are internal holes, and also can't

How to correct winding of triangles to counter-clockwise direction of a 3D Mesh model?

不羁岁月 提交于 2019-12-01 04:59:59
问题 First of all let me clear .. I am not asking about 2D mesh, to determine the winding order of 2D mesh its very easy with normal-z direction. Second is, I am not asking any optimized algorithm, I do not worry about the time or speed, I just want to do it with my mesh. When I triangulate a 3D object using Greedy Projection Triangulation algorithm, This problem happens. check the attached images. If I apply 2D approaches to this model using "Calculate Signed Area" or "Cross production of AB and

Geodesic computation on triangle meshes?

泪湿孤枕 提交于 2019-12-01 04:02:55
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) There are many implementation for computing geodesic distance on triangle mesh. Some are approximate and some are exact. 1.Fast Marching method. This method is approximate and in practice the average error

Check if a point projected on a line segment is not outside it

戏子无情 提交于 2019-12-01 03:40:24
See the image above; basically, I want a simple test to check if a point is within the line segment's range. The information (or input, if you prefer) I have is the point's coordinates, and the line segment termination points' coordinates. The output I want is a simple boolean. How can I check this in a simple way? You can have a simple and uniform check if you use the inner product. The inner product between two vectors can be geometrically visualised as the product of the lengths of the two vectors time the cosine of the angle between the two, or the product of the length of one of the

How to find the largest circle that lies within a sampled boundary?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 03:13:39
问题 Given sets of 2D points which are the boundaries of an irregular shape, a shape which may not be convex and may have internal holes, is there an algorithm to find the largest circle that fits within the boundaries? I've done a good bit of searching, and I do find algorithms that are close, such as the largest empty circle problem, but none that I have found so far match the constraints I have. 回答1: Problem is not good defined since set of points don't bound any area. Boundary you mention