Refer to the
description
The matrix defines the orientation of the plane in which the conic lies,
in the same manner as the matrix for an arc. The X axis of the matrix
determines the orientation of angle zero.
A point on the conic (in the XY plane) is given by
For ellipse:
X = k1 cos (t)
Y = k2 sin (t)
For parabola:
X = t2 / k1
Y = t
For hyperbola:
X = k1 / cos (t)
Y = k2 sin (t) / cos (t)
where t is the parameter value.
NOTE that for an ellipse, the parameter values are NOT angles.
For a given parameter value, t, the angle (in radians) is the inverse
tangent (arctan) of Y/X. For angles between 0 and pi/2 the following
equation can be used to determine ellipse parameter values:
t = arctan( (k1 / k2) tan(angle) )
This is a general function to compute the parameter when the angles are between
0 and 2pi range.
static void ConvertAngleToParamterForEllipse( double k1, //<I>
double k2, //<I>
double angle, //<I>
double tParameter //<O>paramter of angle)
{
double xx = k2 cos (angleDEGRA);
double yy = k1 sin (angleDEGRA);
if( fabs(yy) > 1.0e-10 )
{
if( fabs(xx) > 1.0e-10)
{
tParameter = atan(yy/xx);
if( xx > 0.0 && yy < 0.0)
tParameter +=TWOPI;
if( xx < 0.0 && yy < 0.0)
tParameter += PI;
if( xx < 0.0 && yy > 0.0)
tParameter += PI;
}
else
{
tParameter = PI/2.0;
if(yy < 0.0)
tParameter = 3.0PI/2.0;
}
}
else
{
tParameter = 0.0;
if(xx < 0)
tParameter = PI;
}
}