computational-geometry

Shading mask algorithm for radiation calculations

帅比萌擦擦* 提交于 2019-12-19 10:52:22
问题 I am working on a software (Ruby - Sketchup) to calculate the radiation (sun, sky and surrounding buildings) within urban development at pedestrian level. The final goal is to be able to create a contour map that shows the level of total radiation. With total radiation I mean shortwave (light) and longwave(heat). (To give you an idea: http://www.iaacblog.com/maa2011-2012-digitaltools/files/2012/01/Insolation-Analysis-All-Year.jpg) I know there are several existing software that do this, but I

Sorting voronoi cell vertices to compute polygon

 ̄綄美尐妖づ 提交于 2019-12-19 10:16:59
问题 I'm currently trying to get the clipped cells from a Polygon-Voronoi-Intersection. Here is what I've got so far: I have a polygon and computed some points in it to calculate a voronoi diagram and the red lines on the figure below are the voronoi edges. Then I used an algorithm to get the corner points from every cell and now I need to get the corners in the right direction (clockwise) to generate the cell polygon. Found Corners for one cell First I was using this method: private List<Vector>

Finding polygons within an undirected Graph

爷,独闯天下 提交于 2019-12-19 08:04:50
问题 Please see Image: http://i.stack.imgur.com/NPUmR.jpg I have an undirected graph which contains one or more connected sub graphs. The graph is defined by a set of ordered pairs of connected vertices. There may be upto 300 vertices. The graph is planar. I need to identify polygons as shown in the Image. Each of the coloured areas in a separate polygon. A rough heuristic could be that polygons are "enclosed regions" between closed edge loops (cycles) in the graph. It's been suggested in similar

rgl vector diagrams: show right angles for orthogonal vectors

别等时光非礼了梦想. 提交于 2019-12-19 07:49:12
问题 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"

Sorting polygon's points

房东的猫 提交于 2019-12-18 20:02:39
问题 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? 回答1: Assuming your points are all on the convex hull of your polygon, you can use the following: Pick the two extreme points

Test point for its position relative to the convex hull in log(n)

谁说我不能喝 提交于 2019-12-18 19:03:25
问题 I have a collection of 2D points S and I need to test if an input point q is inside or outside the convex hull of S . Since it's about a binary decision, I was thinking I could theoretically achieve O(log(N)) by using a decision tree. However I have no idea how to organize the data and how the algorithm would look like to really get an answer in O(log(N)) . While researching with this idea in mind, I've found this: How can we find these two cases more quickly? Binary search. Just search for x

Parameterized function for clothoid

此生再无相见时 提交于 2019-12-18 17:26:38
问题 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

how to determine whether a point lies inside a rectangle? [duplicate]

江枫思渺然 提交于 2019-12-18 13:24:51
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Finding whether a point lies inside a rectangle or not There is an interview question that is, "How to determine whether a point lies inside a rectangle" Note that the rectangle could be rotated as well. So the simple solution of checking point inside the rectangle doesn't stands valid here... Please share your thoughts on this question.. I found a link on internet, and was trying to understand it, but failed...

How to calculate the mirror point along a line?

倖福魔咒の 提交于 2019-12-18 13:24:50
问题 In 2D plane, I have a point and a line. How to get the mirror point along this line? 回答1: 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

Why storing data only in the leaf nodes of a balanced binary-search tree?

守給你的承諾、 提交于 2019-12-18 13:21:20
问题 I have bought a nice little book about computational geometry. While reading it here and there, I often stumbled over the use of this special kind of binary search tree. These trees are balanced and should store the data only in the leaf nodes, whereas inner nodes should only store values to guide the search down to the leaves. The following image shows an example of this trees (where the leaves are rectangles and the inner nodes are circles). I have two questions: What is the advantage of