﻿Vector3d Structure

# Vector3d Structure

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

Namespace:  Rhino.Geometry
Assembly:  RhinoCommon (in RhinoCommon.dll)
Syntax
```[SerializableAttribute]
public struct Vector3d : ISerializable, IEquatable<Vector3d>,
IComparable<Vector3d>, IComparable, IEpsilonComparable<Vector3d>```

The Vector3d type exposes the following members.

Constructors
NameDescription
Vector3d(Point3d)
Initializes a new instance of a vector, copying the three components from the three coordinates of a point.
Vector3d(Vector3d)
Initializes a new instance of a vector, copying the three components from a vector.
Vector3d(Vector3f)
Initializes a new instance of a vector, copying the three components from a single-precision vector.
Vector3d(Double, Double, Double)
Initializes a new instance of a vector, using its three components.
Top
Properties
NameDescription
IsUnitVector
Gets a value indicating whether or not this is a unit vector. A unit vector has length 1.
IsValid
Gets a value indicating whether this vector is valid. A valid vector must be formed of valid component values for x, y and z.
IsZero
Gets a value indicating whether the X, Y, and Z values are all equal to 0.0.
Item
Gets or sets a vector component at the given index.
Length
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.
MaximumCoordinate
Gets the largest (both positive and negative) component value in this vector.
MinimumCoordinate
Gets the smallest (both positive and negative) component value in this vector.
SquareLength
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.
Unset
Gets the value of the vector with each component set to RhinoMath.UnsetValue.
X
Gets or sets the X (first) component of the vector.
XAxis
Gets the value of the vector with components 1,0,0.
Y
Gets or sets the Y (second) component of the vector.
YAxis
Gets the value of the vector with components 0,1,0.
Z
Gets or sets the Z (third) component of the vector.
ZAxis
Gets the value of the vector with components 0,0,1.
Zero
Gets the value of the vector with components 0,0,0.
Top
Methods
NameDescription
Sums up two vectors.

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

CompareTo
Compares this Vector3d with another Vector3d.

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

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

This operation is not commutative.

Divide
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)

EpsilonEquals
Check that all values in other are within epsilon of the values in this
Equals(Object)
Determines whether the specified System.Object is a Vector3d and has the same values as the present vector.
(Overrides ValueTypeEquals(Object).)
Equals(Vector3d)
Determines whether the specified vector has the same value as the present vector.
GetHashCode
Computes the hash code for the current vector.
(Overrides ValueTypeGetHashCode.)
GetType (Inherited from Object.)
IsParallelTo(Vector3d)
Determines whether this vector is parallel to another vector, within one degree (within Pi / 180).
IsParallelTo(Vector3d, Double)
Determines whether this vector is parallel to another vector, within a provided tolerance.
IsPerpendicularTo(Vector3d)
Test to see whether this vector is perpendicular to within one degree of another one.
IsPerpendicularTo(Vector3d, Double)
Determines whether this vector is perpendicular to another vector, within a provided angle tolerance.
IsTiny
Uses RhinoMath.ZeroTolerance for IsTiny calculation.
IsTiny(Double)
Determines whether a vector is very short.
Multiply(Double, Vector3d)
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)

Multiply(Vector3d, Vector3d)
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)

Multiply(Vector3d, Double)
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)

Negate
Computes the reversed vector.

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

PerpendicularTo
Sets this vector to be perpendicular to another vector. Result is not unitized.
Reverse
Reverses this vector in place (reverses the direction).

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

Rotate
Rotates this vector around a given axis.
Subtract
Subtracts the second vector from the first one.

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

ToString
Returns the string representation of the current vector, in the form X,Y,Z.
(Overrides ValueTypeToString.)
Transform
Transforms the vector in place.

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

result = transformation*vector

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

An invalid or zero length vector cannot be unitized.

VectorAngle(Vector3d, Vector3d)
Compute the angle between two vectors.

This operation is commutative.

VectorAngle(Vector3d, Vector3d, Plane)
Computes the angle on a plane between two vectors.
VectorAngle(Vector3d, Vector3d, Vector3d)
Computes the angle of v1, v2 with a normal vector.
Top
Operators
NameDescription
Sums up two vectors.
Division
Divides a Vector3d by a number, having the effect of shrinking it.
Equality
Determines whether two vectors have the same value.
GreaterThan
Determines whether the first specified vector comes after (has superior sorting value than) the second vector.

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

GreaterThanOrEqual
Determines whether the first specified vector comes after (has superior sorting value than) the second vector, or it is equal to it.

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

(Vector3f to Vector3d)
Converts a single-precision (float) vector in a double-precision vector, without needing casting.
Inequality
Determines whether two vectors have different values.
LessThan
Determines whether the first specified vector comes before (has inferior sorting value than) the second vector.

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

LessThanOrEqual
Determines whether the first specified vector comes before (has inferior sorting value than) the second vector, or it is equal to it.

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

Multiply(Double, Vector3d)
Multiplies a vector by a number, having the effect of scaling it.
Multiply(Vector3d, Vector3d)
Multiplies two vectors together, returning the dot product (or inner product). This differs from the cross product.
Multiply(Vector3d, Double)
Multiplies a vector by a number, having the effect of scaling it.
Subtraction
Subtracts the second vector from the first one.
UnaryNegation
Computes the opposite vector.
Top
Version Information

#### Rhino for Mac

Supported in: 5.4

#### Rhino for Windows

Supported in: 6.5