Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Constant

Represents a constant scalar quantity with a fixed value.

extends

Scalar

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Constant(value: number, name?: string): Constant
  • Creates a Scalar.Constant object from number. One may optionally pass in a string by which this object may be identified by.

    Using the contructor directly for creating vector objects is not recommended.

    see

    Scalar.constant

    Parameters

    • value: number

      The fixed value this should represent.

    • Default value name: string = ""

      The name by which this is identified.

    Returns Constant

Properties

name

name: string

The name by which this is identified.

quantity

quantity: "scalar" = "scalar"

type

type: "constant" = "constant"

value

value: number

The fixed value this should represent.

Methods

add

div

equals

  • equals(that: Constant): boolean
  • equals(that: Constant, tolerance: number): boolean
  • Checks for equality of two scalar constants. The equality check for floating point numbers becomes problematic in the decimal system. The binary representation is finite and therefore even if two values are in fact equal they may not return true by using the == or === equality. To tackle this problem we use a tolerance value, if the difference of the two numerical values is less than that tolerance value then we can assume the values to be practically equal. Smaller tolerance values will result in more accurate checks. This function allows a default tolerance of 1e-14 for floating point numbers.

    Parameters

    • that: Constant

      The value to check equality with.

    Returns boolean

  • Checks for equality of two scalar constants. The equality check for floating point numbers becomes problematic in the decimal system. The binary representation is finite and therefore even if two values are in fact equal they may not return true by using the == or === equality. To tackle this problem we use a tolerance value, if the difference of the two numerical values is less than that tolerance value then we can assume the values to be practically equal. Smaller tolerance values will result in more accurate checks.

    Parameters

    • that: Constant

      The value to check equality with.

    • tolerance: number

      The tolerance permitted for floating point numbers.

    Returns boolean

mul

pow

sub

Generated using TypeDoc