Reputation: 48956
Say we have a line with a starting point p1
and an end point p2
. Using vtkMath::Distance2BetweenPoints(point1, point2)
, how can we measure the distance of each point in the line with respect to the starting point in the line?
The documentation of this function can be found here: http://www.vtk.org/doc/nightly/html/classvtkMath.html#a11944eda4bd17e4e57bcd1e49c2f9446
Thanks.
Upvotes: 0
Views: 215
Reputation: 2956
Distance2BetweenPoints is nothing else than a convenient function for computing (x1-x2)^2 + (y1-y2)^2+(zi-z2)^2
(btw, remember that for getting the actual distance you need the square root).
So you just need to iterate and compute the distance between each point and the starting point (the fact that they are on a line is not relevant).
Upvotes: 1