DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="3.3.0.6316" />

 Vector

public class Vector : DesignScriptEntity
public double Length { get; }

Get the length of the vector otherwise known as the Euclidean norm.

public double X { get; }

Get the X value of a vector.

public double Y { get; }

Get the Y value of a vector.

public double Z { get; }

Get the Z value of a vector.

public static Vector ByCoordinates(double x = 0, double y = 0, double z = 0)

Form a Vector by 3 Euclidean coordinates

public static Vector ByCoordinates(double x = 0, double y = 0, double z = 0, bool normalized = false)

Form a Vector by 3 Euclidean coordinates and normalize the Vector

public static Vector ByTwoPoints(Point start, Point end)

Form a Vector by two end points. The result is a vector from the start to the end point.

public static Vector FromJson(string json)

Parse the incoming JSON string formatted with autodesk.math:vector3d-1.0.0 schema.

public static Vector XAxis()

Get the canonical X axis Vector (1,0,0)

public static Vector YAxis()

Get the canonical Y axis Vector (0,1,0)

public static Vector ZAxis()

Get the canonical Z axis Vector (0,0,1)

public Vector Add(Vector vectorToAdd)

Add a vector

public double AngleAboutAxis(Vector otherVector, Vector rotationAxis)

Returns the angle between the two vectors in degrees from 0 to 360. It uses axis of rotation to determine the direction of the angle.

public double AngleBetween(Vector otherVector)

Returns the angle between the two Vectors, in the range [0, 180] degrees.

public double AngleBetween(Vector otherVector, Vector rotationAxis)

Returns the angle between the two Vectors, in the range [0, 360] degrees. It uses axis of rotation to determine the direction of the angle.

public double AngleWithVector(Vector otherVector)

Returns the angle between the two vectors in degrees from 0 to 180.

public Point AsPoint()

Get the Point with the same X, Y, and Z component

public Vector Cross(Vector cross)

Form the cross product of two vectors

public double Dot(Vector vec)

Form the dot product of two vectors

public bool IsAlmostEqualTo(Vector otherVector)

Determine whether two vectors are almost equal. A tolerance value of 1e-5 given to handle precision issues.

public bool IsParallel(Vector otherVector)

Determine whether two vectors are parallel.

public Vector Normalized()

Get the normalized version of a vector

public Vector Reverse()

Get the reverse of the vector. Essentially this negates the X, Y, and Z components of the Vector.

public Vector Rotate(Vector axis, double degrees = 0)

Rotates a Vector around an axis by a specified number of degrees

public Vector Rotate(Plane plane, double degrees = 0)

Rotates a vector around the Plane origin and normal by a specified degree

public Vector Scale(double scale_factor = 1)

Scale Vector uniformly around the origin

public Vector Scale(double xScaleFactor = 1, double yScaleFactor = 1, double zScaleFactor = 1)

Scale Vector non-uniformly around the origin

public Vector Subtract(Vector vectorToSubtract)

Subtract a vector

public string ToJson()

Convert the Vector into a JSON object formatted with autodesk.math:vector3d-1.0.0 schema.

public Vector Transform(CoordinateSystem coordinateSystem)

Transform this Vector by input CoordinateSystem matrix.