computational-geometry

Voronoi - Compute exact boundaries of every region

孤街浪徒 提交于 2019-12-31 11:01:32
问题 I'm trying to compute the exact boundaries of every region of a Voronoi Diagram using scipy.spatial.Voronoi, in the case when all the points are inside a pre-defined polygon. For example, using the example in the documentation, http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.spatial.Voronoi.html what if I need to compute Voroni with the same points but inside a rectangle with the following boundaries global_boundaries = np.array([[-2, -2], [4, -2], [4, 4], [-2, 4], [-2, -2]])

polygon vertices - clockwise or counterclockwise

依然范特西╮ 提交于 2019-12-31 03:32:05
问题 I came across this link http://www.mathopenref.com/coordpolygonarea2.html It explains how to calculate the area of a polygon and helps to identify whether the polygon vertices we entered is clockwise or counter clockwise. If area value is +ve, it is clockwise, if it is -nv then it is in counterclockwise. My requirement is to identify only whether it is clockwise or counterclockwise. Is this rule will work correctly (though there are limitations as mentioned in the link). I have only regular

Query points on the vertices of a Hamming cube

橙三吉。 提交于 2019-12-30 14:43:51
问题 I have N points that lie only on the vertices of a cube, of dimension D, where D is something like 3. A vertex may not contain any point. So every point has coordinates in {0, 1} D . I am only interested in query time , as long as the memory cost is reasonable ( not exponential in N for example :) ). Given a query that lies on one of the cube's vertices and an input parameter r , find all the vertices (thus points) that have hamming distance <= r with the query. What's the way to go in a c++

Uniform discretization of Bezier curve

眉间皱痕 提交于 2019-12-30 07:25:27
问题 I need to discretise a 3rd order Bezier curve with points equally distributed along the curve. The curve is defined by four points p0, p1, p2, p3 and a generic point p(t) with 0 < t < 1 is given by: point_t = (1 - t) * (1 - t) * (1 - t) * p0 + 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t * p3; My first idea was to discretise t = 0, t_1, ... t_n, ..., 1 This doesn't work as, in general, we don't end up with a uniform distance between the discretised points. To sum up,

How to generate random vertices to form a convex polygon in c++?

故事扮演 提交于 2019-12-30 06:25:20
问题 I need to generate a set of vertices for a simple convex polygon to do a minimum weight triangluation for that polygon using dynamic programming , I thought about taking a circle of radius r and then take 20 vertices moving counter clock wise and then i will form a 20 vertex convex polygon but i how can i do that How would i know the vertex that lies on a circle of radius r ? and is there another easier way of generating vertices for convex polygon other than that way Any help greatly

kNN: training, testing, and validation

守給你的承諾、 提交于 2019-12-30 05:00:06
问题 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

How to tell if a line intersects a polygon in C#?

假如想象 提交于 2019-12-30 03:13:04
问题 I have a question very similar to this: How to know if a line intersects a plane in C#? I am searching for a method (in C#) that tells if a line is intersecting an arbitrary polygon. I think the algorithm by Chris Marasti-Georg was very helpful, but missing the most important method, i.e. line to line intersection. Does anyone know of a line intersection method to complete Chris Marasti-Georg's code or have anything similar? Is there a built-in code for this in C#? This method is for use with

Given a set of polygons and a series of points, find the which polygons are the points located

筅森魡賤 提交于 2019-12-29 07:08:10
问题 This is a question similar to the one here, but I figure that it would be helpful if I can recast it in a more general terms. I have a set of polygons, these polygons can touch one another, overlap and can take on any shape. My question is, given a list of points, how to devise an efficient algorithm that find which polygons are the points located? One of the interesting restriction of the location of the points is that, all the points are located at the edges of the polygons, if this helps.

The Maximum Volume of Trapped Rain Water in 3D

随声附和 提交于 2019-12-28 08:08:51
问题 A classic algorithm question in 2D version is typically described as Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given the input [0,1,0,2,1,0,1,3,2,1,2,1] the return value would be 6 The algorithm that I used to solve the above 2D problem is int trapWaterVolume2D(vector<int> A) { int n = A.size(); vector<int> leftmost(n, 0), rightmost(n, 0); //left exclusive scan, O(n), the

Calculate endpoint given distance, bearing, starting point

你。 提交于 2019-12-28 06:46:05
问题 I am trying to find the destination point, given a starting point lat/long, bearing & distance. The calculator from this website below gives me the desired results. http://www.movable-type.co.uk/scripts/latlong.html When I try to implement the same through code, I don't get the right results. Below is my code - private GLatLng pointRadialDistance(double lat1, double lon1, double radianBearing, double radialDistance) { double rEarth = 6371.01; lat1 = DegreeToRadian(lat1); lon1 = DegreeToRadian