The parameter of a circle 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 0 to 2PI. If a parameter is out of the range, the circle object converts it to the range 0 to 2PI. The parameter determines the significant properties computed at its value (features). In examples, the pCircle variable stores a pointer to the circle object.
The start and end parameters of a circle define the available range of variation. The start parameter always is zero and defines the start point. The end parameter always is 2PI and defines the end point. A value between the start and end parameters defines a point on the circle.
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 returns the parameter value through this argument or an error code as a result. For example:
double vStartParam, vEndParam;
if(pCircle->getStartParam(vStartParam) == eOk)
odPrintConsoleString(L"\nStart parameter = %g", vStartParam); // 0
if(pCircle->getEndParam(vEndParam) == eOk)
odPrintConsoleString(L"\nEnd parameter = %g", vEndParam); // 6.28319
The start and end points of a circle are computed at the parameter in three-dimensional coordinates. The start point coincides with the end point because the circle is closed.
To get the start and end points, use the getStartPoint() and getEndPoint() methods which require a reference to a variable of the OdGePoint3d type in which the start or 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 start, end;
if(pCircle->getStartPoint(start) == eOk)
odPrintConsoleString(L"\nStart point = (%g,%g,%g)", start.x, start.y, start.z);
if(pCircle->getEndPoint(end) == eOk)
odPrintConsoleString(L"\nEnd point = (%g,%g,%g)", end.x, end.y, end.z);
The first and second derivatives of the point on a circle are computed at the parameter as vectors in three-dimensional coordinates. Derivatives are changed along the circle curve.
To get the first derivative, use the getFirstDeriv() method which requires a parameter value specifying the point on the circle as the first argument of the Double type, 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 = pCircle->getFirstDeriv(OdaPI/4, 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 circle as the first argument of the Double type, 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 = pCircle->getSecondDeriv(OdaPI/4, vecSecond);
if(eRes == eOk)
odPrintConsoleString(L"\nSecond derivative vector = (%g,%g,%g)", vecSecond.x, vecSecond.y, vecSecond.z);
The distance along a circle curve from the start point to another point is computed at the parameter in drawing units. The circle object allows calculating the distance at a parameter and also the parameter at a distance.
To get the distance using a parameter, use the getDistAtParam() method which requires a parameter value for a point on the circle 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 summed circulation in the resulting distance. For example:
double vDistance;
OdResult eRes = pCircle->getDistAtParam(OdaPI2, vDistance);
if(eRes == eOk)
odPrintConsoleString(L"\nQuadrant-length = %g", vDistance);
To compute the circumference, use the Oda2PI value. For example:
double vCircumference;
if(pCircle->getDistAtParam(Oda2PI, vCircumference) == eOk)
odPrintConsoleString(L"\nCircumference = %g", vCircumference);
To get the parameter using a distance, use the getParamAtDist() method which requires a distance value for the displacement along the circle 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 that corresponds to the distance through the second argument or an error code as a result. For example:
double vParam;
OdResult eRes = pCircle->getParamAtDist(vCircumference/8, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nParameter(1/8) = %g", vParam);
The point on a circle is computed at a parameter in three-dimensional coordinates. The circle object allows calculating the point at a parameter and also the parameter at a point.
To get the point using a parameter, use the getPointAtParam() method which requires a parameter value for a point on the circle 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. For example:
OdGePoint3d point;
OdResult eRes = pCircle->getPointAtParam(OdaPI/4, point);
if(eRes == eOk)
odPrintConsoleString(L"\nOctant point = (%g,%g,%g)", point.x, point.y, point.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. For example:
double vParam;
OdResult eRes = pCircle->getParamAtPoint(point, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nOctant parameter = %g", vParam);
The area of a circle is calculated using the classic formula (PI*R*R). 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 = pCircle->getArea(vArea);
if(eRes == eOk)
odPrintConsoleString(L"\nCircle Area = %g", vArea); // PI*R*R
Note: Other methods inherited from the OdDbCurve class are not overridden in the OdDbCircle class.
Example of Working with the Circle Object
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|