IRangeOps

Description

[StaticTemplate]
interface Tinman.Core.Math.IRangeOps
<TValue>
<TRange>
<TValueFloat>
<TRangeFloat>

Extended by

RangeD struct
RangeF struct
RangeI struct
RangeL struct

Defines common operations for range values.

Public / Methods

Clamp


[Pure]
public method Clamp → (1)

value in : TValue

The value to clamp.

returns → TValue

The clamped value.

Clamps the given value to this range.

Contains

2 overloads


[Pure]
public method Contains1 → (1)

value in : TValue

The value.

returns → bool

true if value in is contained in this range, false if not.

Checks if this range contains the given value.


[Pure]
public method Contains2 → (1)

range in : TRange

The range.

returns → bool

true if range in is fully contained in this range, false if not.

Checks if this range fully contains the given range.

Grow

2 overloads


[Pure]
public method Grow1 → (1)

value in : TValue

The value.

returns → TRange

The resulting range.

Grows this range so that it contains the given value.


[Pure]
public method Grow2 → (1)

range in : TRange

The range.

returns → TRange

The resulting range.

Grows this range so that it fully contains the given range.

Intersection


[Pure]
public method Intersection → (1)

other in : TRange

The other range.

returns → TRange

The resulting range.

Intersects this range with the given one.

Intersects


[Pure]
public method Intersects → (1)

other in : TRange

The other range.

returns → bool

true if both ranges intersect, false if not.

Checks if this range intersects with the given one.

Scale


[Pure]
public method Scale → (1)

factor in : TValueFloat

[>0]
The scale factor.

returns → TRangeFloat

The scaled range.

Scales this range.

To​String


[Pure]
public method ToString → (1)

formatFlags in : FormatFlags

The format flags to use, see Format.ThisNum.

returns → string

The string representation.

Returns the string representation of this range.

Transform


[Pure]
public method Transform → (2)

value in : TValueFloat

The value to transform.

target in : TRangeFloat

The target range.

returns → TValueFloat

The transformed value.

Transforms the given value from this range to the given range.

This method transforms the given input value in with a linear function that maps start and end points of this range onto the start and end points of the given target in range, respectively. No clamping is performed by this method.

Public / Attributes

Is​Empty


public attribute IsEmpty → (get)

value : bool

true if this range is empty. false if not.

Is this range empty (i.e. its length is zero)?

Length


public attribute Length → (get)

value : TValue

[>=0]
The range length.

Returns the length of the range.