Struct GeoVector2
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
Represents a 2D vector with double precision coordinates.
public readonly struct GeoVector2 : IEquatable<GeoVector2>
- Implements
- Inherited Members
- Extension Methods
Constructors
- GeoVector2(double, double)
Initializes a new vector.
Properties
- IsValid
Gets whether this is a shape a constructor could have made: every component is a finite number.
- Length
Gets the length of the vector.
- LengthSquared
Gets the squared length of the vector.
- X
Gets the X coordinate of the vector.
- XAxis
Gets the unit vector along the X-axis (1, 0).
- Y
Gets the Y coordinate of the vector.
- YAxis
Gets the unit vector along the Y-axis (0, 1).
- Zero
Gets the zero vector (0, 0).
Methods
- Add(GeoVector2)
Adds this vector to another vector.
- Clone()
Creates a copy of this vector.
- CrossProduct(GeoVector2)
Calculates the 2D cross product with another vector (returns the Z component).
- DotProduct(GeoVector2)
Calculates the dot product with another vector.
- Equals(GeoVector2)
Indicates whether the current vector is equal to another vector.
- Equals(object)
Indicates whether this instance and a specified object are equal.
- GetAngleTo(GeoVector2)
Gets the unsigned angle to another vector in radians, in the range [0, PI].
- GetHashCode()
Returns the hash code for this instance.
- GetPerpendicularVector()
Gets the perpendicular vector by rotating 90 degrees counter-clockwise.
- GetSignedAngleTo(GeoVector2)
Gets the signed angle to another vector in radians, in the range (-PI, PI].
- IsCodirectionalTo(GeoVector2)
Determines whether this vector points the same way as another, using the default tolerance.
- IsCodirectionalTo(GeoVector2, Tolerance)
Determines whether this vector points the same way as another, within a tolerance.
- IsEqualTo(GeoVector2)
Compares whether this vector equals another vector using default tolerance.
- IsEqualTo(GeoVector2, Tolerance)
Compares whether this vector equals another vector within tolerance.
- IsParallelTo(GeoLine2)
Checks whether this vector is parallel to a line segment using default tolerance.
- IsParallelTo(GeoLine2, Tolerance)
Checks whether this vector is parallel to a line segment within angular tolerance.
- IsParallelTo(GeoVector2)
Checks whether this vector is parallel to another vector using default tolerance.
- IsParallelTo(GeoVector2, Tolerance)
Checks whether this vector is parallel to another vector within angular tolerance.
- IsPerpendicularTo(GeoLine2)
Checks whether this vector is perpendicular to a line segment using default tolerance.
- IsPerpendicularTo(GeoLine2, Tolerance)
Checks whether this vector is perpendicular to a line segment within angular tolerance.
- IsPerpendicularTo(GeoVector2)
Checks whether this vector is perpendicular to another vector using default tolerance.
- IsPerpendicularTo(GeoVector2, Tolerance)
Checks whether this vector is perpendicular to another vector within angular tolerance.
- IsZeroLength()
Checks whether the vector has zero length using default tolerance.
- IsZeroLength(Tolerance)
Checks whether the vector has zero length within tolerance.
- Multiply(double)
Multiplies vector components by a scalar.
- Normalize()
Gets the normalized unit vector. Throws InvalidOperationException if the vector length is zero.
- ProjectOnto(GeoVector2)
Projects this vector onto another axis vector.
- RotateBy(double)
Rotates the vector by an angle in radians (counter-clockwise).
- Subtract(GeoVector2)
Subtracts another vector from this vector.
- ToString()
Returns the string representation of the vector.
- ToVector3(GeoCoordinateSystem3)
Puts this vector of the plane back into space, parallel to the plane of a frame.
- TransformBy(GeoTransform2)
Applies a transformation to this vector. The translation does not touch a vector.
- TryGetNormal(out GeoVector2)
Tries to normalize the vector without throwing an exception using default tolerance.
- TryGetNormal(out GeoVector2, Tolerance)
Tries to normalize the vector with a specific tolerance.
Operators
- operator +(GeoVector2, GeoVector2)
Adds two vectors.
- operator /(GeoVector2, double)
Divides a vector by a scalar.
- operator ==(GeoVector2, GeoVector2)
Compares two GeoVector2 instances for equality.
- operator !=(GeoVector2, GeoVector2)
Compares two GeoVector2 instances for inequality.
- operator *(GeoVector2, double)
Multiplies a vector by a scalar.
- operator *(double, GeoVector2)
Multiplies a vector by a scalar.
- operator -(GeoVector2, GeoVector2)
Subtracts one vector from another.
- operator -(GeoVector2)
Negates a vector.