LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Euclidean Distance?

Solved!
Go to solution

I know that to measure distance between a set of points the equation is SQRT((x2-x1)^2+(y2-y1)^2)

 

I want to double the length of a line a-b for a new line a-c. How do I solve for c? Is there something in vi.lib?

=====================
LabVIEW 2012


0 Kudos
Message 1 of 9
(5,831 Views)

This stuff was a looonnng time ago for me, but assuming a is common, wouldn't c just be 2b-a (calculated on a per x and y basis), without needing the squares and roots? 

 

Michael

 

0 Kudos
Message 2 of 9
(5,827 Views)

That might work but I think it falls apart with angled lines.

 

Capture.PNG

=====================
LabVIEW 2012


0 Kudos
Message 3 of 9
(5,820 Views)

Easiset would be to use complex representation for the points:

 

 

Message 4 of 9
(5,803 Views)

So you have two points. A and B. They make a line segment AB and have length ||AB|| =  sqrt ( (b_x - a_x) ^ 2 + (b_y - a_y ) ^ 2 ).

 

You want to make a second point C such that ||AC|| = 2 ||AB||.

 

Then you say some nonesense about angled lines. Solving for C seems pretty easy to me.

 

Just compute C = 2 * ( B - A ) + A. Where B and A are points (i.e. clusters with an X numeric and Y numeric).distance.png


Also, there is a function in IMAQ called IMAQ Point Distances which find N - 1 distances between a list of length N points.

0 Kudos
Message 5 of 9
(5,794 Views)

You did not really specify what datatype "points" are. (in my book I always use complex in 2D :))

 

The solution by majoris is basically the same as mine, except for the datatype. For the special case of "doubling", we can go even simpler. 😄

 

 

Message 6 of 9
(5,785 Views)
Solution
Accepted by topic author SteveChandler

DoubleLength.png

Message 7 of 9
(5,780 Views)

@majoris wrote:

So you have two points. A and B. They make a line segment AB and have length ||AB|| =  sqrt ( (b_x - a_x) ^ 2 + (b_y - a_y ) ^ 2 ).

  

Then you say some nonesense about angled lines. Solving for C seems pretty easy to me.

 



Well maybe it is nonsense. Other than that thanks for your answer.

 

Who to give the accepted solution to? Darins was the smallest and simplest. In fact it is so simple that I regret asking Smiley Happy

 

=====================
LabVIEW 2012


0 Kudos
Message 8 of 9
(5,761 Views)

> That might work but I think it falls apart with angled lines.

 

Now why would you post something that proves my point?  🙂  (Sqrt of 200 is 14.142...)

 

0 Kudos
Message 9 of 9
(5,735 Views)