Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Specific Elliptical Arc Properties

An elliptical arc is implemented by the ellipse object that uses the center, major axis, minor axis, radius ratio, normal, start angle, end angle, start parameter, and end parameter properties to define the geometry to be drawn. The ellipse object uses the main properties of the ellipse — center, axes, and radius ratio — and adds two angles and two parameters to transform a closed ellipse to an elliptical arc. In examples, the pEllipse variable stores the pointer to the ellipse object.

Center, Major Axis, Minor Axis, Radius Ratio

The elliptical arc defines the center, major axis, minor axis, and radius ratio similar to the ellipse object. For more details, see Specific Ellipse Properties.

Use the center(), setCenter(), normal(), majorAxis(), minorAxis(), radiusRatio(), setRadiusRatio(), and set() methods for working with ellipse parameters.

Angles and Parameters

Angles and parameters define a point on an elliptical arc. The angle is measured as an angle between the major axis vector and a vector passed from the center point to the point on an elliptical arc. The parameter is an angle measured as if the ellipse was a circle with a major radius. That is, the parameter is an angle between the major axis vector and a vector passed from the center point to the point on a circular arc which has a major radius and is plotted in the center. When the radius ratio equals 1.0, an elliptical arc becomes a circular arc and the parameter coincides with the angle. For points 0, PI/2, PI, 3*PI/2, and 2*PI radians, the parameter and angle are always congruent.

A positive angle or parameter is measured from the major axis counterclockwise. A negative angle or parameter is measured from the major axis clockwise and is automatically converted to its positive equivalent. If an angle value is more than 2PI, it is automatically converted to the range 0 to 2PI.

The start angle or start parameter defines the start point. The end angle or end parameter defines the end point.

Start and End Angles

The start and end angles are defined as the angle from which, and to which, the elliptical arc is drawn, both as Double values in radians. The start angle is zero by default. The end angle is 2PI by default.

To get the start angle, use the startAngle() method which does not have arguments and returns the start angle as a Double value. For example:


odPrintConsoleString(L"\nStart angle = %g", pEllipse->startAngle());

To set the start angle, use the setStartAngle() method which requires a Double value as an argument and does not return a value. For example:


pEllipse->setStartAngle(0.215);

To get the end angle, use the endAngle() method which does not have arguments and returns the end angle as a Double value. For example:


odPrintConsoleString(L"\nEnd angle = %g", pEllipse->endAngle());

To set the end angle, use the setEndAngle() method which requires a Double value as an argument and does not return a value. For example:


pEllipse->setEndAngle(2.451);

For example, converting angles:


pEllipse->setStartAngle(9.16);
pEllipse->setEndAngle(-2.15);

odPrintConsoleString(L"\nStart = %g, End = %d", pEllipse->startAngle(), pEllipse->endAngle());
odPrintConsoleString(L"\nStart = %g, End = %d", pEllipse->getStartParam(), pEllipse->getEndParam);

// Start angle = 2.87681, End angle = 4.13319
// Start parameter = 2.81481, End parameter = 4.23033

Start and End Parameters

Start and end parameters are defined as the parameters from which, and to which, the elliptical arc is drawn, both as Double values in radians. The start parameter is zero by default. The end parameter is 2PI by default.

To get the start parameter, use the getStartParam() method which requires a reference to a variable of the Double type in which the start parameter value must be saved as an argument and returns the start parameter through the argument or an error code as a result. For example:


double vStartParam;
if(pEllipse->getStartParam(vStartParam) == eOk)
  odPrintConsoleString(L"\nStart parameter = %g", vStartParam);

To set the start parameter, use the setStartParam() method which requires a Double value as an argument and does not return a value. For example:


pEllipse->setStartParam(0.215);

To get the end parameter, use the getEndParam() method which requires a reference to a variable of the Double type in which the end parameter value must be saved as an argument and returns the end parameter through the argument or an error code as a result. For example:


double vEndParam;
if(pEllipse->getEndParam(vEndParam) == eOk)
  odPrintConsoleString(L"\nEnd parameter = %g", vEndParam);

To set the end parameter, use the setEndParam() method which requires a Double value as an argument and does not return a value. For example:


pEllipse->setEndParam(2.451);

For example, converting parameters:


pEllipse->setStartParam(9.16);
pEllipse->setEndParam(-2.15);

odPrintConsoleString(L"\nStart = %g, End = %d", pEllipse->startAngle(), pEllipse->endAngle());
odPrintConsoleString(L"\nStart = %g, End = %d", pEllipse->getStartParam(), pEllipse->getEndParam);

// Start angle = 2.92799, End angle = 4.02704
// Start parameter = 2.87681, End parameter = 4.13319

Start and End Points

The start and end points define the start and end of the elliptical arc in three-dimensional coordinates. By default, the start point coincides with the end point and they coincide with the point of the major axis vector moved to the center of a closed ellipse. When the ellipse is unclosed, the start angle defines the start point and the end point defines the end point. Start and end points are read-only properties.

To get the start point, use the getStartPoint() method which requires a reference to a variable of the OdGePoint3d type in which the three-dimensional point instance must be saved as an argument and returns the start point through the argument or an error code as a result. For example:


OdGePoint3d start; 
if(pEllipse->getStartPoint(start) == eOk)
  odPrintConsoleString(L"\nStart point = (%g,%g,%g)", start.x, start.y, start.z);

To get the end point, use the getEndPoint() method which requires a reference to a variable of the OdGePoint3d type in which the three-dimensional point instance must be saved as an argument and returns the end point through the argument or an error code as a result. For example:


OdGePoint3d end; 
if(pEllipse->getEndPoint(end) == eOk)
  odPrintConsoleString(L"\nEnd point = (%g,%g,%g)", end.x, end.y, end.z);

Getting and Setting the Center, Major Axis, Normal, Radius Ratio, Start Angle and End Angle

To set the elliptical arc definition geometry, use the set() method which requires six arguments for an unclosed ellipse — three-dimensional point instance specifying the center as the first argument of the OdGePoint3d type, three-dimensional unit vector instance specifying the normal as the second argument of the OdGeVector3d type, three-dimensional vector instance specifying the major axis perpendicular to the normal as the third argument of the OdGeVector3d type, radius ratio in the range [1e-6 to 1.0] as the fourth argument of the Double type, start angle in the range [0 to 2PI] as the fifth argument of the Double type, end angle in the range [0 to 2PI] as the sixth argument of the Double type — and sets the specified properties of the ellipse object to obtain the elliptical arc. For example:


OdGePoint3d center(2.5, 3.1, 0.5);
OdGeVector3d major(6.4, 2.1, 0);
OdGeVector3d normal(0, 0, 1);
double ratio = 0.75;
double start = 0.245;
double end = 2.867;

pEllipse->set(center, normal, major, ratio, start, end);

//  Center = (2.5, 3.1, 0.5)
//  Normal = (0, 0, 1)
//  Major axis = (6.4, 2.1, 0)
//  Minor axis = (-1.575, 4.8, 0)
//  Major radius = 6.73573
//  Minor radius = 5.05179
//  Radius ratio = 0.75
//  Start angle = 0.245
//  End angle = 2.867
//  Start parameter = 0.321778
//  End parameter = 2.78229
//  Start point = (8.07342,6.61023,0.5)
//  End point = (-4.04511,2.82191,0.5)

To get the elliptical arc geometry, use the get() method which requires six arguments for an unclosed ellipse — a reference to a variable of the OdGePoint3d type in which the center point must be saved as the first argument, a reference to a variable of the OdGeVector3d type in which the normal must be saved as the second argument, a reference to a variable of the OdGeVector3d type in which the major axis vector must be saved as the third argument, a reference to a variable of the Double type in which the radius ratio value must be saved as the fourth argument, a reference to a variable of the Double type in which the start angle value must be saved as the fifth argument, a reference to a variable of the Double type in which the end angle value must be saved as the sixth argument — and sets the specified properties through its own arguments. For example:


OdGePoint3d center;
OdGeVector3d major, normal;
double ratio, start, end;

pEllipse->get(center, normal, major, ratio, start, end);

odPrintConsoleString(L"\nCenter = (%g,%g,%g)", center.x, center.y, center.z);
odPrintConsoleString(L"\nNormal = (%g,%g,%g)", normal.x, normal.y, normal.z);
odPrintConsoleString(L"\nMajor axis = (%g,%g,%g)", major.x, major.y, major.z);
odPrintConsoleString(L"\nRadius ratio = %g", ratio);
odPrintConsoleString(L"\nStart angle = %g", start);
odPrintConsoleString(L"\nEnd angle = %g", end);

See Also

Working with Ellipses

Specific Ellipse Properties

Specific Circular Arc Properties

Computed Ellipse and Elliptical Arc Properties

Example of Working with the Elliptical Arc

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.