Class QuantizedVector
Contains methods for converting a Unity float vector (e.g. Vector3) into an in vector (e.g. Vector3Int).
Inheritance
System.Object
QuantizedVector
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: CarbideFunction.Wildtile
Syntax
public static class QuantizedVector
Methods
Quantize(Vector2, Single)
Convert a 2D float vector into an int vector.
Multiplies the vector components by quantizationResolution
before rounding to the nearest int. For vectors with 0-1 domains, this will convert the values to 0-quantizationResolution
.
Declaration
public static Vector2Int Quantize(this Vector2 vector, float quantizationResolution)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | |
System.Single | quantizationResolution |
Returns
Type | Description |
---|---|
Vector2Int |
Quantize(Vector3, Single)
Convert a 3D float vector into an int vector.
Multiplies the vector components by quantizationResolution
before rounding to the nearest int. For vectors with 0-1 domains, this will convert the values to 0-quantizationResolution
.
Declaration
public static Vector3Int Quantize(this Vector3 vector, float quantizationResolution)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | |
System.Single | quantizationResolution |
Returns
Type | Description |
---|---|
Vector3Int |