M&B: Bannerlord 1.2.10
The horns sound, the ravens gather.
|
2D vector class
Classes | |
struct | StackArray6Vec2 |
Public Member Functions | |
Vec2 (float a, float b) | |
Initializes a new instance of vector. | |
Vec2 (Vec2 v) | |
Initializes a new instance of vector. | |
Vec2 (Vector2 v) | |
Vec3 | ToVec3 (float z=0.0f) |
float | Normalize () |
Normalizes vector. | |
Vec2 | Normalized () |
override bool | Equals (object obj) |
Determines whether the specified generic object is equal to this instance. | |
override int | GetHashCode () |
Returns a hash code for this instance. | |
bool | IsUnit () |
bool | IsNonZero () |
bool | NearlyEquals (Vec2 v, float epsilon=MBMath.Epsilon) |
Checks if vector is nearly equals to another vector. | |
void | RotateCCW (float angleInRadians) |
Rotates the vector in Counter-Clockwise direction by an angle. | |
float | DotProduct (Vec2 v) |
Dot product of two vectors. | |
Vec2 | TransformToLocalUnitF (Vec2 a) |
Transforms a vector to local. assumes vec is unit f vector. | |
Vec2 | TransformToParentUnitF (Vec2 a) |
Transforms a vector to parent. assumes vec is unit f vector. | |
Vec2 | TransformToLocalUnitFLeftHanded (Vec2 a) |
Transforms a vector to local. Uses left handed coordinate system. assumes vec is unit f vector. | |
Vec2 | TransformToParentUnitFLeftHanded (Vec2 a) |
Transforms a vector to parent. Uses left handed coordinate system. assumes vec is unit f vector. | |
Vec2 | RightVec () |
90 degrees rotated vector | |
Vec2 | LeftVec () |
-90 degrees rotated vector | |
override string | ToString () |
float | DistanceSquared (Vec2 v) |
float | Distance (Vec2 v) |
The length of distance from v. | |
float | DistanceToLineSegment (Vec2 v, Vec2 w, out Vec2 closestPointOnLineSegment) |
float | DistanceSquaredToLineSegment (Vec2 v, Vec2 w, out Vec2 closestPointOnLineSegment) |
float | AngleBetween (Vec2 vector2) |
Returns the the angle in radians between this and the argument vectors. | |
Static Public Member Functions | |
static | operator Vector2 (Vec2 vec2) |
static implicit | operator Vec2 (Vector2 vec2) |
static WindingOrder | GetWindingOrder (Vec2 first, Vec2 second, Vec2 third) |
static float | CCW (Vec2 va, Vec2 vb) |
Counter-clockwise: 2-d version of cross product. Check sign of result. = |va|*|vb|*sin(counter-clockwise angle) | |
static bool | operator== (Vec2 v1, Vec2 v2) |
static bool | operator!= (Vec2 v1, Vec2 v2) |
static Vec2 | operator- (Vec2 v) |
static Vec2 | operator+ (Vec2 v1, Vec2 v2) |
static Vec2 | operator- (Vec2 v1, Vec2 v2) |
static Vec2 | operator* (Vec2 v, float f) |
static Vec2 | operator* (float f, Vec2 v) |
static Vec2 | operator/ (float f, Vec2 v) |
static Vec2 | operator/ (Vec2 v, float f) |
static float | DotProduct (Vec2 va, Vec2 vb) |
Dot product of two vectors. | |
static Vec2 | FromRotation (float rotation) |
Creates a new Vec2 from the rotation angle. | |
static Vec2 | Max (Vec2 v1, Vec2 v2) |
Returns maximum of each component of two vectors. | |
static Vec2 | Max (Vec2 v1, float f) |
static Vec2 | Min (Vec2 v1, Vec2 v2) |
Returns minimum of each component of two vectors. | |
static Vec2 | Min (Vec2 v1, float f) |
static float | DistanceToLine (Vec2 line1, Vec2 line2, Vec2 point) |
static float | DistanceToLineSegmentSquared (Vec2 line1, Vec2 line2, Vec2 point) |
static Vec2 | Lerp (Vec2 v1, Vec2 v2, float alpha) |
static Vec2 | Slerp (Vec2 start, Vec2 end, float percent) |
static int | SideOfLine (Vec2 point, Vec2 line1, Vec2 line2) |
Public Attributes | |
float | x |
x component of the vector. | |
float | y |
y component of the vector. | |
Static Public Attributes | |
static readonly Vec2 | Side = new Vec2(1, 0) |
static readonly Vec2 | Forward = new Vec2(0, 1) |
static readonly Vec2 | One = new Vec2(1, 1) |
static readonly Vec2 | Zero = new Vec2(0, 0) |
static readonly Vec2 | Invalid = new Vec2(float.NaN, float.NaN) |
Properties | |
float | X [get] |
float | Y [get] |
float | this[int i] [get, set] |
Implements indexer operation. | |
float | Length [get] |
Return the length of the vector. | |
float | LengthSquared [get] |
Return the square of the length of the vector. | |
float | RotationInRadians [get] |
Calculates the counter clockwise rotation from y axis in radians. | |
bool | IsValid [get] |
Determines if all (XY) components are valid (not NaN or Infinite) or not. | |
TaleWorlds.Library.Vec2.Vec2 | ( | float | a, |
float | b ) |
a | x value. |
b | y value. |
TaleWorlds.Library.Vec2.Vec2 | ( | Vec2 | v | ) |
v | Copied vector |
TaleWorlds.Library.Vec2.Vec2 | ( | Vector2 | v | ) |
Vec3 TaleWorlds.Library.Vec2.ToVec3 | ( | float | z = 0::0f | ) |
|
explicitstatic |
|
static |
float TaleWorlds.Library.Vec2.Normalize | ( | ) |
Vec2 TaleWorlds.Library.Vec2.Normalized | ( | ) |
|
static |
va | The va. |
vb | The vb. |
override bool TaleWorlds.Library.Vec2.Equals | ( | object | obj | ) |
obj | The generic object to compare with this instance. |
true
if the specified object is equal to this instance; otherwise, false
. override int TaleWorlds.Library.Vec2.GetHashCode | ( | ) |
bool TaleWorlds.Library.Vec2.IsUnit | ( | ) |
bool TaleWorlds.Library.Vec2.IsNonZero | ( | ) |
bool TaleWorlds.Library.Vec2.NearlyEquals | ( | Vec2 | v, |
float | epsilon = MBMath::Epsilon ) |
v | Vector that is compared. |
epsilon | Epsilon for equality. |
void TaleWorlds.Library.Vec2.RotateCCW | ( | float | angleInRadians | ) |
angleInRadians | The angle |
float TaleWorlds.Library.Vec2.DotProduct | ( | Vec2 | v | ) |
v | Second vector |
va | First vector |
vb | Second vector |
|
static |
rotation |
a | Vector to be transformed. |
a | Vector to be transformed. |
a | Vector to be transformed. |
a | Vector to be transformed. |
Vec2 TaleWorlds.Library.Vec2.RightVec | ( | ) |
Vec2 TaleWorlds.Library.Vec2.LeftVec | ( | ) |
va | First vector |
vb | Second vector |
va | First vector |
vb | Second vector |
override string TaleWorlds.Library.Vec2.ToString | ( | ) |
float TaleWorlds.Library.Vec2.DistanceSquared | ( | Vec2 | v | ) |
float TaleWorlds.Library.Vec2.Distance | ( | Vec2 | v | ) |
v | Vector v. |
|
static |
float TaleWorlds.Library.Vec2.DistanceToLineSegment | ( | Vec2 | v, |
Vec2 | w, | ||
out Vec2 | closestPointOnLineSegment ) |
float TaleWorlds.Library.Vec2.DistanceSquaredToLineSegment | ( | Vec2 | v, |
Vec2 | w, | ||
out Vec2 | closestPointOnLineSegment ) |
float TaleWorlds.Library.Vec2.AngleBetween | ( | Vec2 | vector2 | ) |
vector2 |
float TaleWorlds.Library.Vec2.x |
float TaleWorlds.Library.Vec2.y |
|
get |
|
get |
|
getset |
return x if i = 0 return y if i = 1
|
get |
|
get |
|
get |
Rotation angle.
|
get |