computational-geometry

Partition the Unit Sphere

☆樱花仙子☆ 提交于 2020-01-14 18:45:49
问题 I'd like to make a lookup table for unit vectors. Each unit vector would map to a bin in this table, and the bin would contain some information for a small set of vectors with similar directions. I could easily represent a vector using ($\theta$, $\phi$, 1), and then chop the angle ranges into bins to make a 2D lookup table (so the first bin is theta in the range of 0 to $2*\pi / N$, where N is the number of bins I want for the theta direction). The trouble with this is that I think that some

Problems rendering a Polar Zonohedron in Processing

余生颓废 提交于 2020-01-14 14:13:33
问题 I've recently been looking into Zonohedrons and Rob Bell made beautiful ones. I had a play with the free Polar Zonohedron Sketchup Plugin and thought about playing with the geometry using Processing. So far I've open up the plugin/Ruby script and tried to port it directly, but I am not experienced with Ruby and have been using the Sketchup Ruby API reference. The geometry part of the code is mostly in the polar_zonohedron function: def polar_zonohedron #frequency, pitch = atan(sqrt(2)/2), len

Width of an arbitrary polygon

最后都变了- 提交于 2020-01-13 19:43:51
问题 I need a way to characterize the size of sets of 2-D points, so I can determine whether to render them as individual points in a space or as representative polygons, dependent on the scale of the viewport. I already have an algorithm to calculate the convex hull of the set to produce the representative polygon, but I need a way to characterize its size. One obvious measure is the maximum distance between points on the convex hull, which is the diameter of the set. But I'm really more

Width of an arbitrary polygon

放肆的年华 提交于 2020-01-13 19:43:47
问题 I need a way to characterize the size of sets of 2-D points, so I can determine whether to render them as individual points in a space or as representative polygons, dependent on the scale of the viewport. I already have an algorithm to calculate the convex hull of the set to produce the representative polygon, but I need a way to characterize its size. One obvious measure is the maximum distance between points on the convex hull, which is the diameter of the set. But I'm really more

3d point closest to multiple lines in 3D space

只愿长相守 提交于 2020-01-13 13:50:13
问题 I search for non iterative, closed form, algorithm to find Least squares solution for point closest to the set of 3d lines. It is similar to 3d point triangulation (to minimize re-projections) but seems to be be simpler and faster? Lines can be described in any form, 2 points, point and unit direction or similar. 回答1: Let the i th line be given by point a i and unit direction vector d i . We need to find the single point that minimizes the sum of squared point to line distances. This is where

Self Avoiding Random Walk in a 3d lattice using pivot algorithm in python

爷,独闯天下 提交于 2020-01-13 10:27:27
问题 I was working on a problem from past few days, It is related to creating a self avoiding random walks using pivot algorithm and then to implement another code which places spherical inclusions in a 3d lattice. I have written two codes one code generates coordinates of the spheres by using Self avoiding random walk algorithm and then another code uses the co-ordinates generated by the first program and then creates a 3d lattice in abaqus with spherical inclusions in it. The result which will

Bentley-Ottmann Algorithm Implementation

旧街凉风 提交于 2020-01-13 09:45:09
问题 Is there any existing Bentley-Ottmann Algorithm Implementation/library in C# or Java? 回答1: Here is a Java implementation of the Bentley-Ottman algorithm 回答2: Here is at least a C++ implementation (including description): http://softsurfer.com/Archive/algorithm_0108/algorithm_0108.htm 来源: https://stackoverflow.com/questions/8113263/bentley-ottmann-algorithm-implementation

Efficient algorithm for finding closest point in a finite set to another point

青春壹個敷衍的年華 提交于 2020-01-11 11:57:05
问题 I have a list L of ~30k locations (written as longitude/latitude pairs), and a list E of ~1m events (with locations written as longitude/latitude pairs), each of which occurs at a point in L. I want to tag each event in E with its corresponding location in L. But the cooordinates in L and E are rounded differently—E to five decimal places, L to thirteen—so ostensibly identical coordinates can actually differ by ~10^-5 degrees, or ~1 meter. (Points in L are separated by at least ~10 m.) I thus

Draw line and Cut off Circuler area

删除回忆录丶 提交于 2020-01-11 11:54:42
问题 I have got the below Image after running the below code. file='grayscale.png'; I=imread(file); bw = im2bw(I); bw = bwareaopen(bw,870); imwrite(bw,'noiseReduced.png') subplot(2,3,1),imshow(bw); [~, threshold] = edge(bw, 'sobel'); fudgeFactor = .5; im = edge(bw,'sobel', threshold * fudgeFactor); subplot(2,3,2), imshow(im), title('binary gradient mask'); se = strel('disk',5); closedim = imclose(im,se); subplot(2,3,3), imshow(closedim), title('Connected Cirlces'); cc = bwconncomp(closedim); S =

What's the opposite of polygon triangulation?

↘锁芯ラ 提交于 2020-01-11 10:15:32
问题 After I've done a 2D triangulation, some triangles have the same color and I want to recombine them for drawing into like-colored graphics paths. I find that if I just draw the triangles one by one, some graphic renderers shows seams between the triangles (at least if anti-aliasing and/or transparency is involved). So how do I take a set of (non-overlapping) triangles and produce a graphics path, which may contain holes and disjoint polygons? Blindly adding the triangles to a graphics path