points

Return surface triangle of 3D scipy.spatial.Delaunay

限于喜欢 提交于 2019-11-30 13:21:50
问题 I have this problem. I try to triangulate points cloud by scipy.spatial.Delaunay. I used: tri = Delaunay(points) # points: np.array() of 3d points indices = tri.simplices vertices = points[indices] But, this code return tetrahedron. How is it possible return triangle of surface only? Thanks 回答1: To get it to work as in code form, you have to parametrize the surface to 2D. For example in the case of ball (r,theta, psi), radius is constant (drop it out) and points are given by (theta,psi) which

Closest pair for any of a huge number of points

自古美人都是妖i 提交于 2019-11-30 09:40:23
问题 We are given a huge set of points in 2D plane. We need to find, for each point the closest point within the set. For instance suppose the initial set is as follows: foo <- data.frame(x=c(1,2,4,4,10),y=c(1,2,4,4,10)) The output should be like this: ClosesPair(foo) 2 1 4 3 3 # (could be 4 also) Any idea? 回答1: The traditional approach is to preprocess the data and put it in a data structure, often a K-d tree, for which the "nearest point" query is very fast. There is an implementation in the

How to draw a lines between points and pull those points?

这一生的挚爱 提交于 2019-11-30 09:14:11
I want to draw the lines between points on the view, and then pull those points upto desired positions even the shape will change. i know how to draw the line between two points canvas.drawLine(10, 10, 90, 10, paint); by using this i can draw the lines between points. EDIT : here i am attaching image for clear explanation, from Paul answer now i am able to draw the lines between points, still have the problem of pulling points... Here's how it's done. Suppose you have your points, make these global: PointF topLeft = new PointF(10,10); PointF topRight = new PointF(90,10); PointF bottomLeft =

Generator of evenly spaced points in a circle in python

断了今生、忘了曾经 提交于 2019-11-30 07:29:32
I am tasked with generating evenly (more or less) spaced points on concentric rings of an invisible circle. The function should take a list of radii, and number of points to plot for a given radius as arguments. For example for a radius of 0 it should plot 1 point at (0,0). For a circle of radius of 1, it should plot 10 points along the circumference of the circle, spaced out by an angle of 2pi/10. For a circle of radius 2, 20 points along the circumference, spaced out by an angle of 2pi/20. The generator should take the following parameters: n, r_max, m and should generate rings of coordinate

OpenCV: How to get inlier points using findHomography()/findFundamental() and RANSAC

为君一笑 提交于 2019-11-30 06:56:18
OpenCV does not provide a RANSAC-function per se or at least in such a form that you can just call it and be done with it (e.g. cv::ransac(...) ). All functions/methods that are able to use RANSAC have a flag that enables it. However this is not always useful if you actually want to do something else with the inliers RANSAC computes after you have estimated a homography/fundamental matrix for example create a nice plot in Octave or similar software/library of the points, apply additional algorithms on the remaining set of filtered matches etc. After matching two images one gets a vector of

Finding points on a line with a given distance

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 06:54:34
问题 I have a question i know a line i just know its slope(m) and a point on it A(x,y) How can i calculate the points(actually two of them) on this line with a distance(d) from point A ??? I m asking this for finding intensity of pixels on a line that pass through A(x,y) with a distance .Distance in this case will be number of pixels. 回答1: I would suggest converting the line to a parametric format instead of point-slope. That is, a parametric function for the line returns points along that line

Algorithm to cover maximal number of points with one circle of given radius

北城以北 提交于 2019-11-29 21:20:12
Let's imagine we have a plane with some points on it. We also have a circle of given radius. I need an algorithm that determines such position of the circle that it covers maximal possible number of points. Of course, there are many such positions, so the algorithm should return one of them. Precision is not important and the algorithm may do small mistakes. Here is an example picture: Input: int n (n<=50) – number of points; float x[n] and float y[n] – arrays with points' X and Y coordinates; float r – radius of the circle. Output: float cx and float cy – coordinates of the circle's center

Finding closest pair of points on a sphere

一曲冷凌霜 提交于 2019-11-29 21:03:39
问题 I know how to implement n log n closest pair of points algorithm (Shamos and Hoey) for 2D cases (x and y). However for a problem where latitude and longitude are given this approach cannot be used. The distance between two points is calculated using the haversine formula. I would like to know if there is some way to convert these latitudes and longitudes to their respective x and y coordinates and find the closest pair of points, or if there is another technique that can be used to do it. 回答1

Closest pair for any of a huge number of points

久未见 提交于 2019-11-29 17:18:20
We are given a huge set of points in 2D plane. We need to find, for each point the closest point within the set. For instance suppose the initial set is as follows: foo <- data.frame(x=c(1,2,4,4,10),y=c(1,2,4,4,10)) The output should be like this: ClosesPair(foo) 2 1 4 3 3 # (could be 4 also) Any idea? The traditional approach is to preprocess the data and put it in a data structure, often a K-d tree , for which the "nearest point" query is very fast. There is an implementation in the nnclust package. library(nnclust) foo <- cbind(x=c(1,2,4,4,10),y=c(1,2,4,4,10)) i <- nnfind(foo)$neighbour

Generate a large list of points with no duplicates

本秂侑毒 提交于 2019-11-29 16:49:21
I want to create a large list containing 20,000 points in the form of: [[x, y], [x, y], [x, y]] where x and y can be any random integer between 0 and 1000. How would I be able to do this such that there are no duplicate coordinates [x, y]? You could just use a while loop to pad it out until it's big enough: >>> from random import randint >>> n, N = 1000, 20000 >>> points = {(randint(0, n), randint(0, n)) for i in xrange(N)} >>> while len(points) < N: ... points |= {(randint(0, n), randint(0, n))} ... >>> points = list(list(x) for x in points) Your initial idea was probably slow because it was