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

Constructors

  • Returns Vector3f

  • Constructs a new vector from 3 single precision numbers.

    Parameters

    • x: number

      X component of vector.

    • y: number

      Y component of vector.

    • z: number

      Z component of vector.

    Returns Vector3f

Properties

X: number
Y: number
Z: number
unset: Vector3f

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

xAxis: Vector3f

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

yAxis: Vector3f

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

zAxis: Vector3f

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

zero: Vector3f

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 Vector3f

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

  • Sums up a point and a vector, and returns a new point.

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

    Parameters

    Returns Point3f

    A new point that results from the addition of point and vector.

  • Compares this Vector3f with another Vector3f.

    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 Vector3f

  • Constructs a new vector from 3 single precision numbers.

    Parameters

    • x: number

      X component of vector.

    • y: number

      Y component of vector.

    • z: number

      Z component of vector.

    Returns Vector3f

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

    This operation is not commutative.

    Parameters

    Returns Vector3f

    A new vector that is perpendicular to both a and b, has Length == a.Length * b.Length and with a result that is oriented following the right hand rule.

  • Divides a Vector3f by a number, having the effect of shrinking it, t times.

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

    Parameters

    • vector: Vector3f

      A vector.

    • t: number

      A number.

    Returns Vector3f

    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 values as the present vector.

    Parameters

    Returns boolean

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

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

    Parameters

    Returns boolean

  • Returns an indication regarding the validity of this vector.

    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

  • 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: Vector3f

      A vector.

    • t: number

      A number.

    Returns Vector3f

    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: Vector3f

      A vector.

    Returns Vector3f

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

  • Multiplies two Vector3f together, returning the dot (internal) product of the two. This is not 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 coordinate-wise multiplication of point1 and point2.

  • Computes the reversed vector.

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

    This is similar to ReverseReverse(), but is static for CLR compliance, and with default name.

    Parameters

    Returns Vector3f

    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.

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

    If this vector contains RhinoMath.UnsetValue, the reverse will also be invalid 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

    • vector3f: Vector3f
    • angleRadians: number

      Angle of rotation (in radians).

    • rotationAxis: Vector3f

      Axis of rotation.

    Returns boolean

    true on success, false on failure.

  • Returns the square length of the vector. This property does not check for the validity of the inputs.

    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 Vector3f

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

  • Constructs the string representation of the current vector.

    Parameters

    Returns string

    The vector representation in the form X,Y,Z.

  • 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.