From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

draw arc to display angle between two lines

I have two lines which interesect at a point. The line coordinates and interesctionpoint is available. Now i need to draw an overlay arc between the lines to show which angle is measured. I used a IMAQ Overlay arc VI. I chose the Intersection point as midpoint for the bounding rectangle and i got was a small arc but not between the two lines.

I tried shifting the box to left and right manually but no luck. I actually want the arc to be betwwen the two lines depending on the intersection point.

Avialble infos: coordinates for Intersection point, Line coordinates for both lines (Line 1--->  Point 1, Point 2, Line 2--->Point 1, Point 2)

Anyone hv any better ideas?

Angle Arc Display.JPG

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 1 of 9
(3,771 Views)

I do not have the IMAQ VIs loaded on this machine (and I do not work with the vision VIs) but, as you stated, shifting the box will not help.

Check your angles on the top two terminals (start and end).  It looks like the values you are using are 110-120 (starting) to 180 (ending).

I would increase the ending angle to something closer to 250 or so.

If this does not help please post back...

 

0 Kudos
Message 2 of 9
(3,750 Views)

Hii Don_Philips

Thanks for the reply. I tried with different start and end angles. But that may give a desired output for only one of the cases.  But the problem is that there are 4 different cases depending on the orientation  the edge. See attachment. At the moment i give the ZERO as start angle and the calculated angle beween the lines as start angle.
1.PNG

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 9
(3,740 Views)

Hmm.  Sorry but I am having a difficult time understanding why only one output is satisfactory.  Could you post a picture showing an incorrect result with the starting/ ending angles provided to the acr function?

Just doing some quick math of the four different inputs I calculate the following:

Note -- these values are ideal for a circle.  Tweeking would be needed to account for the oval shaped arc resulting from a rectagular bounding rectangle

New Bitmap Image.png

0 Kudos
Message 4 of 9
(3,724 Views)

Oh OK... I think I get it now.

Begin with 0 (starting angle) and 90 (ending angle) and adjust depending on the orientation of the lines.

So before the Arc VI determine the orientation and adjust as follows: If coming from the top add 45, left add 135, bottom add 225, and right add 315.

 

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

The actual situation is like this. I do an edge detection of the two sides to get line coordinates. And for this edge detection i have 4 options: 1) Left to Right search direction 2) Right to left, 3)Top to Botom and 4) Bottom to Top. I use the line coordinates [(Line 1: Point 1, Point 2);( Line 2: Point 1, Point 2)]to find the intersection point and the angle between them using IMAQ Lines intersection VI. So depending on the search direction, the Line 1 and Line 2 may vary. i.e it is not always in the same order. So sometimes the angle becomes 135 degree instead of 45 degrees.
With these data is there any way to draw an arc in between the lines ( not outside like in 135 degrees)? I guess we need to consider the intersection point and the midpoint between Point 1 and Point 2 in both lines. But IMAQ Overlay arc seems to be not working since the start and end angles are not always the same.

I tried ur idea to use the angles for diffeent orientation/search direction, but could not get a reliable result.

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 9
(3,699 Views)

Well I know basically how to do it but I do not have the time to code it up.  Just takes some math.  If you have the coordinates for two lines (endpoint 1 -> crossing and endpoint 2 -> crossing) then you can calculate a midpoint line (midpoint -> crossing).  Convert this line to slope and then degrees.  For an ideal circle then your inputs for the arc would be degrees - 45 (start) and degrees + 45 (end).  Again, because you have a rectangular bounding box, the arc is mis-shapen so you may have to play with those numbers to find an ideal.

0 Kudos
Message 7 of 9
(3,683 Views)

Hi all,

I have a question about this.

I have 3 points P(Px,Py), M(Mx,My) and Q(Qx,Qy)

I want to draw it in picture.

I find one solution:

step1: get center point and r(it is easy)

step2: get the start angle, angle and direction.

Your

Boone

 

0 Kudos
Message 8 of 9
(3,467 Views)
0 Kudos
Message 9 of 9
(3,451 Views)