Rose curve


Polar equation of the form R = a Cos nƟ and R = a Sin nƟ are called petal Rose curves. The variable a determines the length of the petals. n determines the number of petals. If n is odd there are n petals. If n is even there are 2n petals.


The template for drawing the polar equations for Cos and Sin only varies on one line (plus obtaining the input from the form). The Sin version is shown here.

Sub sin_petal()
'R = B * Sin(C * A) + D
Call init_polar
Dim B As Double, C As Double, D As Double
B = frm_polar.txt_b1.Value
C = frm_polar.txt_c1.Value
D = frm_polar.txt_d1.Value

Dim R As Double, A As Integer
Dim X As Double, Y As Double
Dim A_rad As Double
Dim i As Integer, numpts As Integer
Dim plineobj As AcadLWPolyline
Dim pt() As Double
numpts = (Amax - Amin) / A_inc 'num of lines
numpts = numpts + 1
ReDim pt(1 To numpts * 2)

For i = 1 To numpts
A = Amin + ((i - 1) * A_inc)
A_rad = deg2rad(A)

'this is the function
R = B * Sin(C * A_rad) + D

X = R * Cos(A_rad)
Y = R * Sin(A_rad)
pt(i * 2 - 1) = X: pt(i * 2) = Y
Next i

Set plineobj = acadDoc.ModelSpace.AddLightWeightPolyline(pt)
strLabel = "R= " & B & "* Sin " & C & "A + " & D
Call label_graph
End Sub

Public Const pi As Double = 3.14159265359

Function deg2rad(deg As Integer) As Double
deg2rad = deg * pi / 180
End Function





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s