Dynamic Icons Scripting Reference - v1.3.0
    Preparing search index...

    Class Vect2d

    Vect2d is a concrete implementation of a PointType class. It is generally slower to create and read than a "plain" PointType object (eg. from Point.new()), but OTOH is usually faster when being updated/written. Using Vect2d is generally recommended for stored objects that persist for some time and/or are likely to get modified.

    Implements

    Index

    Accessors

    • get isNull(): boolean

      Returns true if both x and y values are zero.

      Returns boolean

    • get fuzzyIsNull(): boolean

      Returns true if both x and y values are equal to zero to within 4 decimal places of precision.

      Returns boolean

    • get length(): number

      Length is the hypotenuse of the x and y values.

      Returns number

    Constructors

    • A Vect2d instance can optionally be constructed from another PointType object (with 'x' and 'y' properties), or from numeric x[,y] arguments (see set() for details). A Vect2d constructed with no arguments has both x and y set to 0.

      Parameters

      • OptionalxOrPt: number | PointType
      • Optionaly: number

      Returns Vect2d

    Methods

    • Sets the x and y values of this Vect2d instance. The first parameter can be any object containing 'x' and 'y' properties, or a numeric value for the 'x' value. In the latter case, if a 2nd parameter is passed, it is assigned to the 'y' value; otherwise the first parameter is used for both 'x' and 'y' values.

      Parameters

      • xOrPt: number | PointType = 0
      • Optionaly: number

      Returns Vect2d

    • Returns a new Vect2d with this instance's x and y values.

      Returns Vect2d

    • Adds value(s) to current coordinates. Modifies the current value of this instance and returns itself

      Parameters

      Returns Vect2d

    • Adds value(s) to current coordinates and returns a new Vect2d object.

      Parameters

      Returns Vect2d

    • Multiplies current coordinates by value(s). Modifies the current value of this instance and returns itself

      Parameters

      Returns Vect2d

    • Multiplies current coordinates by value(s) and returns a new Vect2d object.

      Parameters

      Returns Vect2d

    • Swaps the x and y values of this vector and returns it.

      Returns Vect2d

    • Returns a new Vect2d object with the x and y values of this vector swapped.

      Returns Vect2d

    • Returns true is this Vect2d equals the given Vect2d or x & y values.

      Parameters

      Returns boolean

    • Returns true is this Vect2d equals the given PointType to within epsilon decimal places of precision.

      Parameters

      Returns boolean

    • Returns a string representation of an object.

      Returns string

    • Adds value(s) to v and returns new instance, does not modify input value.

      Parameters

      Returns Vect2d

    • Multiplies v coordinates by value(s) and returns new instance, does not modify input value,

      Parameters

      Returns Vect2d

    • Parameters

      • obj: any

      Returns boolean

    Properties

    x: number = 0
    y: number = 0