Vector2d
Represents the two components of a vector in two-dimensional space, using Double-precision floating point numbers.
Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
[SerializableAttribute]public struct Vector2d : ISerializable, IEquatable<Vector2d>, IComparable<Vector2d>, IComparable, IEpsilonComparable<Vector2d>, IFormattable
The Vector2d type exposes the following members.
Constructors
Name
Description
Public Method
Vector2d
Initializes a new instance of the vector based on two, X and Y, components.
Properties
Name
Description
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
Length
Computes the length (or magnitude, or size) of this vector. This is an application of Pythagoras’ theorem.
Public Property
SquareLength
Returns the square of the length of the vector.
Public Property
Static Member
Unset
Gets the value of the vector with components set as RhinoMath.UnsetValue,RhinoMath.UnsetValue.
Public Property
X
Gets or sets the X (first) component of this vector.
Public Property
Y
Gets or sets the Y (second) component of this vector.
Public Property
Static Member
Zero
Gets the value of the vector with components 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
CompareTo
Compares this Vector2d with another Vector2d.
Components evaluation priority is first X, then Y.
Public Method
Static Member
Divide
Divides a Vector2d 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 Vector2d and has the same value as the present vector.
(Overrides ValueType.Equals(Object).)
Public Method
Equals(Vector2d)
Determines whether the specified vector has the same value as the present vector.
Public Method
GetHashCode
Provides a hashing value for the present vector.
(Overrides ValueType.GetHashCode..)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
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, Vector2d)
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(Vector2d, Vector2d)
Multiplies two vectors together, returning the dot product (or inner product).
(Provided for languages that do not support operator overloading. You can use the * operator otherwise)
Public Method
Static Member
Multiply(Vector2d, 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
Rotate
Rotates this vector.
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.
Constructs a string representation of the current vector.
(Overrides ValueType.ToString..)
Public Method
ToString(String, IFormatProvider)
Formats the value of the current instance using the specified format.
Public Method
Unitize
Unitizes the vector in place. A unit vector has length 1 unit.
An invalid or zero length vector cannot be unitized.
Operators
Name
Description
Public Operator
Static Member
Addition
Sums up two vectors.
Public Operator
Static Member
Division
Divides a Vector2d by a number, having the effect of shrinking it.
Public Operator
Static Member
Equality
Determines whether two vectors have equal values.
Public Operator
Static Member
GreaterThan
Determines whether the first specified vector comes after (has superior sorting value than) the second vector.
Components have decreasing evaluation priority: first X, then Y.
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 have decreasing evaluation priority: first X, then Y.
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 have decreasing evaluation priority: first X, then Y.
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 have decreasing evaluation priority: first X, then Y.
Public Operator
Static Member
Multiply(Double, Vector2d)
Multiplies a vector by a number, having the effect of scaling it.
Public Operator
Static Member
Multiply(Vector2d, Vector2d)
Multiplies two vectors together, returning the dot product (or inner product).
Public Operator
Static Member
Multiply(Vector2d, 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.