From: Ivar on
Hi all.

I wanna draw a segment of a circle (Just a single line, not a shape), I know
the start and finish angle. 0 Degree is at 3 oclock, 90 Degree is at 12
oclock.My start angle is =>0 and never > than 45Degree. The finish angle is
<= 90 and never < than 45 Degree. My problem is I want to do this using 4
point Bezier curve, I can do this if start angle = 0 and finish angle is 90,
the calcs are fairly easy (ish :-) but if my angles are <> 0 and 90 then I
can calculate points 1 and 4 (start and finish) but the two center points
just don't happen for me.
Can anyone provide the maths that calculate points 2 and 3 for this kind of
curve.
I've looked on the interweb and found info that quite frankly I don't
understand.
Can you help

Thanks

Ivar


From: senn on

"Ivar" <ivar.ekstromer000(a)ntlworld.com> skrev i en meddelelse
news:Rdb7k.18222$aE7.18077(a)newsfe16.ams2...
> Hi all.
>
> I wanna draw a segment of a circle (Just a single line, not a shape), I
> know the start and finish angle. 0 Degree is at 3 oclock, 90 Degree is at
> 12 oclock.My start angle is =>0 and never > than 45Degree. The finish
> angle is <= 90 and never < than 45 Degree. My problem is I want to do this
> using 4 point Bezier curve, I can do this if start angle = 0 and finish
> angle is 90, the calcs are fairly easy (ish :-) but if my angles are <> 0
> and 90 then I can calculate points 1 and 4 (start and finish) but the two
> center points just don't happen for me.
> Can anyone provide the maths that calculate points 2 and 3 for this kind
> of curve.
> I've looked on the interweb and found info that quite frankly I don't
> understand.
> Can you help
>
> Thanks
>
> Ivar
>

Using VB6 VB5 or lower ?.
With what are you drawing this Bezier
PolyBezier, or PolyBezierTo API's ?





From: Bill McCarthy on
Hi Ivar,

It sounds like you need to read some trigonometry stuff on Sin, Cos and Tan
and use of Radians .

"Ivar" <ivar.ekstromer000(a)ntlworld.com> wrote in message
news:Rdb7k.18222$aE7.18077(a)newsfe16.ams2...
> Hi all.
>
> I wanna draw a segment of a circle (Just a single line, not a shape), I
> know the start and finish angle. 0 Degree is at 3 oclock, 90 Degree is at
> 12 oclock.My start angle is =>0 and never > than 45Degree. The finish
> angle is <= 90 and never < than 45 Degree. My problem is I want to do this
> using 4 point Bezier curve, I can do this if start angle = 0 and finish
> angle is 90, the calcs are fairly easy (ish :-) but if my angles are <> 0
> and 90 then I can calculate points 1 and 4 (start and finish) but the two
> center points just don't happen for me.
> Can anyone provide the maths that calculate points 2 and 3 for this kind
> of curve.
> I've looked on the interweb and found info that quite frankly I don't
> understand.
> Can you help
>
> Thanks
>
> Ivar
>

From: Ivar on
Hi

I'm using VB6, The trig stuff on Sin, Cos, Tan and radians? Yep! Got all
that, I wrote in the first post that I can get the first and last points of
a 4 point Bezier curve, and I can find examples of drawing the curves when
all points are known. What I'm having troble with is finding points 2 and 3
of a 4 point Bezier curve when the curve is an arc of a perfect circle.
A simple example of a Bezier curve for a 0 to 90 degree arc would be (If X
and Y are the center point)
Point 1 = X, Y + Raduis
Point 2 = X + Raduis, Y + (Raduis * 0.551784) 'Bezier's Magic Number
Point 3 = X + (Radius * 0.551784), Y + Raduis
Point 4 = X, Y - Raduis

But to draw a smaller arc (Less than 90 Degrees) My maths goes slightly
wrong :-(

Can anyone provide an example of drawing an arc of a perfect circle where
start angle = 10 and end angle = 80, Using Rads Cos, Sin etc I can calc
Points 1 and 4 but points 2 and 3 are a bit of a mystery to me.

Thanks

Ivar


From: senn on

"Ivar" <ivar.ekstromer000(a)ntlworld.com> skrev i en meddelelse
news:Twm7k.64861$P83.39478(a)newsfe20.ams2...
> Hi
>
> I'm using VB6, The trig stuff on Sin, Cos, Tan and radians? Yep! Got all
> that, I wrote in the first post that I can get the first and last points
> of a 4 point Bezier curve, and I can find examples of drawing the curves
> when all points are known. What I'm having troble with is finding points 2
> and 3 of a 4 point Bezier curve when the curve is an arc of a perfect
> circle.
> A simple example of a Bezier curve for a 0 to 90 degree arc would be (If X
> and Y are the center point)
> Point 1 = X, Y + Raduis
> Point 2 = X + Raduis, Y + (Raduis * 0.551784) 'Bezier's Magic Number
> Point 3 = X + (Radius * 0.551784), Y + Raduis
> Point 4 = X, Y - Raduis
>
> But to draw a smaller arc (Less than 90 Degrees) My maths goes slightly
> wrong :-(
>
> Can anyone provide an example of drawing an arc of a perfect circle where
> start angle = 10 and end angle = 80, Using Rads Cos, Sin etc I can calc
> Points 1 and 4 but points 2 and 3 are a bit of a mystery to me.
>
> Thanks
>
> Ivar
>

OK, you answered the maine Question.
Here's what yoy need.:

'If your Angles are in degrees
'you must convert them to radians

Private Const PI = 3.1415926535897932


StartAng = StartAngle * PI / 180
EndAng = EndAng * PI / 180

Point2.X = Radius * Cos( StartAng + ( EndAng - StartAng ) / 3 )
Point2.Y = Radius * Sin( StartAng + ( EndAng - StartAng ) / 3 )

Point3.X = Radius * Cos( StartAng + ( EndAng - StartAng ) * 2 / 3 )
Point3.Y = Radius * Sin( StartAng + ( EndAng - StartAng ) * 2 / 3 )

/senn