Many methods accept a tolerance value as one of their parameters. This value is of the AcGeTol class and always has a default value, as defined in AcGeContext::gTol. Functions such as isClosed() and isPlanar() calculate whether the start points and endpoints are within the defined tolerance before returning a Boolean value. You can change the tolerance for one particular function call, or you can change the global tolerance value.
The AcGeTol class provides two functions for setting the tolerance for points and vectors:
void setEqualPoint(double val); void setEqualVector(double val);
The AcGeTol class also provides two functions for obtaining the tolerance for points and vectors:
double equalPoint() const; double equalVector() const;
The equalPoint and equalVector tolerance values are used as follows:
- Two points, p1 and p2, are equal if
(p1 - p2).length() <= equalPoint
- Two vectors, v1 and v2, are equal if
(v1 - v2).length() <= equalVector
- Two vectors, v1 and v2, are parallel if
(v1/v1.length() - v2/v2.length()).length() < equalVector OR (v1/v1.length() + v2/v2.length()).length() < equalVector
- Two vectors, v1 and v2, are perpendicular if
abs((v1.dotProduct(v2))/(v1.length()*v2.length())) <= equalVector
- Two lines or rays are parallel (perpendicular) if their directional vectors are parallel (perpendicular)
- Two lines are equal if the points at parameter 0 are equal and their directions are equal
Note: These rules mean that two lines are close to each other as point sets in the part of the modeling space of diameter diam only if the tolerance equalVector is set tighter than equalPoint/diam.