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

    Variable PointConst

    Point: {
        new(xOrPt?: number | PointType, y?: number): PointType;
        set(pt: PointType, xOrPt: number | PointType, y?: number): PointType;
        setFromXY(pt: PointType, x: number, y?: number): PointType;
        setFromPt(pt: PointType, fromPt: PointType): PointType;
        isNull(pt: PointType): boolean;
        fuzzyIsNull(pt: PointType, epsilon?: number): boolean;
        plus_eq(pt: PointType, xOrPt: number | PointType, y?: number): PointType;
        plus(pt: PointType, xOrPt: number | PointType, y?: number): PointType;
        times_eq(pt: PointType, xOrPt: number | PointType, y?: number): PointType;
        times(pt: PointType, xOrPt: number | PointType, y?: number): PointType;
        transpose(pt: PointType): PointType;
        transposed(pt: PointType): PointType;
        equals(pt: PointType, xOrPt: number | PointType, y?: number): boolean;
        fuzzyEquals(pt: PointType, other: PointType, epsilon?: number): boolean;
        toString(pt: PointType, name?: string): string;
    } = ...

    Point is a static/const container for helper functions to deal with PointType objects, such as creating them or doing math operations. Benchmarks show 40x(!) faster performance when creating plain objects vs. classes/function prototypes, although once any members are accessed, the difference drops to "only" 2-3 improvement. The performance difference of using instance methods vs. static functions (like provided here) is less significant. So in some cases the convenience may outweigh the creation cost. Generally, read-only access if faster on plain objects vs. class instances, while changing property values is faster on the latter. Point could be converted to a class with static methods, which in some cases seems to perform (a little) better or (much) worse depending on the operation and what is being operated on (plain object or Vect2d class instance), and perhaps other factors.

    Type declaration

    • new: function
      • Returns a new PointType object with x and y set from number value(s) or another PointType object. When no arguments are used, the default is 0 for both x and y.

        Parameters

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

        Returns PointType

    • set: function
      • Sets the x and y values of a PointType 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'.

        Parameters

        Returns PointType

    • setFromXY: function
    • setFromPt: function
    • isNull: function
      • Returns true if both x and y values of pt are zero.

        Parameters

        Returns boolean

    • fuzzyIsNull: function
      • Returns true if both x and y values of pt are within epsilon delta of zero.

        Parameters

        Returns boolean

    • plus_eq: function
    • plus: function
    • times_eq: function
    • times: function
    • transpose: function
    • transposed: function
    • equals: function
      • Returns true is this PointType equals the given PointType or x & y values.

        Parameters

        Returns boolean

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

        Parameters

        Returns boolean

    • toString: function
      • Parameters

        Returns string