computational-geometry

Substract closed mesh from surface (CGAL?)

ぃ、小莉子 提交于 2019-12-24 19:06:33
问题 I have the following problem, best described with the picture below. I have a surface in 3D, so it can have vertical overlap and is a non-closed mesh. And I have an object which I want to subtract from it. The green+yellow area is the original surface, the red lines outline a sphere (as triangulated mesh, not a primitive). The yellow area is the part of the surface intersecting the sphere that needs to be removed from the original surface. The green area is the result of the subtraction: the

Algorithm for calculating the most 'even' orientation for edges for tessellated triangles?

懵懂的女人 提交于 2019-12-24 18:43:43
问题 I've inherited some legacy code that rotates edges between triangles for improved topology distribution, this algorithm works well but is quite computationally intensive. The psudo-code given the quad made up of two triangles that share an edge is: /* split 0-2 */ score_02 = (area(v0, v1, v2) / perimeter(v0, v1, v2)) + (area(v0, v2, v3) / perimeter(v0, v2, v3)); /* split 1-3 */ score_13 = (area(v1, v2, v3) / perimeter(v1, v2, v3)) + (area(v0, v1, v3) / perimeter(v0, v1, v3)); /* negative

Point inside arbitrary polygon with partitions

左心房为你撑大大i 提交于 2019-12-24 14:42:18
问题 Say I have a polygon. It can be a convex one or not, it doesn't matter, but it doesn't have holes. It also has "inner" vertices and edges, meaning that it is partitioned. Is there any kind of popular/known algorithm or standard procedures for when I want to check if a point is inside that kind of polygon? I'm asking because Winding Number and Ray Casting aren't accurate in this case Thanks in advance 回答1: You need to clarify what you mean by 'inner vertices and edges'. Let's take a very

Direction based off of 2 Lat,Long points

不问归期 提交于 2019-12-24 07:07:00
问题 I am looking for a function that will allow me to send 2 Lat, Longs. 1 Lat, long is my base and the second is what I want to determine if it is N,S,E, or West. Or would I have to go NW,N,NE,EN,E,ES,SE,S,SW,WS,W,WN? Either way does anyone have something like this in C#? 回答1: First you can calculate the Great Circle Bearing θ = atan2( sin(Δλ).cos(φ2), cos(φ1).sin(φ2) − sin(φ1).cos(φ2).cos(Δλ) ) JavaScript (easily convertable to C#): var y = Math.sin(dLon) * Math.cos(lat2); var x = Math.cos(lat1

Intersection of segment with polygon

自古美人都是妖i 提交于 2019-12-24 05:03:46
问题 I have to create a function in MATLAB that performs the following task: Input: p polygon in the form p = [x1,y1; x2,y2; x3,y3; x4,y4...] s struct with the segment from A to B s = struct('A',[x,y],'B'[u,w]) Return: 1) An integer indicating how many intersections there are between the segment and the polygon (e.g., 0,1,2) 2) A new segment from A to B, where A is the first intersection or the initial point of the input segment and B the second point of the intersection or the last point of the

Intersection of segment with polygon

笑着哭i 提交于 2019-12-24 05:03:29
问题 I have to create a function in MATLAB that performs the following task: Input: p polygon in the form p = [x1,y1; x2,y2; x3,y3; x4,y4...] s struct with the segment from A to B s = struct('A',[x,y],'B'[u,w]) Return: 1) An integer indicating how many intersections there are between the segment and the polygon (e.g., 0,1,2) 2) A new segment from A to B, where A is the first intersection or the initial point of the input segment and B the second point of the intersection or the last point of the

Accurate parallel swathing algorithm for (GPS) guidance needed

久未见 提交于 2019-12-24 01:58:09
问题 I wrote a delphi program generating a gpx file as input for a "poor man's guidance system" for aerial spray by means of ultralight plane. By and large, it produces route (parallel swaths) using gpx file as output. The route's engine is based on the "Vincenty" algorithm which works fine for any wgs84 computation but I can't get the accuracy of grid generated by ExpertGPS of Topografix (requirement). I assume a 2D computation on the ellipsoïd : 1) From the start rtept (route point), compute the

Points on a geodesic line

北城以北 提交于 2019-12-23 20:13:47
问题 I am working on a unit sphere. I am interested to place N points on a strait line over the surface of the sphere (geodesic) between two arbitrary points. The coordinate of these points are in spherical coordinate (radians). How do I compute a set of N equally spaced points along such line. I would like to take the curvature of the sphere into account in my calculation. I am using python 2.7.9 回答1: You may consider SLERP - spherical linear interpolation P = P0*Sin(Omega*(1-t))/Sin(Omega) + P1

clipping polygon against rectangle

梦想的初衷 提交于 2019-12-23 17:27:46
问题 today I have a (simple) rendering problem for you. My current project gets datas from a file to generate a SVG file. Drawing things as polygon is pretty easy thanks to the SVG format, but I have a single problem: some of my polygons are in AND out of the page (meaning that some parts of them are displayed while the rest is not shown due to the fact they are out of the display limit). In order to optimize the final SVG file I need to reduce my polygon to a simpler form. Consider the grey

Polygon Decomposition - Removing Concave Points to Form Convex Polygons

我的未来我决定 提交于 2019-12-23 16:43:30
问题 I would like to deconstruct the following polygon shown in blue removing all of the points from the polygon that cause concavity. Currently, what I have been attempting to do is: Take each point out of the polygon Test the point to see if it falls within the polygon created by the rest of the set If true remove the point If false keep the point This works in most cases, but in the previous case the points at (2,3) and (2,4) will not both be removed. In both cases either one of the points will