class Point3D

namespace sys.core
class Point3D

A three dimensional generic vector.

Can be used as a point or a vector.

Predefined specializations:
```C#
alias Point2Di = Point2D;
alias Point2Du = Point2D;
alias Point2Df = Point2D;
alias Point2Dd = Point2D;
```

Constructors

this

this{value: T};
this{x: T, y: T, z: T};
this{p2d: Point2D, z: T};

Brief

Creates a new instance initializing each component of the point.

Parameters

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
p2d a 2 dimensional point that is used as the first two dimensions

Methods

Clamp

def Clamp(min: Point3D, max: Point3D);
def Clamp(min: T, max: T);

Brief

Clamps each component of the current mutable instance between `min` and `max`.

Parameters

min the minimum value
max the maximum value

Clamped

func Clamped(min: Point3D, max: Point3D): Point3D;
func Clamped(min: T, max: T): Point2D;

Brief

Returns a copy of the color with each component clamped between `min` and `max`.

Parameters

min the minimum value
max the maximum value

Returns

the clamped value

GetMin

func GetMin(min: Point3D): Point3D;

Brief

Returns the member-wise minimum between the current instance and the input.

Parameters

min the value to test against

Returns

the member-wise minimum

GetMax

func GetMax(max: Point3D): Point3D;

Brief

Returns the member-wise maximum between the current instance and the input.

Parameters

max the value to test against

Returns

the member-wise maximum

IsNormalized

func IsNormalized(tolerance: T): Bool;

Brief

Tests if the current instance is a 3 dimensional normalized vector, within a tolerance.

Parameters

tolerance tolerance for a non zero lengthed vector

Returns

`true` if normalized

Normalize

def Normalize(tolerance: T);

Brief

Normalizes the 3 dimensional vector if its length falls within the tolerance limits.

Otherwise, the value remains unchanged.

Parameters

tolerance tolerance for a non zero lengthed vector

Normalized

func Normalized(tolerance: T): Point3D;

Brief

Returns a 3 dimensional normalized copy of the vector if its length falls within the tolerance limits.

Otherwise, returns the value as is.

Parameters

tolerance tolerance for a non zero lengthed vector

Returns

`true` if normalized

@add

func @add(second: Point3D): Point3D;
func @add(second: T): Point3D;

Brief

Member-wise addition operator. Commutative.

Parameters

second the second operand

Returns

the result

@sub

static func @sub(left: Point3D, right: Point3D): Point3D;
static func @sub(left: Point3D, right: T): Point3D;
static func @sub(left: T, right: Point3D): Point3D;

Brief

Member-wise subtraction operator.

Parameters

left the left operand
right the right operand

Returns

the result

@mul

func @mul(second: Point3D): Point3D;
func @mul(second: T): Point3D;

Brief

Member-wise multiplication operator. Commutative.

Parameters

second the second operand

Returns

the result

@div

static func @div(left: Point3D, right: Point3D): Point3D;
static func @div(left: Point3D, right: T): Point3D;
static func @div(left: T, right: Point3D): Point3D;

Brief

Member-wise division operator.

Parameters

left the left operand
right the right operand

Returns

the result

@mod

static func @mod(left: Point3D, right: Point3D): Point3D;
static func @mod(left: Point3D, right: T): Point3D;
static func @mod(left: T, right: Point3D): Point3D;

Brief

Member-wise modulo operator.

Parameters

left the left operand
right the right operand

Returns

the result

@minus

func @minus(): Point3D;

Brief

Returns the member-wise negative of the current instance.

Returns

the result

@eq

func @eq(second: T): Bool;

Brief

Member-wise equality operator.

Parameters

second the second operand

Returns

`true` if equal

@neq

func @neq(second: T): Bool;

Brief

Member-wise inequality operator.

Parameters

second the second operand

Returns

`true` if not equal

Equals

func Equals(second: Point3D, tolerance: T): Bool;
func Equals(second: T, tolerance: T): Bool;

Brief

Member-wise equality operator within a given tolerance.

Parameters

second the second operand
tolerance tolerance for equality

Returns

`true` if equal

Properties

Length

property Length: T; get;

Brief

The length of the instance interpreted as a 3 dimensional vector.


LengthSquared

property LengthSquared: T; get;

Brief

The squred length of the instance interpreted as a 3 dimensional vector.

Variables

X

val X: T;

Brief

The first dimension of the point.


Y

val Y: T;

Brief

The second dimension of the point.


Z

val Z: T;

Brief

The third dimension of the point.