struct Vector2

book_4_sparkGenerated
code_blocksInput

Description

A 2-dimensional vector. Typically represents a position or size in 2D space.

Members

Static Members

Member NameSummary
FromRadiansCreates a Vector2 from an angle in radians.
FromDegreesCreates a Vector2 from an angle in degrees.
DistanceBetweenCalculates the distance between two Vector2 points.
DistanceBetweenSquaredCalculates the squared distance between two Vector2 points.
DistanceSquaredCalculates the squared distance between two Vector2 points.
DotCalculates the dot product of two Vector2 vectors.
LerpLinearly interpolates between two Vector2 vectors.
MinReturns the component-wise minimum of two vectors.
MaxReturns the component-wise maximum of two vectors.
ParseParses a string to create a Vector2.
TryParseTries to parse a string to create a Vector2.
OneReturns a 2D vector with every component set to 1.
ZeroReturns a 2D vector with every component set to 0.
UpReturns a 2D vector with Y set to 1, representing the upwards direction.
DownReturns a 2D vector with Y set to -1, representing the downwards direction.
LeftReturns a 2D vector with X set to 1, representing the left direction.
RightReturns a 2D vector with X set to -1, representing the right direction.
RandomSamples a random 2D position within a unit circle.

Instance Members

Member NameSummary
DistanceCalculates the distance to another Vector2.
AlmostEqualChecks if two vectors are approximately equal within a delta.
SnapToGridSnaps the vector to a grid of a specified size.
WithXReturns a new vector with the X component set to a specified value.
WithYReturns a new vector with the Y component set to a specified value.
LerpToInterpolates the vector towards a target vector.
ClampClamps the vector within specified minimum and maximum bounds.
ComponentMinReturns the component-wise minimum with another vector.
ComponentMaxReturns the component-wise maximum with another vector.
AbsReturns a new vector with all values positive.
LengthReturns the magnitude of the vector.
LengthSquaredReturns the squared magnitude of the vector.
PerpendicularReturns a vector perpendicular to this one.
IsNearZeroLengthChecks if the vector's length is near zero.
NormalReturns a normalized version of the vector.
DegreesReturns the angle of the vector in degrees.
xX component of this Vector.
yY component of this Vector.