Represents the three components of a vector in three-dimensional space, using double-precision floating point numbers.

Constructors

  • Returns Vector3d

  • Initializes a new instance of a vector, using its three components.

    Parameters

    • x: number

      The X (first) component.

    • y: number

      The Y (second) component.

    • z: number

      The Z (third) component.

    Returns Vector3d

  • Initializes a new instance of a vector, copying the three components from the three coordinates of a point.

    Parameters

    • point: Point3d

      The point to copy from.

    Returns Vector3d

  • Initializes a new instance of a vector, copying the three components from a vector.

    Parameters

    • vector: Vector3f

      A double-precision vector.

    Returns Vector3d

  • Returns Vector3d

Properties

X: number
Y: number
Z: number
unset: Vector3d

Gets the value of the vector with each component set to RhinoMath.UnsetValue.

xAxis: Vector3d

Gets the value of the vector with components 1,0,0.

yAxis: Vector3d

Gets the value of the vector with components 0,1,0.

zAxis: Vector3d

Gets the value of the vector with components 0,0,1.

zero: Vector3d

Gets the value of the vector with components 0,0,0.

Methods

  • Sums up two vectors.

    (Provided for languages that do not support operator overloading. You can use the + operator otherwise)

    Parameters

    Returns Vector3d

    A new vector that results from the component-wise addition of the two vectors.

  • Test whether three vectors describe an orthogonal axis system. All vectors must be mutually perpendicular this to be the case.

    Parameters

    Returns boolean

    True if all vectors are non-zero and mutually perpendicular.

  • Test whether three vectors describe an orthogonal, unit axis system. All vectors must be mutually perpendicular and have unit length for this to be the case.

    Parameters

    Returns boolean

    True if all vectors are non-zero and mutually perpendicular.

  • Test whether three vectors describe a right-handed, orthogonal, unit axis system. The vectors must be orthonormal and follow the right-hand ordering; index-finger=x, middle-finger=y, thumb=z.

    Parameters

    Returns boolean

    True if all vectors are non-zero and mutually perpendicular.

  • Compares this Vector3d with another Vector3d.

    Component evaluation priority is first X, then Y, then Z.

    Parameters

    Returns number

    0: if this is identical to other -1: if this.X < other.X -1: if this.X == other.X and this.Y < other.Y -1: if this.X == other.X and this.Y == other.Y and this.Z < other.Z +1: otherwise.

  • Returns Vector3d

  • Initializes a new instance of a vector, using its three components.

    Parameters

    • x: number

      The X (first) component.

    • y: number

      The Y (second) component.

    • z: number

      The Z (third) component.

    Returns Vector3d

  • Initializes a new instance of a vector, copying the three components from the three coordinates of a point.

    Parameters

    • point: Point3d

      The point to copy from.

    Returns Vector3d

  • Initializes a new instance of a vector, copying the three components from a vector.

    Parameters

    • vector: Vector3f

      A double-precision vector.

    Returns Vector3d

  • Returns Vector3d

  • Computes the cross product (or vector product, or exterior product) of two vectors.

    This operation is not commutative.

    Parameters

    Returns Vector3d

    A new vector that is perpendicular to both a and b, has Length == a.Length * b.Length * sin(theta) where theta is the angle between a and b. The resulting vector is oriented according to the right hand rule.

  • Find scalars x and y so that the component of v in the plane of a and b is xa + yb

    Parameters

    Returns [boolean, number, number]

    true if the decomposition is successful.

  • Divides a Vector3d by a number, having the effect of shrinking it.

    (Provided for languages that do not support operator overloading. You can use the / operator otherwise)

    Parameters

    • vector: Vector3d

      A vector.

    • t: number

      A number.

    Returns Vector3d

    A new vector that is component-wise divided by t.

  • This object as a JSON-compatible dict (rhino3dm only; inverse: Decode).

    Parameters

    Returns Record<string, any>

    A dict of numbers and strings: geometry and other objects are stored as their 3dm archive, base64 encoded, with the archive version.

  • Check that all values in other are within epsilon of the values in this

    Parameters

    Returns boolean

  • Determines whether the specified vector has the same value as the present vector.

    Parameters

    Returns boolean

    true if vector has the same coordinates as this; otherwise false.

  • Determines whether this vector is parallel to another vector, within one degree (within Pi / 180).

    Parameters

    Returns number

    Parallel indicator: +1 = both vectors are parallel 0 = vectors are not parallel, or at least one of the vectors is zero -1 = vectors are anti-parallel.

  • Determines whether this vector is parallel to another vector, within a provided tolerance.

    Parameters

    • vector3d: Vector3d
    • other: Vector3d

      Vector to use for comparison.

    • angleTolerance: number

      Angle tolerance (in radians).

    Returns number

    Parallel indicator: +1 = both vectors are parallel. 0 = vectors are not parallel or at least one of the vectors is zero. -1 = vectors are anti-parallel.

  • Test to see whether this vector is perpendicular to within one degree of another one.

    Parameters

    Returns boolean

    true if both vectors are perpendicular, false if otherwise.

  • Determines whether this vector is perpendicular to another vector, within a provided angle tolerance.

    Parameters

    • vector3d: Vector3d
    • other: Vector3d

      Vector to use for comparison.

    • angleTolerance: number

      Angle tolerance (in radians).

    Returns boolean

    true if vectors form Pi-radians (90-degree) angles with each other; otherwise false.

  • Determines whether a vector is very short.

    Parameters

    • vector3d: Vector3d
    • tolerance: number

      A nonzero value used as the coordinate zero tolerance. .

    Returns boolean

    (Math.Abs(X) <= tiny_tol) AND (Math.Abs(Y) <= tiny_tol) AND (Math.Abs(Z) <= tiny_tol).

  • Uses RhinoMath.ZeroTolerance for IsTiny calculation.

    Parameters

    Returns boolean

    true if vector is very small, otherwise false.

  • Gets a value indicating whether or not this is a unit vector. A unit vector has length 1.

    Parameters

    Returns boolean

  • Gets a value indicating whether this vector is valid. A valid vector must be formed of valid component values for x, y and z.

    Parameters

    Returns boolean

  • Gets a value indicating whether the X, Y, and Z values are all equal to 0.0.

    Parameters

    Returns boolean

  • Computes the length (or magnitude, or size) of this vector. This is an application of Pythagoras' theorem. If this vector is invalid, its length is considered 0.

    Parameters

    Returns number

  • Gets the largest (both positive and negative) component value in this vector, as an absolute value.

    Parameters

    Returns number

  • Gets the smallest (both positive and negative) component value in this vector.

    Parameters

    Returns number

  • Multiplies a vector by a number, having the effect of scaling it.

    (Provided for languages that do not support operator overloading. You can use the * operator otherwise)

    Parameters

    • vector: Vector3d

      A vector.

    • t: number

      A number.

    Returns Vector3d

    A new vector that is the original vector coordinate-wise multiplied by t.

  • Multiplies a vector by a number, having the effect of scaling it.

    (Provided for languages that do not support operator overloading. You can use the * operator otherwise)

    Parameters

    • t: number

      A number.

    • vector: Vector3d

      A vector.

    Returns Vector3d

    A new vector that is the original vector coordinate-wise multiplied by t.

  • Multiplies two vectors together, returning the dot product (or inner product). This differs from the cross product.

    (Provided for languages that do not support operator overloading. You can use the * operator otherwise)

    Parameters

    Returns number

    A value that results from the evaluation of v1.Xv2.X + v1.Yv2.Y + v1.Z*v2.Z. This value equals v1.Length * v2.Length * cos(alpha), where alpha is the angle between vectors.

  • Computes the reversed vector.

    (Provided for languages that do not support operator overloading. You can use the - unary operator otherwise)

    Similar to ReverseReverse(), but static for CLR compliance.

    Parameters

    Returns Vector3d

    A new vector where all components were multiplied by -1.

  • Sets this vector to be perpendicular to another vector. Result is not unitized.

    Parameters

    Returns boolean

    true on success, false if input vector is zero or invalid.

  • Set this vector to be perpendicular to a plane defined by 3 points.

    Parameters

    Returns boolean

  • Reverses this vector in place (reverses the direction).

    If this vector is Invalid, no changes will occur and false will be returned.

    Similar to NegateNegate, that is only provided for CLR language compliance.

    Parameters

    Returns boolean

    true on success or false if the vector is invalid.

  • Rotates this vector around a given axis.

    Parameters

    • vector3d: Vector3d
    • angleRadians: number

      Angle of rotation (in radians).

    • rotationAxis: Vector3d

      Axis of rotation.

    Returns boolean

    true on success, false on failure.

  • Computes the squared length (or magnitude, or size) of this vector. This is an application of Pythagoras' theorem. While the Length property checks for input validity, this property does not. You should check validity in advance, if this vector can be invalid.

    Parameters

    Returns number

  • Subtracts the second vector from the first one.

    (Provided for languages that do not support operator overloading. You can use the - operator otherwise)

    Parameters

    Returns Vector3d

    A new vector that results from the component-wise difference of vector1 - vector2.

  • Returns the string representation of the current vector, in the form X,Y,Z.

    Parameters

    Returns string

    A string with the current location of the point.

  • Transforms the vector in place.

    The transformation matrix acts on the left of the vector; i.e.,

    result = transformation*vector

    Parameters

    Returns void

  • Unitizes the vector in place. A unit vector has length 1 unit.

    An invalid or zero length vector cannot be unitized.

    Parameters

    Returns boolean

    true on success or false on failure.

  • Compute the angle between two vectors.

    This operation is commutative.

    Parameters

    Returns number

    If the input is valid, the angle (in radians) between a and b; RhinoMath.UnsetValue otherwise.

  • Computes the angle on a plane between two vectors.

    Parameters

    • a: Vector3d

      First vector.

    • b: Vector3d

      Second vector.

    • plane: Plane

      Two-dimensional plane on which to perform the angle measurement.

    Returns number

    On success, the angle (in radians) between a and b as projected onto the plane; RhinoMath.UnsetValue on failure.

  • Computes the angle of v1, v2 with a normal vector.

    Parameters

    Returns number

    On success, the angle (in radians) between a and b with respect of normal vector; RhinoMath.UnsetValue on failure.