Skip to content

Vector2d

Public Struct

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

Initializes a new instance of the vector based on two, X and Y, components.


Properties

Name

Description


Public Property

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

Computes the length (or magnitude, or size) of this vector. This is an application of Pythagoras’ theorem.


Public Property

Returns the square of the length of the vector.


Public Property
Static Member

Gets the value of the vector with components set as RhinoMath.UnsetValue,RhinoMath.UnsetValue.


Public Property

Gets or sets the X (first) component of this vector.


Public Property

Gets or sets the Y (second) component of this vector.


Public Property
Static Member

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


Methods

Name

Description


Public Method
Static Member

Sums up two vectors.

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


Public Method

Compares this Vector2d with another Vector2d.

Components evaluation priority is first X, then Y.


Public Method
Static Member

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

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


Public Method

Determines whether the specified System.Object is a Vector2d and has the same value as the present vector.

(Overrides ValueType.Equals(Object).)


Public Method

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


Public Method

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

Uses RhinoMath.ZeroTolerance for IsTiny calculation.


Public Method
Code Example

Determines whether a vector is very short.


Public Method
Static Member

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

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

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

Computes the reversed vector.

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


Public Method

Rotates this vector.


Public Method
Static Member

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

Constructs a string representation of the current vector.

(Overrides ValueType.ToString..)


Public Method

Formats the value of the current instance using the specified format.


Public Method

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.