TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

struct RangeL in Tinman.Core.Math

A half-closed range of numbers (64-bit integers): [Start..End[

struct RangeL implements IEquatable<RangeL>

Remarks

                    Last := End - 1
                    vvvvv
+----+----+----+----+----+----+----+----+----+
| -4 | -3 | -2 | -1 |  0 |  1 |  2 |  3 |  4 |-->  Number axis
+----+----+----+----+----+----+----+----+----+
     ^^^^^               ^^^^^
     Start (inclusive)   End (exclusive)
     \___________________/
      Length := End - Start

Serialization

Serializer

The serialization helper object for values of RangeL.

public static readonly field Serializer
type ITypeSerializer<RangeL>

Public / Constants

Inv

The value of Max, with swapped start and end values.

public static readonly field Inv
type RangeL

Remarks:

This range can be used as the initial value for finding the minimum/maximum of a series of numbers (see Grow).

Max

A range that contains all 32-bit integers.

public static readonly field Max
type RangeL

Remarks:

Note that the length of this range is 2^64 (18446744073709551616), which cannot be expressed using 64-bits. So instead 0 is returned.

Zero

A range at offset zero with zero length.

public static readonly field Zero
type RangeL

Public / Attributes

End

End of number range (exclusive).

public property End { get }
type int64
value End of number range (exclusive).

IsEmpty

Is this number range empty?

public property IsEmpty { get }
type bool
value true if this range is empty, false if it is not.

Last

End of number range (inclusive).

public readonly field Last
type int64

Length

Length of this number range.

public property Length { get }
type int64
value The range length.

Start

Start of number range (inclusive).

public readonly field Start
type int64

Public / Methods

Clamp

Clamps the given value to this range.

[Pure]
public method Clamp (int64 value)
type int64
params value The value to clamp.
returns The clamped value.

Closed

Returns a range that represents the closed interval [a..b] (i.e. both a and b are contained in the range).

public static method Closed (int64 a, int64 b)
type RangeL
params a Left value of interval.
  b Right value of interval.
returns The range value.

Contains

Checks if this range contains the given value.

[Pure]
public method Contains (int64 value)
type bool
params value The value.
returns true if value is contained in this range, false if not.

Checks if this range fully contains the given range.

[Pure]
public method Contains (RangeL range)
type bool
params range The range.
returns true if range is fully contained in this range, false if not.

Equals

public method Equals (RangeL other)
type bool
params other

Grow

Grows this range so that it contains the given value.

[Pure]
public method Grow (int64 value)
type RangeL
params value The value.
returns The resulting range.

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

[Pure]
public method Grow (RangeL range)
type RangeL
params range The range.
returns The resulting range.

Intersection

Intersects this range with the given one.

[Pure]
public method Intersection (RangeL other)
type RangeL
params other The other range.
returns The resulting range.

Intersects

Checks if this range intersects with the given one.

[Pure]
public method Intersects (RangeL other)
type bool
params other The other range.
returns true if both ranges intersect, false if not.

Of

Returns the shortest possible range that contains the given value.

public static method Of (int64 a)
type RangeL
params a The value to contains.
returns The range value.

Returns the shortest possible range that contains the given values.

public static method Of (int64 a, int64 b)
type RangeL
params a First value to contains.
  b Second value to contains.
returns The range value.

Returns the shortest possible range that contains the given values.

public static method Of (int64 a, int64 b, int64 c)
type RangeL
params a First value to contains.
  b Second value to contains.
  c Third value to contains.
returns The range value.

Open

Returns a range that represents the open interval ]a..b[ (i.e. neither a nor b is contained in the range).

public static method Open (int64 a, int64 b)
type RangeL
params a Left value of interval.
  b Right value of interval.
returns The range value.

OpenLeft

Returns a range that represents the half-open interval ]a..b] (i.e. a is not contained in the range but b is).

public static method OpenLeft (int64 a, int64 b)
type RangeL
params a Left value of interval.
  b Right value of interval.
returns The range value.

OpenRight

Returns a range that represents the half-open interval [a..b[ (i.e. a is contained in the range but b is not).

public static method OpenRight (int64 a, int64 b)
type RangeL
params a Left value of interval.
  b Right value of interval.
returns The range value.

ToString

public override method ToString ()
type string

Transform

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

[Pure]
public method Transform (float64 value, RangeD target)
type float64
params value The value to transform.
  target The target range.
returns The transformed value.

Remarks:

The method maps Start to target. Start and Last to target. End.
No clamping is performed by this method.