Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I make an arc with these points

Status
Not open for further replies.

ssv123

Programmer
Oct 7, 2003
6
US
Hi ,
I am having 3 points which on joining form a triangle with 3 lines, but I want to draw an arc joining the big side to make a semicircle instead of 2 sides for the triangle.
call moveto_w(wx11,wy11,wxy)
status = lineto_w(wx6,wy6)
call moveto_w(wx3,wy3,wxy)
status = lineto_w(wx11,wy11)

call moveto_w(wx12,wy12,wxy)
status = lineto_w(wx4,wy4)
call moveto_w(wx5,wy5,wxy)
status = lineto_w(wx12,wy12)

How can i make a semicircle with one diameter as the largest side???
 
Hi ssv123,
I assume you are still interested in the problem of semi-circle presented a while back.
Let the three points be denoted by points A, B, C.
Assuming that you do not know which side is the longest side, you'd have to calculate the length of each and determine which is the longest.
If you're not already familiar with the calculation, then:
Lab=SQRT((Xa-Xb)**2+(Ya-Yb)**2)
and similarly for Lbc and Lca.
Let's assume that AC is the longest side.
To pass a semi-circle through ABC, with AC being the diameter, angle ABC must be right-angled.
To verify if angle ABC is right-angled, you would calculate the vector dot-product of the vectors AB and BC, which can be summarized as follows.
Dot=(Xa-Xb)*(Xb-Xc)+(Ya-Yb)*(Yb-Yc)
If Dot .EQ. 0, then the lines AB and BC are orthogonal, hence angle ABC is a right angle.
The most important step will depend on the parameters of the sub-routine that draws an arc. Some sub-routines require the radius and the beginning and end-points. The radius will be half the length of AC. Some require three points in a particular direction (clockwise or anti-clockwise).
If you could use help coding the parameters to the sub-routine, please post the definitions of the parameters and we will be able to work it out.
Good luck and best regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top