The parameter of the elliptical figure (ellipse or arc) is the angle measured from the major axis in radians as if the elliptical figure was a circular figure (circle or arc) and had a radius equal to the length of major axis. A positive parameter value defines the angle counterclockwise. A negative parameter value defines the angle clockwise. A parameter can be changed in the range 0 to 2PI for a closed elliptical figure or from the start value to the end value for an unclosed elliptical figure (arc). The parameter determines the significant properties computed at its value (features). In examples, the pEllipse variable stores a pointer to the ellipse object.
The start and end parameters are editable properties that define the range of variation. The start parameter defines the start point; the end defines the end point. A value between the start and end parameters defines a point on the elliptical figure (ellipse or arc). When the elliptical figure is closed (ellipse), the start parameter is zero, the end parameter is 2PI, and the start point coincides with the end point. When the elliptical figure is unclosed (arc), the setStartParam() method sets the start value, the setEndParam() method sets the end value, and the start point differs from the end point. For more details, see topic Specific Elliptical Arc Properties.
To get the start and end parameters, use the getStartParam() and getEndParam() methods which require a reference to a variable of the Double type in which the parameter value must be saved as an argument and return parameter value through this argument. For example:
double vStartParam, vEndParam;
if(pEllipse->getStartParam(vStartParam) == eOk)
odPrintConsoleString(L"\nStart parameter = %g", vStartParam);
if(pEllipse->getEndParam(vEndParam) == eOk)
odPrintConsoleString(L"\nEnd parameter = %g", vEndParam);
The first and second derivatives define the first and second derivatives for the point of the elliptical figure (ellipse or arc) computed at a parameter as vectors in three-dimensional coordinates. Derivatives are changed along the elliptical curve and are calculated in the range 0 to 2PI, independent of the start and end value.
To get the first derivative, use the getFirstDeriv() method which requires a parameter value specifying the point on the elliptical curve as the first argument of the Double type, requires a reference to a variable of the OdGeVector3d type in which the first derivative vector instance must be saved as the second argument, and returns the computed three-dimensional vector through the second argument or an error code as a result. When a parameter is more than 2PI, this method converts it to the range 0 to 2PI. For example:
OdGeVector3d vecFirst;
OdResult eRes = pEllipse->getFirstDeriv(vStartParam, vecFirst);
if(eRes == eOk)
odPrintConsoleString(L"\nFirst derivative vector = (%g,%g,%g)", vecFirst.x, vecFirst.y, vecFirst.z);
To get the second derivative, use the getSecondDeriv() method which requires a parameter value specifying the point on the elliptical curve as the first argument of the Double type, requires a reference to a variable of the OdGeVector3d type in which the second derivative vector instance must be saved as the second argument, and returns the computed three-dimensional vector through the second argument or an error code as a result. When a parameter is more than 2PI, this method converts it to the range 0 to 2PI. For example:
OdGeVector3d vecSecond;
OdResult eRes = pEllipse->getSecondDeriv(vStartParam, vecSecond);
if(eRes == eOk)
odPrintConsoleString(L"\nSecond derivative vector = (%g,%g,%g)", vecSecond.x, vecSecond.y, vecSecond.z);
The distance and parameter define the distance along the elliptical curve from the start point to the point computed at a parameter in drawing units. The ellipse object allows calculating the distance at a parameter and the parameter at a distance. The parameter must be between the start and end values.
To get the distance using a parameter, use the getDistAtParam() method which requires a parameter value specifying the point on the elliptical arc or ellipse as the first argument of the Double type, requires a reference to a variable of the Double type in which the distance value must be saved as the second argument, and returns the distance through the second argument or an error code as a result. When the parameter value is more than the end value, this method returns the distance value corresponding to the end parameter. When the parameter value is less than the start value, this method returns zero. When the parameter value is negative, this method returns zero.
To compute the elliptical arc length, use the end parameter value. For example:
double vArcLength;
OdResult eRes = pEllipse->getDistAtParam(vEndParam, vArcLength);
if(eRes == eOk)
odPrintConsoleString(L"\nArc length = %g", vArcLength);
To compute the ellipse perimeter, use the Oda2PI value. For example:
double vPerimeter;
OdResult eRes = pEllipse->getDistAtParam(Oda2PI, vPerimeter);
if(eRes == eOk)
odPrintConsoleString(L"\nPerimeter = %g", vPerimeter);
To get the parameter using a distance, use the getParamAtDist() method which requires a distance value specifying the displacement along the elliptical arc or ellipse from the start point as the first argument of the Double type, requires a reference to a variable of the Double type in which the parameter value must be saved as the second argument, and returns the parameter corresponding to the distance through the second argument or an error code as a result. The distance must be between zero and the arc length or ellipse perimeter, otherwise errors occur. The returned parameter is measured from the major axis (not from the start of an arc). For example:
double vParam;
OdResult eRes = pEllipse->getParamAtDist(vPerimeter/8, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nParameter(1/8) = %g", vParam);
The property defines the point on the elliptical curve computed at a parameter in three-dimensional coordinates. The ellipse object allows for calculating the point at a parameter and the parameter at a point.
To get the point using a parameter, use the getPointAtParam() method which requires a parameter value specifying the point on the elliptical arc or ellipse as the first argument of the Double type, requires a reference to a variable of the OdGePoint3d type in which the point instance must be saved as the second argument, and returns the computed three-dimensional point through the second argument or an error code as a result. When a parameter is more than 2PI, this method converts it to the range 0 to 2PI. The method calculates the point along the whole ellipse independently from the start and end value. For example:
OdGePoint3d middle;
OdResult eRes = pEllipse->getPointAtParam((vEndParam + vStartParam)/2, middle);
if(eRes == eOk)
odPrintConsoleString(L"\nMiddle point = (%g,%g,%g)", middle.x, middle.y, middle.z);
To get the parameter using a point, use the getParamAtPoint() method which requires the point instance of the OdGePoint3d type as the first argument, requires a reference to a variable of the Double type in which the parameter value must be saved as the second argument, and returns the parameter corresponding to the point through the second argument or an error code as a result. When the point is not placed on the elliptical curve, errors occur. For example:
double vParam;
OdResult eRes = pEllipse->getParamAtPoint(middle, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nParameter = %g", vParam);
When an elliptical figure is closed, the property defines the area of the ellipse. When an elliptical figure is unclosed, the property defines the area of the figure obtained from the elliptical arc and line passed from the end point to the start point. The ellipse object approximates the arc curve and converts it to the polyline whose area is calculated.
To get the area, use the getArea() method which requires a reference to a variable of the Double type in which the area value must be saved as an argument and returns the area value through this argument or an error code as a result. For example:
double vArea;
OdResult eRes = pEllipse->getArea(vArea);
if(eRes == eOk)
odPrintConsoleString(L"\nArea = %g", vArea);
Note: Other methods inherited from the OdDbCurve class are not overridden in the OdDbEllipse class.
Specific Elliptical Arc Properties
Computed Circular Arc Properties
Example of Working with the Ellipse Object
Example of Working with the Elliptical Arc
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|