The parameter of a circular arc is the angle measured from the OCS X-axis in radians. A positive parameter value defines the angle counterclockwise. A negative parameter value defines the angle clockwise. A zero value coincides with the OCS X-axis. A parameter can be changed in the range from the start angle to the end angle. The parameter determines the significant properties computed at its value (features). In examples, the pArc variable stores a pointer to the circular arc object.
The Start and End parameters of a circular arc define the available range of its variation. The start parameter equals the start angle and defines the start point. The end parameter equals the end angle and defines the end point. A value between the start and end parameters defines a point on the circular arc.
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 value through this argument or an error code as a result. For example:
double vStartParam;
OdResult eRes = pArc->getStartParam(vStartParam);
if(eRes == eOk)
odPrintConsoleString(L"\nStart parameter = %g", vStartParam);
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 value through this argument or an error code as a result. For example:
double vEndParam;
OdResult eRes = pArc->getEndParam(vEndParam);
if(eRes == eOk)
odPrintConsoleString(L"\nEnd parameter = %g", vEndParam);
The start and end point parameters of a circular arc are computed at a parameter in three-dimensional coordinates. The start point is computed at the start parameter. The end point is computed at the end parameter. When the circular arc is closed, the start point coincides with the end point. When the circular arc is unclosed, the start angle defines the start point and the end angle defines the end point.
To get the start point, use the getStartPoint() method which requires a reference to a variable of the OdGePoint3d type in which the start point instance must be saved as an argument and returns the computed three-dimensional point through this argument or an error code as a result. For example:
OdGePoint3d start;
OdResult eRes = pArc->getStartPoint(start);
if(eRes == 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 end point instance must be saved as an argument and returns the computed three-dimensional point through this argument or an error code as a result. For example:
OdGePoint3d end;
OdResult eRes = pArc->getEndPoint(end);
if(eRes == eOk)
odPrintConsoleString(L"\nEnd point = (%g,%g,%g)", end.x, end.y, end.z);
The first and second derivatives for a point of a circular arc are computed at a parameter as vectors in three-dimensional coordinates. Derivatives are changed along the circular arc curve. The parameter must be between the start and end values. When the parameter value is out of range, errors occur.
To get the first derivative, use the getFirstDeriv() method which requires a parameter value specifying a point on the circular arc 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. For example:
OdGeVector3d vecFirst;
OdResult eRes = pArc->getFirstDeriv((vEndParam + vStartParam)/2, 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 a point on the circular arc 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. For example:
OdGeVector3d vecSecond;
OdResult eRes = pArc->getSecondDeriv((vEndParam + vStartParam)/2, vecSecond);
if(eRes == eOk)
odPrintConsoleString(L"\nSecond derivative vector = (%g,%g,%g)", vecSecond.x, vecSecond.y, vecSecond.z);
The distance along a circular arc can be computed from the start point to a point at a parameter in drawing units. The circular arc object allows calculating the distance at a parameter and the parameter at a distance.
To get the distance using a parameter, use the getDistAtParam() method which requires a parameter value specifying a point on the circular arc 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. The parameter must be between the start and end values, otherwise errors occur. For example:
double vDistance;
OdResult eRes = pArc->getDistAtParam((vEndParam + vStartParam)/2, vDistance);
if(eRes == eOk)
odPrintConsoleString(L"\nDistance = %g", vDistance);
To compute the arc length, use the end parameter value. For example:
double vArcLength;
OdResult eRes = pArc->getDistAtParam(vEndParam, vArcLength);
if(eRes == eOk)
odPrintConsoleString(L"\nArc length = %g", vArcLength);
To get the parameter using a distance, use the getParamAtDist() method which requires a positive double value specifying the displacement along the circular arc 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 value 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, otherwise errors occur. The returned parameter is measured from the OCS X-axis (not the start). For example:
double vParam;
OdResult eRes = pArc->getParamAtDist(vArcLength/8, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nParameter = %g", vParam);
The point on a circular arc can be computed at a parameter in three-dimensional coordinates. The circular arc object allows calculating the point at parameter and the parameter at point.
To get the point using a parameter, use the getPointAtParam() method which requires a parameter value specifying the point on the circular arc 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 the parameter value is out of the range, errors occur. For example:
OdGePoint3d middle;
OdResult eRes = pArc->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 a point instance of the OdGePoint3d type as the first argument, 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 circular arc, errors occur. For example:
double vParam;
OdResult eRes = pArc->getParamAtPoint(middle, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nParameter = %g", vParam);
The area is calculated of a closed figure formed by the circular arc and a line passed from end to start point. The circular arc object approximates the arc curve and converts it to a 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 = pArc->getArea(vArea);
if(eRes == eOk)
odPrintConsoleString(L"\nArc Area = %g", vArea);
Note: Other methods inherited from the OdDbCurve class are not overridden in the OdDbArc class.
Specific Circular Arc Properties
Computed Elliptical Arc Properties
Example of Working with the Circular Arc
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|