
Arc Starting point
Here's the deal...
I have an arbitrary triangle points a0, a1, b
I can successfully obtain the radius and center of the circumscribed circle
that passes thru the three points.
It works this way:
The user clicks a0 and a1 (in either order) that establish the chord and
then clicks b to determine the radius.
I can easily draw the circle that passes thru the three points
I want to draw an arc from a0 thru b to a1
The problem is:
I can't reliably tell which is the start of the arc and which is the end of
the arc.
Since all VB circles are drawn CCW, this is required.
When you look at it on the screen you can easily say it starts at a0 or a1.
Mathematically, it is alluding me.
Thanks for any help,
Tom

Re: Arc Starting point
Let me see if I've got this right: you have a center point, a start point
and an end point for an arc. You also know the radius. You want to use the
Circle method so you need to turn the start and end _points_ into start and
end _angles_, yes?
Use atn(), the arc tangent function: angle = atn((yp  yc)/(xp  xc)) where
xp is the point's x and xc is the center's x, same for y.
Note that it only returns angles from PI/2 to PI/2, so you also have to
check whether the x and y coords of the point in question are greater or
larger than those of the center in order to work it all out...
Jim Deutch
73215.427@compuserve.com <73215.427@compuserve.com> wrote in message
<38e2811d@news.devx.com>...
>
>I can't reliably tell which is the start of the arc and which is the end of
>the arc.
>Since all VB circles are drawn CCW, this is required.
>When you look at it on the screen you can easily say it starts at a0 or a1.
>Mathematically, it is alluding me.
>

Re: Arc Starting point
Jim Deutch sez
> Let me see if I've got this right: you have a center point, a start point
> and an end point for an arc. You also know the radius. You want to use
the
> Circle method so you need to turn the start and end _points_ into start
and
> end _angles_, yes?
>
> Use atn(), the arc tangent function: angle = atn((yp  yc)/(xp  xc))
where
> xp is the point's x and xc is the center's x, same for y.
>
> Note that it only returns angles from PI/2 to PI/2, so you also have to
> check whether the x and y coords of the point in question are greater or
> larger than those of the center in order to work it all out...
Jim, thanks for the reply...
I had no problem determining the angles, it's determining which one is the
start and which is the end.
The whole triangle could have b pointing left, right, up, down or somewhere
in between.
I've bashed my head all night on this one and came up with a solution that
seems to be working...
Find the angle t of the chord a0, a1 using atn((a0.ya1.y)/a0.xa1.x)
Use the vector to normalize it in the range of 0 to 2Pi radians.
Transform b by a0 and (minus) angle t
c.y = (b.x  a0.x) * Sin(t) + (b.y a0.y) * Cos(t)
If c.y is positive then a1 is start of arc, if negative, a0 is start of arc.
(c.y = zero, there is no arc possible)
In essence, I'm translating the triangle so that a0 is at 0,0 and a1 is
lying on the x axis at some x > 0.
So if c.y > 0 a CCW arc will pass thru it starting at a1.
If c.y < 0 then it's below the x axis and a0 needs to be the start of my
arc.
I really don't need to transform all three points, I just need c.y, so it
saves on calculations.
It was a real brain buster (for my brain that is).
Tom
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Development Centers
 Android Development Center
 Cloud Development Project Center
 HTML5 Development Center
 Windows Mobile Development Center
