Draw Arc of Circle Powerpoint
Draw an Arc
Hi all.
I wanna draw a segment of a circle (Just a single line, not a shape), I know
the outset and stop bending. 0 Degree is at 3 oclock, 90 Degree is at 12
oclock.My kickoff 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 bending = 0 and end bending is ninety,
the calcs are fairly like shooting fish in a barrel (ish :-) but if my angles are <> 0 and xc then I
tin calculate points 1 and four (start and finish) but the ii center points
just don't happen for me.
Can anyone provide the maths that summate points two and 3 for this kind of
curve.
I've looked on the interweb and found info that quite frankly I don't
empathize.
Can you aid
Thanks
Ivar
Describe an Arc
Quote:
> Howdy all.
> I wanna describe a segment of a circle (Just a single line, not a shape), I
> know the start and end angle. 0 Degree is at three oclock, ninety Degree is at
> 12 oclock.My kickoff angle is =>0 and never > than 45Degree. The finish
> angle is <= 90 and never < than 45 Degree. My problem is I desire to do this
> using 4 point Bezier curve, I tin do this if start bending = 0 and terminate
> angle is 90, the calcs are fairly easy (ish :-) simply if my angles are <> 0
> and 90 and so I can calculate points 1 and four (start and finish) simply the two
> middle points only 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 institute info that quite bluntly I don't
> sympathise.
> Tin you assist
> Thanks
Using VB6 VB5 or lower ?.
With what are y'all drawing this Bezier
PolyBezier, or PolyBezierTo API's ?
Draw an Arc
Hello Ivar,
It sounds similar you need to read some trigonometry stuff on Sin, Cos and Tan
and use of Radians .
Quote:
> Hi all.
> I wanna draw a segment of a circle (Simply a single line, not a shape), I
> know the beginning and finish angle. 0 Degree is at three oclock, 90 Caste is at
> 12 oclock.My starting time angle is =>0 and never > than 45Degree. The finish
> bending is <= 90 and never < than 45 Degree. My trouble is I want to do this
> using 4 point Bezier curve, I can do this if start angle = 0 and finish
> bending is 90, the calcs are adequately like shooting fish in a barrel (ish :-) but if my angles are <> 0
> and 90 then I tin can calculate points 1 and 4 (starting time and stop) simply the two
> center points just don't happen for me.
> Can anyone provide the maths that calculate points ii and 3 for this kind
> of bend.
> I've looked on the interweb and constitute info that quite frankly I don't
> understand.
> Can yous aid
> Thanks
Draw an Arc
Howdy
I'm using VB6, The trig stuff on Sin, Cos, Tan and radians? Yeah! Got all
that, I wrote in the first postal service that I can get the first and last points of
a 4 point Bezier bend, 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 four point Bezier bend when the curve is an arc of a perfect circumvolve.
A simple example of a Bezier curve for a 0 to xc degree arc would be (If X
and Y are the eye indicate)
Point 1 = X, Y + Raduis
Indicate two = X + Raduis, Y + (Raduis * 0.551784) 'Bezier's Magic Number
Bespeak 3 = Ten + (Radius * 0.551784), Y + Raduis
Point 4 = X, Y - Raduis
Only to draw a smaller arc (Less than 90 Degrees) My maths goes slightly
wrong :-(
Tin can anyone provide an instance of drawing an arc of a perfect circle where
start angle = 10 and cease angle = 80, Using Rads Cos, Sin etc I tin can calc
Points 1 and four only points two and three are a bit of a mystery to me.
Thanks
Ivar
Draw an Arc
Quote:
> How-do-you-do
> I'one thousand 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 kickoff 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 three of a 4 point Bezier curve when the bend is an arc of a perfect
> circle.
> A simple example of a Bezier curve for a 0 to ninety degree arc would be (If 10
> and Y are the center point)
> Point 1 = 10, Y + Raduis
> Point 2 = X + Raduis, Y + (Raduis * 0.551784) 'Bezier'southward Magic Number
> Bespeak 3 = 10 + (Radius * 0.551784), Y + Raduis
> Point 4 = X, Y - Raduis
> Just to draw a smaller arc (Less than 90 Degrees) My maths goes slightly
> wrong :-(
> Can anyone provide an example of cartoon 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 just points 2 and 3 are a chip of a mystery to me.
> Cheers
OK, you answered the maine Question.
Here's what yoy need.:
'If your Angles are in degrees
'yous must catechumen 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 / iii )
Point3.Y = Radius * Sin( StartAng + ( EndAng - StartAng ) * 2 / 3 )
/senn
Draw an Arc
Nobody here, including myself, has any doubt
that your problem was a clean math.
But, when posting here in a way that arises
doubt to what language you're working in,
you got to exist a little more understanding.
Why practice you think, you got almost no answers,
despite, a lot of VB6 experts from overseas been
watching here the all dark ?.
Think about it !.
Mostly, you're turning yourself down.
/senn
Draw an Arc
Hi Senn
Thanks for your input and then far, I tried your instance and lamentable to say it don't
work :-(
There is some code below to demo, what the lawmaking does
Draws a cerise circle
Draws the X and Y lines of the circle
Use your method of calculating the 4 points of a bazier curve where the
start angle = 0 and the finish bending = 90 and apply PolyBezier to depict a black
bend.
Employ My method of calculating the 4 points of a bazier bend where the start
bending = 0 and the cease angle = 90 and utilize PolyBezier to draw a Blueish bend.
You will meet that the blueish curve covers the ruby-red circle, but the black curve
is way off. But my method only works for a 0 to ninety degree bend.
What I'1000 looking for is the maths behind calculating the two center points
for the iv point Bazier curve to draw role of a perfect circle where statr
degrees is > 0 and end degrees is < ninety
Ivar
Put this code in a form
Option Explicit
Private Declare Role PolyBezier Lib "gdi32.dll" _
(ByVal hdc As Long, lppt As POINTAPI, _
ByVal cPoints As Long) As Long
Private Blazon POINTAPI
10 As Long
Y As Long
Stop Type
Private Const PI = 3.14159265358979
Individual Sub Form_Load()
Me.ScaleMode = vbPixels
Me.AutoRedraw = True
Dim X As Long, Y Equally Long
Dim StartAng Every bit Unmarried, EndAng As Unmarried
Dim Radius As Single
Dim ThePoints(iii) As POINTAPI
X = 100: Y = 100 'Centre of circle
Radius = 50 'Radius of circumvolve
StartAng = 10: EndAng = fourscore
StartAng = StartAng * PI / 180
EndAng = EndAng * PI / 180
Me.Line (X, Y - Radius)-(X, Y + Radius)
Me.Line (X - Radius, Y)-(Ten + Radius, Y)
Me.Circle (X, Y), Radius, vbRed
ThePoints(0).10 = X + (Radius * Cos(StartAng))
ThePoints(0).Y = Y - (Radius * Sin(StartAng))
ThePoints(1).X = X + (Radius * Cos(StartAng + (EndAng - StartAng) / iii))
ThePoints(1).Y = Y - (Radius * Sin(StartAng + (EndAng - StartAng) / 3))
ThePoints(ii).10 = Ten + (Radius * Cos(StartAng + (EndAng - StartAng) * 2 / iii))
ThePoints(2).Y = Y - (Radius * Sin(StartAng + (EndAng - StartAng) * ii / 3))
ThePoints(3).X = X + (Radius * Cos(EndAng))
ThePoints(three).Y = Y - (Radius * Sin(EndAng))
PolyBezier Me.hdc, ThePoints(0), 4
'My method of calcs for points 2 and iii
ThePoints(1).X = 10 + Radius
ThePoints(1).Y = Y - (Radius * 0.551784)
ThePoints(2).X = X + (Radius * 0.551784)
ThePoints(2).Y = Y - Radius
Me.ForeColor = vbBlue
PolyBezier Me.hdc, ThePoints(0), 4
End Sub
Draw an Arc
Oops, my bad
Supercede the line:
StartAng = 10: EndAng = eighty
with
StartAng = 0: EndAng = xc
This volition give the perfect quadrant using Bazier curve
Ivar
Quote:
> Hi Senn
> Thanks for your input and then far, I tried your instance and sorry to say it
> don't work :-(
> There is some code below to demo, what the code does
> Draws a red circle
> Draws the X and Y lines of the circumvolve
> Use your method of calculating the 4 points of a bazier curve where the
> start angle = 0 and the stop angle = 90 and use PolyBezier to draw a black
> bend.
> Utilise My method of calculating the 4 points of a bazier curve where the
> start bending = 0 and the stop angle = ninety and use PolyBezier to draw a Blueish
> curve.
> Yous will see that the blue curve covers the red circumvolve, but the blackness
> curve is way off. But my method only works for a 0 to 90 degree curve.
> What I'thousand looking for is the maths behind computing the ii center points
> for the iv indicate Bazier curve to depict part of a perfect circle where statr
> degrees is > 0 and end degrees is < 90
> Ivar
> Put this code in a form
> Option Explicit
> Private Declare Function PolyBezier Lib "gdi32.dll" _
> (ByVal hdc As Long, lppt Equally POINTAPI, _
> ByVal cPoints As Long) As Long
> Private Type POINTAPI
> X As Long
> Y Equally Long
> End Blazon
> Private Const PI = three.14159265358979
> Private Sub Form_Load()
> Me.ScaleMode = vbPixels
> Me.AutoRedraw = True
> Dim X As Long, Y Equally Long
> Dim StartAng Every bit Unmarried, EndAng Equally Unmarried
> Dim Radius As Single
> Dim ThePoints(3) Equally POINTAPI
> Ten = 100: Y = 100 'Center of circle
> Radius = 50 'Radius of circle
> StartAng = ten: EndAng = 80
> StartAng = StartAng * PI / 180
> EndAng = EndAng * PI / 180
> Me.Line (10, Y - Radius)-(Ten, Y + Radius)
> Me.Line (X - Radius, Y)-(X + Radius, Y)
> Me.Circle (Ten, Y), Radius, vbRed
> ThePoints(0).Ten = X + (Radius * Cos(StartAng))
> ThePoints(0).Y = Y - (Radius * Sin(StartAng))
> ThePoints(i).10 = X + (Radius * Cos(StartAng + (EndAng - StartAng) / iii))
> ThePoints(1).Y = Y - (Radius * Sin(StartAng + (EndAng - StartAng) / 3))
> ThePoints(ii).X = Ten + (Radius * Cos(StartAng + (EndAng - StartAng) * 2 /
> 3))
> ThePoints(2).Y = Y - (Radius * Sin(StartAng + (EndAng - StartAng) * 2 /
> 3))
> ThePoints(iii).X = X + (Radius * Cos(EndAng))
> ThePoints(three).Y = Y - (Radius * Sin(EndAng))
> PolyBezier Me.hdc, ThePoints(0), 4
> 'My method of calcs for points two and 3
> ThePoints(1).10 = X + Radius
> ThePoints(1).Y = Y - (Radius * 0.551784)
> ThePoints(2).X = X + (Radius * 0.551784)
> ThePoints(2).Y = Y - Radius
> Me.ForeColor = vbBlue
> PolyBezier Me.hdc, ThePoints(0), iv
> End Sub
Draw an Arc
Hullo Ivar,
The other equations I posted was meant to calculate the
points on the circle -non the control points.
Beneath here is what you need. Effort this
Y'all'll apparently se a modest difference when a
total quarter circle is drawn. I believe this originate
from the fact as follows; a circle that is unremarkably
drawn will lack roundness around midtways from
horizontal and vertical, every bit it is drawn of linepieces
of the longest lenght around there.
The circle drawn with the Bezier and the two
control points calculated every bit I did, will take a amend
roundness, as the control points pulls it in a favourable
management.
/senn
Option Explicit
Private Declare Function PolyBezier Lib "gdi32.dll" _
(ByVal hdc As Long, lppt As POINTAPI, _
ByVal cPoints As Long) Every bit Long
Individual Blazon POINTAPI
X As Long
Y As Long
Terminate Type
Individual Const PI = 3.14159265358979
Private Sub Form_Load()
Dim 10 Every bit Long, Y As Long
Dim StartAng Equally Unmarried, EndAng Equally Single
Dim Radius Every bit Single
Dim Dif As Single
Dim ThePoints(3) As POINTAPI
Me.ScaleMode = vbPixels
Me.AutoRedraw = Truthful
X = 400: Y = 400 'Center of circle
Radius = 200 'Radius of circle
StartAng = 20: EndAng = 70
StartAng = StartAng * PI / 180
EndAng = EndAng * PI / 180
Dif = Radius / Cos((EndAng - StartAng) / 3) - Radius
Me.Line (10, Y - Radius)-(X, Y + Radius)
Me.Line (X - Radius, Y)-(X + Radius, Y)
Me.Circle (Ten, Y), Radius, vbRed
ThePoints(0).Ten = X + (Radius * Cos(StartAng))
ThePoints(0).Y = Y - (Radius * Sin(StartAng))
ThePoints(1).X = X + ((Radius + Dif) * Cos(StartAng + (EndAng - StartAng) /
3))
ThePoints(1).Y = Y - ((Radius + Dif) * Sin(StartAng + (EndAng - StartAng) /
iii))
ThePoints(2).X = 10 + ((Radius + Dif) * Cos(StartAng + (EndAng - StartAng) *
2 / 3))
ThePoints(2).Y = Y - ((Radius + Dif) * Sin(StartAng + (EndAng - StartAng) *
ii / 3))
ThePoints(3).X = Ten + (Radius * Cos(EndAng))
ThePoints(iii).Y = Y - (Radius * Sin(EndAng))
PolyBezier Me.hdc, ThePoints(0), 4
'My method of calcs for points 2 and three
ThePoints(i).Ten = X + Radius
ThePoints(one).Y = Y - (Radius * 0.551784)
ThePoints(2).X = X + (Radius * 0.551784)
ThePoints(2).Y = Y - Radius
Me.ForeColor = vbBlue
'PolyBezier Me.hdc, ThePoints(0), 4
'Me.Refresh
End Sub
Draw an Arc
Quote:
> Hullo Ivar,
> The other equations I posted was meant to summate the
> points on the circle -not the control points.
> Below here is what yous need. Try this
> You'll patently se a small difference when a
> full quarter circle is drawn. I believe this originate
> from the fact as follows; a circle that is usually
> fatigued will lack roundness around midtways from
> horizontal and vertical, every bit it is drawn of linepieces
> of the longest lenght effectually there.
> The circumvolve drawn with the Bezier and the two
> command points calculated as I did, will have a meliorate
> roundness, equally the control points pulls it in a favourable
> direction.
Correction,
The longest line pieces seems to be around
the horizontal and vertical directions.
But I still think that the control points pulls the
curve in a favourable direction.
/senn
Draw an Arc
Hi Ivar,
Why don't y'all jsut use the Circumvolve method ? Due east.grand :
' calibration way twips
Dim Pi As Double
Pi = Atn(1) * 4
Me.Circle (2000, 2000), 1000, vbRed, Pi * 10 / 180, Pi * 80 / 180
Quote:
> Hi
> I'm using VB6, The trig stuff on Sin, Cos, Tan and radians? Yes! Got all
> that, I wrote in the first post that I can go the first and last points
> of a 4 point Bezier curve, and I tin discover examples of drawing the curves
> when all points are known. What I'k having troble with is finding points 2
> and 3 of a four point Bezier bend when the bend is an arc of a perfect
> circle.
> A unproblematic example of a Bezier curve for a 0 to 90 caste arc would exist (If X
> and Y are the middle point)
> Point 1 = Ten, Y + Raduis
> Point 2 = 10 + Raduis, Y + (Raduis * 0.551784) 'Bezier's Magic Number
> Point three = X + (Radius * 0.551784), Y + Raduis
> Point 4 = X, Y - Raduis
> Only to draw a smaller arc (Less than 90 Degrees) My maths goes slightly
> wrong :-(
> Tin anyone provide an instance of drawing an arc of a perfect circumvolve where
> start angle = 10 and end bending = 80, Using Rads Cos, Sin etc I can calc
> Points ane and 4 but points ii and 3 are a bit of a mystery to me.
> Cheers
Depict an Arc
Thank you Senn.
Subsequently adapting your example to my ain needs it works perfect.
Ivar
Draw an Arc
Quote:
> Thank you Senn.
> Afterward adapting your case to my own needs it works perfect.
Glad, it worked out for you !
Regards
/senn
Draw an Arc
Quote:
> Using VB6 VB5 or lower ?.
Given that that is what this newsgroup covers, you could assume that.
--
Regards,
Michael Cole
Draw an Arc
Quote:
>> Using VB6 VB5 or lower ?.
> Given that that is what this newsgroup covers, you could assume that.
No, this cannot be causeless.
At that place'due south been a huge bunch of .netFolks request
questions here.
Quote:
Looks like as you lot posted the same on the
other newsgroup:
having information technology fit into a preconceived opinion of yours.
First,
Giving VB6 Answers hither to users of other
languages would be of no proceeds to the user.
Secand,
Who's the GateKeeper *At present* !.
Source: http://computer-programming-forum.com/72-visual-basic-vb/9626db838ba5a705.htm
0 Response to "Draw Arc of Circle Powerpoint"
Postar um comentário