The parameter of an infinite line is the distance measured from the base point in drawing units. A positive parameter value defines the distance of the line direction. A negative parameter value defines the distance of the opposite line direction. A zero value defines the base point. A parameter can be changed in the range from negative infinity to positive infinity and determines the properties computed at its value (features). In examples, the pXLine variable stores a pointer to the Xline object.
The Distance property defines the distance along the infinite line from the start point to the point computed at the parameter in drawing units. The Xline object allows for calculating the distance at a parameter and calculating the parameter at a distance.
To get the distance using a parameter, use the getDistAtParam() method which requires a parameter value specifying the point on the infinite line 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 is negative, the method returns the distance computed at a positive parameter value. For example:
double vDistance;
OdResult eRes = pXLine->getDistAtParam(100.0, vDistance);
if(eRes == eOk)
odPrintConsoleString(L"\nDistance = %g", vDistance);
To get the parameter using distance, use the getParamAtDist() method which requires a distance value specifying the displacement along the infinite line 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 can have any value. For example:
double vParam;
OdResult eRes = pXLine->getParamAtDist(50.0, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nParameter = %g", vParam);
The Point property defines the point on the infinite line computed at a parameter in three-dimensional coordinates. The Xline object allows calculating the point at a parameter and calculating 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 infinite line 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. The parameter can have any value. For example:
OdGePoint3d point;
OdResult eRes = pXLine->getPointAtParam(10.0, point);
if(eRes == eOk)
odPrintConsoleString(L"\nPoint(10) = (%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. When the point is not placed on the infinite line, errors occur. For example:
double vParam;
OdResult eRes = pXLine->getParamAtPoint(point, vParam);
if(eRes == eOk)
odPrintConsoleString(L"\nParameter = %g", vParam);
The property defines the first and second derivatives of a point on the infinite line computed at a parameter as vectors in three-dimensional coordinates. Both derivatives are constant for any point of the infinite line. The infinite line object returns the derivatives for any parameter value.
To get the first derivative, use the getFirstDeriv() method which requires a parameter value specifying the point on the infinite line 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 = pXLine->getFirstDeriv(10.0, 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 infinite line 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 = pXLine->getSecondDeriv(10.0, vecSecond);
if(eRes == eOk)
odPrintConsoleString(L"\nSecond derivative vector = (%g,%g,%g)", vecSecond.x, vecSecond.y, vecSecond.z);
Note: The getStartParam(), getEndParam(), getStartPoint(), getEndPoint(), and getArea() methods are not applicable.
Note: Other methods inherited from the OdDbCurve class are not overridden in the OdDbXline class.
Specific Infinite Line Properties
Example of Working with the Xline Object
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|