Vector4class
A 4-dimensional vector/point.
Constructors5
Showing 5 constructors
No results match this filter.
Methods29
Showing 29 methods
public bool AlmostEqual(Vector4 v, float delta = 0.0001)
Returns true if we're nearly equal to the passed vector.
| Parameter | Type | Description |
|---|---|---|
| v | Vector4 | The value to compare with |
| delta = 0.0001 | float | The max difference between component values |
boolTrue if nearly equalpublic Vector4 ComponentMax(Vector4 other)
Returns a vector that has the maximum values on each axis between this vector and given vector.
| Parameter | Type | Description |
|---|---|---|
| other | Vector4 | — |
public Vector4 ComponentMin(Vector4 other)
Returns a vector that has the minimum values on each axis between this vector and given vector.
| Parameter | Type | Description |
|---|---|---|
| other | Vector4 | — |
public float Distance(Vector4 target)
Returns distance between this vector to given vector.
| Parameter | Type | Description |
|---|---|---|
| target | Vector4 | — |
float—public static float DistanceBetween(Vector4 a, Vector4 b)
| Parameter | Type | Description |
|---|---|---|
| a | Vector4 | — |
| b | Vector4 | — |
float—public static float DistanceBetweenSquared(Vector4 a, Vector4 b)
Returns squared distance between the 2 given vectors. This is faster than DistanceBetween, and can be used for things like comparing distances, as long as only squared values are used.
| Parameter | Type | Description |
|---|---|---|
| a | Vector4 | — |
| b | Vector4 | — |
float—public float DistanceSquared(Vector4 target)
Returns squared distance between this vector to given vector. This is faster than Distance, and can be used for things like comparing distances, as long as only squared values are used.
| Parameter | Type | Description |
|---|---|---|
| target | Vector4 | — |
float—public bool IsNearlyZero(float tolerance = 0.0001)
Returns true if value on every axis is less than tolerance away from zero
| Parameter | Type | Description |
|---|---|---|
| tolerance = 0.0001 | float | — |
bool—public static Vector4 Max(Vector4 a, Vector4 b)
Returns a vector that has the maximum values on each axis between the 2 given vectors.
| Parameter | Type | Description |
|---|---|---|
| a | Vector4 | — |
| b | Vector4 | — |
public Vector4 Min(Vector4 a, Vector4 b)
Returns a vector that has the minimum values on each axis between the 2 given vectors.
| Parameter | Type | Description |
|---|---|---|
| a | Vector4 | — |
| b | Vector4 | — |
public Vector4 SnapToGrid(float gridSize, bool sx = True, bool sy = True, bool sz = True, bool sw = True)
Snap to grid along any of the 4 axes.
| Parameter | Type | Description |
|---|---|---|
| gridSize | float | — |
| sx = True | bool | — |
| sy = True | bool | — |
| sz = True | bool | — |
| sw = True | bool | — |
public static void Sort(Vector4 min, Vector4 max)
Sort these two vectors into min and max. This doesn't just swap the vectors, it sorts each component. So that min will come out containing the minimum x, y, z and w values.
| Parameter | Type | Description |
|---|---|---|
| min | Vector4 | — |
| max | Vector4 | — |
void—public Vector4 WithW(float w)
Returns this vector with given W component.
| Parameter | Type | Description |
|---|---|---|
| w | float | The override for W component. |
public Vector4 WithX(float x)
Returns this vector with given X component.
| Parameter | Type | Description |
|---|---|---|
| x | float | The override for X component. |
public Vector4 WithY(float y)
Returns this vector with given Y component.
| Parameter | Type | Description |
|---|---|---|
| y | float | The override for Y component. |
No results match this filter.
Properties10
Showing 10 properties
public bool Vector4.IsInfinity { get; set; }
Returns true if x, y, z or w are infinity
bool—public bool Vector4.IsNaN { get; set; }
Returns true if x, y, z or w are NaN
bool—public bool Vector4.IsNearZeroLength { get; set; }
Whether length of this vector is nearly zero.
bool—public float Vector4.Length { get; set; }
The length (or magnitude) of the vector (Distance from 0,0,0).
float—public float Vector4.LengthSquared { get; set; }
Squared length of the vector. This is faster than `Vector4.Length`, and can be used for things like comparing distances, as long as only squared values are used.
float—public float Vector4.w { get; set; }
The W component of this Vector.
float—public float Vector4.x { get; set; }
The X component of this Vector.
float—public float Vector4.y { get; set; }
The Y component of this Vector.
float—public float Vector4.z { get; set; }
The Z component of this Vector.
float—No results match this filter.