# Polar Coordinate Graphing

Polar Coordinates – P(R,Ɵ) – A point is defined by how far it is from the origin (R – Radius) and what angle (Ɵ – Theta) a line from the point to the origin make with the horizontal axis.

Rectangular Coordinates – P(X,Y) – A point is defined by how far it is from the horizontal (X) and vertical (Y) axes.

CARTESIAN LOOPS
LOOP NUMBER OF LINE SEGMENTS – CALC TWO POINTS and DRAW LINE EVERY TIME THRU LOOP
Point (X , Y)
‘Xmin, Xmax and X_inc are driving the loop
num_line_segments = (Xmax – Xmin) / X_inc
For i = 1 to num_line_segments
X1 = Xmin + (i – 1) * X_inc
X2 = Xmin + (i * X_inc)
Y1 = f(X1)
Y2 = f(X2)
Call line(X1, Y1, X2, Y2)
Next i

LOOP NUMBER OF POINTS – CALC AND ADD POINT TO ARRAY EVERY TIME THRU LOOP
num_line_segments = (Xmax – Xmin) / X_inc
numpts = num_Line_segments + 1
Redim pt ( 1 To numpts *2) ‘ an index location in the array for all X and Y values
For i = 1 to numpts
X = Xmin + (i – 1) * X_inc
Y = f(X)
pt(i * 2 – 1) = X
pt(i * 2) = Y
Next i

POLAR LOOPS
LOOP NUMBER OF LINE SEGMENTS – CALC TWO POINTS and DRAW LINE EVERY TIME THRU LOOP
Point (R , A)
R is Radius (distance), A is Angle in degrees – typ values might be 0 to 360 inc by 1
‘Amin, Amax and A_inc are driving the loop
num_line_segments = (Amax – Amin) / A_inc
For i = 1 to num_line_segments
A1 = Amin + (i – 1) * A_inc
A2 = Amin + (i * A_inc)
R1 = f(A1))
R2 = f(A2))
Call line_polar(R1, A1, R2, A2)
‘if the function allows, line_polar can do the degrees to radian conversion
Next

LOOP NUMBER OF POINTS – CALC AND ADD POINT TO ARRAY EVERY TIME THRU LOOP
num_line_segments = (Amax – Amin) / A_inc
numpts = num_Line_segments + 1
Redim pt ( 1 To numpts *2) ‘size the array for all X and Y values
For i = 1 to numpts
A = Amin + (i – 1) * A_inc