By Fenton Webb

**Issue**

In elliptical arcs, group code 41 is described as the start parameter. However,

it doesn't seem to be associated with any of the known values for the arc. How

is this value derived?

**Solution**

An elliptical arc is a special version of an arc that follows the eccentricity

of the ellipse. One way to generate this type of arc is to find the parametric

normal of the starting point. To do so, you must specify a start angle that is

different from the actual start angle of the drawn arc. Group code 41 contains

this parametric angle expressed in radians.

**WHAT IS THE PARAMETRIC ANGLE?**

The parametric angle is generated from two concentric circles whose center is

the center of the ellipse and whose radii are the major and minor axes,

respectively. Every point of the ellipse lies either between or on these two

circles, and each elliptical point can be defined by a unique relation to them.

To discover this relationship, draw a line perpendicular to the major axis from

a point on the ellipse to the closest intersection with the circle described by

the major axis. Then do the same with the minor axis, starting from the

elliptical point and drawing perpendicular to the minor axis until the line

intersects the circle described by the minor axis. The two points of

intersection with the circles are colinear with the center of the ellipse. The

angle between the line containing these three points and the major axis is the

parametric angle specified by group code 41.

**HOW DO I CALCULATE IT FROM THE TRUE START ANGLE?**

To calculate the parametric angle from the true start angle, you must first find

the start point on the ellipse. This requires a simultaneous solution to the

equations for the line and the ellipse. In this example we assume that the major

axis of the ellipse lies on the x-axis with the origin at the center of the

ellipse. When this point is found, you can use its y-value and the minor axis to

solve the equation for the circle whose radius is the minor axis value and whose

center is the center of the ellipse. This will provide the x,y point on the

circle that dictates the parametric angle from the center of the ellipse.

The following is an AutoLisp example that demonstrates how to use trigonometric

functions to determine the parametric angle:

(defun c:e_arc( / a b slope ang q1 q2 q3 q4 qmode x y a2)

;assuming 0,0 is at the center of the ellipse, major axis in x direction

(setq ang (getangle '(0.0 0.0) "Choose start angle: "))

(setq a 1

b 0.5

slope (/ (sin ang) (cos ang))

q1 (/ pi 2.0)

q2 pi

q3 (/ (* 3 pi) 2.0)

q4 (* 2.0 pi)

qmode 'q1

);setq

(entmake (setq ent '((0 . "ELLIPSE")

(100 . "AcDbEntity")

(100 . "AcDbEllipse")

(10 0.0 0.0 0.0)

(11 1.0 0.0 0.0)

(40 . 0.5)

(62 . 1))

);setq

);entmake

;line equation is y = mx + 0, where m is the slope and 0 is the y-intercept

;ellipse equation is x^2/a^2 + y^2/b^2 = 1

;solve line and ellipse equations simultaneously to find x and y values

(setq y (/ (* a b slope) (sqrt (+ (* (* slope slope) (* a a)) (* b b))))

);setq

;minor axis circle equation is x^2 + y^2 = b^2

;solve circle equation where y = value calculated above

(setq x (sqrt (- (* b b) (* y y))))

;calculate start angle trigonometrically

(setq cos_a2 (/ x b)

sin_a2 (/ y b)

);setq

(if (/= cos_a2 0)

(setq a2 (atan (/ sin_a2 cos_a2)))

(setq a2 q1 qmode 'q1)

);if

;make a2 insensitive to quadrant

(cond ((and (> ang q1) (< ang q2))

(setq a2 (- pi (abs a2)) qmode 'q2

);setq

);statement 1

((and (> ang q2) (< ang q3))

(setq a2 (+ (abs a2) pi) qmode 'q3

);setq

);statement 2

((and (> ang q3) (< ang q4))

(setq a2 (abs (- (* 2 pi) (abs a2))) qmode 'q4

);setq

);statement 3

;special cases: angle = 0, 90, 180, 270 or 360 deg

((or (= ang 0) (= ang q1))

(setq qmode 'q1)

);statement 4

((= ang q2)

(setq a2 pi qmode 'q1)

);statement 5

((= ang q3)

(setq a2 (- (/ pi 2.0) pi) qmode 'q1)

);statement 6

(t nil);default statement

);cond

(command "zoom" "c" "0,0" 3)

(setq ent (append ent (list (cons 41 a2) (cons 42 (+ a2 (/ pi 2.0))))))

(setq ent (subst '(62 . 5) (assoc 62 ent) ent))

(entmake ent)

(setq a2

(cond ((= qmode 'q1) a2)

((= qmode 'q2) a2)

((= qmode 'q3) (- a2 q4))

((= qmode 'q4) (- a2 q4))

(t nil)

);cond

);setq

(princ "\nParametric angle in radians: ")

(princ a2)

(princ "\nParametric angle in degrees: ")

(princ (/ (* 180 a2) pi))

(princ)

);e_arc