class Point2D

namespace sys.core
class Point2D

Constructors

this

this{value: T};
this{x: T, y: 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=>

Methods

Clamp

def Clamp(min: Point2D, max: Point2D);
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: Point2D, max: Point2D): Point2D;
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: Point2D): Point2D;

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: Point2D): Point2D;

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 2 dimensional normalized vector, within a tolerance.

Parameters

tolerance=> tolerance for a non zero lengthed vector

Returns


Normalize

def Normalize(tolerance: T);

Brief

Normalizes the 2 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): Point2D;

Brief

Returns a 2 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


@add

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

Brief

Member-wise addition operator. Commutative.

Parameters

second=> the second operand

Returns


@sub

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

Brief

Member-wise subtraction operator.

Parameters

left=> the left operand
right=> the right operand

Returns


@mul

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

Brief

Member-wise multiplication operator. Commutative.

Parameters

second=> the second operand

Returns


@div

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

Brief

Member-wise division operator.

Parameters

left=> the left operand
right=> the right operand

Returns


@mod

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

Brief

Member-wise modulo operator.

Parameters

left=> the left operand
right=> the right operand

Returns


@minus

func @minus(): Point2D;

Brief

Returns the member-wise negative of the current instance.

Returns


@eq

func @eq(second: T): Bool;

Brief

Member-wise equality operator.

Parameters

second=> the second operand

Returns


@neq

func @neq(second: T): Bool;

Brief

Member-wise inequality operator.

Parameters

second=> the second operand

Returns


Equals

func Equals(second: Point2D, 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

Properties

Length

property Length: T; get;

Brief

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


LengthSquared

property LengthSquared: T; get;

Brief

The squared length of the instance interpreted as a 2 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.