namespace sys.core
class Point4D
A four dimensional generic vector.
Can be used as a point or a vector.
Predefined specializations:
```C#
alias Point4Di = Point4D
alias Point4Du = Point4D
alias Point4Df = Point4D
alias Point4Dd = Point4D
```
this{value: T};
this{x: T, y: T, z: T, w: T};
this{p2d: Point2D, z: T, w: T};
this{p2d: Point2D, s2d: Point2D};
this{p3d: Point3D, w: T};
Creates a new instance initializing each component of the point.
value | the value to use for each component |
---|---|
x | the first dimension of the point |
y | the second dimension of the point |
z | the third dimension of the point |
w | the fourth dimension of the point |
p2d | a 2 dimensional point that is used as the first two dimensions |
s2d | a 2 dimensional point that is used as the last two dimensions |
p3d | a 3 dimensional point that is used as the first three dimensions |
def Clamp(min: Point4D, max: Point4D);
def Clamp(min: T, max: T);
Clamps each component of the current mutable instance between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
func Clamped(min: Point4D, max: Point4D): Point4D;
func Clamped(min: T, max: T): Point4D;
Returns a copy of the color with each component clamped between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
the clamped value
func GetMin(min: Point4D): Point4D;
Returns the member-wise minimum between the current instance and the input.
min | the value to test against |
---|
the member-wise minimum
func GetMax(max: Point4D): Point4D;
Returns the member-wise maximum between the current instance and the input.
max | the value to test against |
---|
the member-wise maximum
func IsNormalized(tolerance: T): Bool;
Tests if the current instance is a 4 dimensional normalized vector, within a tolerance.
tolerance | tolerance for a non zero lengthed vector |
---|
`true` if normalized
def Normalize(tolerance: T);
Normalizes the 4 dimensional vector if its length falls within the tolerance limits.
Otherwise, the value remains unchanged.
tolerance | tolerance for a non zero lengthed vector |
---|
func Normalized(tolerance: T): Point4D;
Returns a 4 dimensional normalized copy of the vector if its length falls within the tolerance limits.
Otherwise, returns the value as is.
tolerance | tolerance for a non zero lengthed vector |
---|
`true` if normalized
func @add(second: Point4D): Point4D;
func @add(second: T): Point4D;
Member-wise addition operator. Commutative.
second | the second operand |
---|
the result
static func @sub(left: Point4D, right: Point4D): Point4D;
static func @sub(left: Point4D, right: T): Point4D;
static func @sub(left: T, right: Point4D): Point4D;
Member-wise subtraction operator.
left | the left operand |
---|---|
right | the right operand |
the result
func @mul(second: Point4D): Point4D;
func @mul(second: T): Point4D;
Member-wise multiplication operator. Commutative.
second | the second operand |
---|
the result
static func @div(left: Point4D, right: Point4D): Point4D;
static func @div(left: Point4D, right: T): Point4D;
static func @div(left: T, right: Point4D): Point4D;
Member-wise division operator.
left | the left operand |
---|---|
right | the right operand |
the result
static func @mod(left: Point4D, right: Point4D): Point4D;
static func @mod(left: Point4D, right: T): Point4D;
static func @mod(left: T, right: Point4D): Point4D;
Member-wise modulo operator.
left | the left operand |
---|---|
right | the right operand |
the result
func @minus(): Point4D;
Returns the member-wise negative of the current instance.
the result
func @eq(second: T): Bool;
Member-wise equality operator.
second | the second operand |
---|
`true` if equal
func @neq(second: T): Bool;
Member-wise inequality operator.
second | the second operand |
---|
`true` if not equal
func Equals(second: Point4D, tolerance: T): Bool;
func Equals(second: T, tolerance: T): Bool;
Member-wise equality operator within a given tolerance.
second | the second operand |
---|---|
tolerance | tolerance for equality |
`true` if equal
property Length: T; get;
The length of the instance interpreted as a 4 dimensional vector.
property LengthSquared: T; get;
The squared length of the instance interpreted as a 4 dimensional vector.
val X: T;
The first dimension of the point.
val Y: T;
The second dimension of the point.
val Z: T;
The third dimension of the point.
val W: T;
The fourth dimension of the point.