Vector3d
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>, ICloneable, IFormattable
The Vector3d type exposes the following members.
Constructors
Name
Description
Public Method
Vector3d(Point3d)
Initializes a new instance of a vector, copying the three components from the three coordinates of a point.
Public Method
Vector3d(Vector3d)
Initializes a new instance of a vector, copying the three components from a vector.
Public Method
Vector3d(Vector3f)
Initializes a new instance of a vector, copying the three components from a single-precision vector.
Public Method
Vector3d(Double, Double, Double)
Initializes a new instance of a vector, using its three components.
Properties
Name
Description
Public Property
IsUnitVector
Gets a value indicating whether or not this is a unit vector. A unit vector has length 1.
Public Property
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.
Public Property
IsZero
Gets a value indicating whether the X, Y, and Z values are all equal to 0.0.
Public Property
Item
Gets or sets a vector component at the given index.
Public Property
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.
Public Property
MaximumCoordinate
Gets the largest (both positive and negative) component value in this vector, as an absolute value.
Public Property
MinimumCoordinate
Gets the smallest (both positive and negative) component value in this vector.
Public Property
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.
Public Property
Static Member
Unset
Gets the value of the vector with each component set to RhinoMath.UnsetValue.
Public Property
X
Gets or sets the X (first) component of the vector.
Public Property
Static Member
XAxis
Gets the value of the vector with components 1,0,0.
Public Property
Y
Gets or sets the Y (second) component of the vector.
Public Property
Static Member
YAxis
Gets the value of the vector with components 0,1,0.
Public Property
Z
Gets or sets the Z (third) component of the vector.
Public Property
Static Member
ZAxis
Gets the value of the vector with components 0,0,1.
Public Property
Static Member
Zero
Gets the value of the vector with components 0,0,0.
Methods
Name
Description
Public Method
Static Member
Add
Sums up two vectors.
(Provided for languages that do not support operator overloading. You can use the + operator otherwise)
Public Method
Static Member
AreOrthogonal
Test whether three vectors describe an orthogonal axis system. All vectors must be mutually perpendicular this to be the case.
Public Method
Static Member
AreOrthonormal
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.
Public Method
Static Member
AreRighthanded
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.
Public Method
CompareTo
Compares this Vector3d with another Vector3d.
Component evaluation priority is first X, then Y, then Z.
Public Method
Static Member
CrossProduct
Computes the cross product (or vector product, or exterior product) of two vectors.
This operation is not commutative.
Public Method
Static Member
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)
Public Method
EpsilonEquals
Check that all values in other are within epsilon of the values in this
Public Method
Equals(Object)
Determines whether the specified System.Object is a Vector3d and has the same values as the present vector.
(Overrides ValueType.Equals(Object).)
Public Method
Equals(Vector3d)
Determines whether the specified vector has the same value as the present vector.
Public Method
GetHashCode
Computes the hash code for the current vector.
(Overrides ValueType.GetHashCode..)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
Code Example
IsParallelTo(Vector3d)
Determines whether this vector is parallel to another vector, within one degree (within Pi / 180).
Public Method
IsParallelTo(Vector3d, Double)
Determines whether this vector is parallel to another vector, within a provided tolerance.
Public Method
IsPerpendicularTo(Vector3d)
Test to see whether this vector is perpendicular to within one degree of another one.
Public Method
IsPerpendicularTo(Vector3d, Double)
Determines whether this vector is perpendicular to another vector, within a provided angle tolerance.
Public Method
IsTiny.
Uses RhinoMath.ZeroTolerance for IsTiny calculation.
Public Method
Code Example
IsTiny(Double)
Determines whether a vector is very short.
Public Method
Static Member
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)
Public Method
Static Member
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)
Public Method
Static Member
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)
Public Method
Static Member
Negate
Computes the reversed vector.
(Provided for languages that do not support operator overloading. You can use the - unary operator otherwise)
Public Method
PerpendicularTo(Vector3d)
Sets this vector to be perpendicular to another vector. Result is not unitized.
Public Method
PerpendicularTo(Point3d, Point3d, Point3d)
Set this vector to be perpendicular to a plane defined by 3 points.
Public Method
Reverse
Reverses this vector in place (reverses the direction).
If this vector is Invalid, no changes will occur and false will be returned.
Public Method
Rotate
Rotates this vector around a given axis.
Public Method
Static Member
Subtract
Subtracts the second vector from the first one.
(Provided for languages that do not support operator overloading. You can use the - operator otherwise)
Public Method
ToString.
Returns the string representation of the current vector, in the form X,Y,Z.
(Overrides ValueType.ToString..)
Public Method
ToString(String, IFormatProvider)
Formats the value of the current instance using the specified format.
Public Method
Transform
Transforms the vector in place.
The transformation matrix acts on the left of the vector; i.e.,
result = transformation*vector
Public Method
Unitize
Unitizes the vector in place. A unit vector has length 1 unit.
An invalid or zero length vector cannot be unitized.
Public Method
Static Member
VectorAngle(Vector3d, Vector3d)
Compute the angle between two vectors.
This operation is commutative.
Public Method
Static Member
VectorAngle(Vector3d, Vector3d, Plane)
Computes the angle on a plane between two vectors.
Public Method
Static Member
VectorAngle(Vector3d, Vector3d, Vector3d)
Computes the angle of v1, v2 with a normal vector.
Operators
Name
Description
Public Operator
Static Member
Addition
Sums up two vectors.
Public Operator
Static Member
Division
Divides a Vector3d by a number, having the effect of shrinking it.
Public Operator
Static Member
Equality
Determines whether two vectors have the same value.
Public Operator
Static Member
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.
Public Operator
Static Member
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.
Public Operator
Static Member
.(Vector3f to Vector3d)
Converts a single-precision (float) vector in a double-precision vector, without needing casting.
Public Operator
Static Member
Inequality
Determines whether two vectors have different values.
Public Operator
Static Member
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.
Public Operator
Static Member
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.
Public Operator
Static Member
Multiply(Double, Vector3d)
Multiplies a vector by a number, having the effect of scaling it.
Public Operator
Static Member
Multiply(Vector3d, Vector3d)
Multiplies two vectors together, returning the dot product (or inner product). This differs from the cross product.
Public Operator
Static Member
Multiply(Vector3d, Double)
Multiplies a vector by a number, having the effect of scaling it.
Public Operator
Static Member
Subtraction
Subtracts the second vector from the first one.
Public Operator
Static Member
UnaryNegation
Computes the opposite vector.