public sealed struct Vector4
A 4-dimensional vector/point.
Related Guides
Broader workflow and conceptual references connected to this API.
Constructors
Showing 5 constructors
No results match this filter.
Methods
Showing 29 methods
public bool AlmostEqual(Vector4 v, float delta = 0.0001)
Returns true if we're nearly equal to the passed vector.
Parameters
v: The value to compare withdelta: The max difference between component values Default: 0.0001
Returns
True if nearly equal
public Vector4 ComponentMax(Vector4 other)
Returns a vector that has the maximum values on each axis between this vector and given vector.
public Vector4 ComponentMin(Vector4 other)
Returns a vector that has the minimum values on each axis between this vector and given vector.
public float Distance(Vector4 target)
Returns distance between this vector to given vector.
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.
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.
public bool IsNearlyZero(float tolerance = 0.0001)
Returns true if value on every axis is less than tolerance away from zero
Parameters
tolerance: Default: 0.0001
public static Vector4 Max(Vector4 a, Vector4 b)
Returns a vector that has the maximum values on each axis between the 2 given vectors.
public Vector4 Min(Vector4 a, Vector4 b)
Returns a vector that has the minimum values on each axis between the 2 given vectors.
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.
Parameters
sx: Default: Truesy: Default: Truesz: Default: Truesw: Default: True
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.
public Vector4 WithW(float w)
Returns this vector with given W component.
Parameters
w: The override for W component.
Returns
The new vector.
public Vector4 WithX(float x)
Returns this vector with given X component.
Parameters
x: The override for X component.
Returns
The new vector.
public Vector4 WithY(float y)
Returns this vector with given Y component.
Parameters
y: The override for Y component.
Returns
The new vector.
public Vector4 WithZ(float z)
Returns this vector with given Z component.
Parameters
z: The override for Z component.
Returns
The new vector.
No results match this filter.
Properties
Showing 10 properties
public bool Vector4.IsInfinity { get; set; }
Returns true if x, y, z or w are infinity
public bool Vector4.IsNaN { get; set; }
Returns true if x, y, z or w are NaN
public bool Vector4.IsNearZeroLength { get; set; }
Whether length of this vector is nearly zero.
public float Vector4.Length { get; set; }
The length (or magnitude) of the vector (Distance from 0,0,0).
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.
public float Vector4.w { get; set; }
The W component of this Vector.
public float Vector4.x { get; set; }
The X component of this Vector.
public float Vector4.y { get; set; }
The Y component of this Vector.
public float Vector4.z { get; set; }
The Z component of this Vector.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | global |
| Type | class |
| Assembly | Sandbox.System |
| Doc ID | T:Vector4 |