IsAlmostEqualTo Method (XYZ, Double)

Determines whether 2 vectors are the same within the given tolerance.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: (


public bool IsAlmostEqualTo(
	XYZ source,
	double tolerance
Visual Basic
Public Function IsAlmostEqualTo ( _
	source As XYZ, _
	tolerance As Double _
) As Boolean
Visual C++
bool IsAlmostEqualTo(
	XYZ^ source, 
	double tolerance


Type: Autodesk.Revit.DB XYZ
The vector to compare with this vector.
Type: System Double
The tolerance for equality check.

Return Value

True if the vectors are the same; otherwise, false.


This routine uses an input tolerance to compare two vectors to see if they are almost equivalent. Because it is comparing two vectors the tolerance value is not in length units but instead represents the variation in direction between the vectors. For very small tolerance values it should also be possible to compare two points with this method. To compute the distance between two points for a comparison with a larger allowable difference, use DistanceTo(XYZ) .


Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException Thrown when source is a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions ArgumentException Thrown when tolerance is less than 0.

See Also