A transformation of the affine 3-space.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Syntax
Examples
Copy
C#
public static XYZ TransformPoint(XYZ point, Transform transform)
{
double x = point.X;
double y = point.Y;
double z = point.Z;
//transform basis of the old coordinate system in the new coordinate // system
XYZ b0 = transform.get_Basis(0);
XYZ b1 = transform.get_Basis(1);
XYZ b2 = transform.get_Basis(2);
XYZ origin = transform.Origin;
//transform the origin of the old coordinate system in the new
//coordinate system
double xTemp = x * b0.X + y * b1.X + z * b2.X + origin.X;
double yTemp = x * b0.Y + y * b1.Y + z * b2.Y + origin.Y;
double zTemp = x * b0.Z + y * b1.Z + z * b2.Z + origin.Z;
return new XYZ(xTemp, yTemp, zTemp);
}
Copy
VB.NET
Public Shared Function TransformPoint(point As XYZ, transform As Transform) As XYZ
Dim x As Double = point.X
Dim y As Double = point.Y
Dim z As Double = point.Z
'transform basis of the old coordinate system in the new coordinate // system
Dim b0 As XYZ = transform.Basis(0)
Dim b1 As XYZ = transform.Basis(1)
Dim b2 As XYZ = transform.Basis(2)
Dim origin As XYZ = transform.Origin
'transform the origin of the old coordinate system in the new
'coordinate system
Dim xTemp As Double = x * b0.X + y * b1.X + z * b2.X + origin.X
Dim yTemp As Double = x * b0.Y + y * b1.Y + z * b2.Y + origin.Y
Dim zTemp As Double = x * b0.Z + y * b1.Z + z * b2.Z + origin.Z
Return New XYZ(xTemp, yTemp, zTemp)
End Function