Nutrient Web SDK
    Preparing search index...

    Interface TransformationMatrix

    Matrix for affine 2D transformations.

    Layout:

            // The values represent:
    

    | a c e | // - (a,b) the x base vector | b d f | // - (c,d) the y base vector | 0 0 1 | // - (e,f) the origin // of the resulting coordinate system.

    The third row is always [0 0 1], thus we don't store the values.

    interface TransformationMatrix {
        a: number;
        b: number;
        c: number;
        d: number;
        e: number;
        f: number;
        "[iterator]"(): IterableIterator<
            ["b" | "a" | "c" | "d" | "e" | "f", number],
        >;
        applyToPoint(__namedParameters: [number, number]): [number, number];
        applyToVector(__namedParameters: [number, number]): [number, number];
        asImmutable(): this;
        asMutable(): this;
        clear(): this;
        delete<K extends "b" | "a" | "c" | "d" | "e" | "f">(key: K): this;
        deleteIn(keyPath: Iterable<any>): this;
        equals(other: any): boolean;
        get<K extends "b" | "a" | "c" | "d" | "e" | "f">(
            key: K,
            notSetValue?: any,
        ): { a: number; b: number; c: number; d: number; e: number; f: number }[K];
        get<T>(key: string, notSetValue: T): T;
        getIn(keyPath: Iterable<any>): any;
        has(key: string): key is "b" | "a" | "c" | "d" | "e" | "f";
        hashCode(): number;
        hasIn(keyPath: Iterable<any>): boolean;
        inverse(): TransformationMatrix;
        merge(
            ...collections: (
                | Iterable<[string, any]>
                | Partial<
                    { a: number; b: number; c: number; d: number; e: number; f: number },
                >
            )[],
        ): this;
        mergeDeep(
            ...collections: (
                | Iterable<[string, any]>
                | Partial<
                    { a: number; b: number; c: number; d: number; e: number; f: number },
                >
            )[],
        ): this;
        mergeDeepIn(keyPath: Iterable<any>, ...collections: any[]): this;
        mergeDeepWith(
            merger: (oldVal: any, newVal: any, key: any) => any,
            ...collections: (
                | Iterable<[string, any]>
                | Partial<
                    { a: number; b: number; c: number; d: number; e: number; f: number },
                >
            )[],
        ): this;
        mergeIn(keyPath: Iterable<any>, ...collections: any[]): this;
        mergeWith(
            merger: (
                oldVal: any,
                newVal: any,
                key: "b" | "a" | "c" | "d" | "e" | "f",
            ) => any,
            ...collections: (
                | Iterable<[string, any]>
                | Partial<
                    { a: number; b: number; c: number; d: number; e: number; f: number },
                >
            )[],
        ): this;
        remove<K extends "b" | "a" | "c" | "d" | "e" | "f">(key: K): this;
        removeIn(keyPath: Iterable<any>): this;
        rotate(degCW: number): TransformationMatrix;
        rotateRad(a: number): TransformationMatrix;
        scale(sx: number, sy?: number): TransformationMatrix;
        set<K extends "b" | "a" | "c" | "d" | "e" | "f">(
            key: K,
            value: {
                a: number;
                b: number;
                c: number;
                d: number;
                e: number;
                f: number;
            }[K],
        ): this;
        setIn(keyPath: Iterable<any>, value: any): this;
        toCssValue(): string;
        toJS(): { a: any; b: any; c: any; d: any; e: any; f: any };
        toJSON(): {
            a: number;
            b: number;
            c: number;
            d: number;
            e: number;
            f: number;
        };
        toObject(): {
            a: number;
            b: number;
            c: number;
            d: number;
            e: number;
            f: number;
        };
        toSeq(): Keyed<"b" | "a" | "c" | "d" | "e" | "f", number>;
        transform(
            a2: number,
            b2: number,
            c2: number,
            d2: number,
            e2: number,
            f2: number,
        ): TransformationMatrix;
        translate(
            __namedParameters: { x: number; y: number },
        ): TransformationMatrix;
        translateX(tx: number): TransformationMatrix;
        translateY(ty: number): TransformationMatrix;
        update<K extends "b" | "a" | "c" | "d" | "e" | "f">(
            key: K,
            updater: (
                value: {
                    a: number;
                    b: number;
                    c: number;
                    d: number;
                    e: number;
                    f: number;
                }[K],
            ) => { a: number; b: number; c: number; d: number; e: number; f: number }[K],
        ): this;
        updateIn(keyPath: Iterable<any>, updater: (value: any) => any): this;
        wasAltered(): boolean;
        withMutations(mutator: (mutable: this) => any): this;
    }

    Hierarchy

    • Record<
          { a: number; b: number; c: number; d: number; e: number; f: number },
          this,
      > & Readonly<
          { a: number; b: number; c: number; d: number; e: number; f: number },
      >
      • TransformationMatrix
    Index

    Properties

    a: number
    b: number
    c: number
    d: number
    e: number
    f: number

    Methods

    • Returns IterableIterator<["b" | "a" | "c" | "d" | "e" | "f", number]>

    • Multiplies the point with the matrix to apply the transformation. Transforming a "point" means also applying any translation from the matrix.

      | x'| | a c e | | x | | y'| = | b d f | * | y | | 1 | | 0 0 1 | | 1 |

      Parameters

      • __namedParameters: [number, number]

      Returns [number, number]

    • Multiplies the vector with the matrix to apply the transformation. Transforming a "vector" does ignore the translation of the matrix.

      | x'| | a c e | | x | | y'| = | b d f | * | y | | 0 | | 0 0 1 | | 0 |

      Parameters

      • __namedParameters: [number, number]

      Returns [number, number]

    • Returns this

      Map#asImmutable

    • Returns this

      Map#asMutable

    • Returns a new instance of this Record type with all values set to their default values.

      Returns this

    • Returns a new instance of this Record type with the value for the specific key set to its default value.

      Type Parameters

      • K extends "b" | "a" | "c" | "d" | "e" | "f"

      Parameters

      • key: K

      Returns this

      remove

    • Parameters

      Returns this

      removeIn

    • Parameters

      • other: any

      Returns boolean

    • Returns the value associated with the provided key, which may be the default value defined when creating the Record factory function.

      If the requested key is not defined by this Record type, then notSetValue will be returned if provided. Note that this scenario would produce an error when using Flow or TypeScript.

      Type Parameters

      • K extends "b" | "a" | "c" | "d" | "e" | "f"

      Parameters

      • key: K
      • OptionalnotSetValue: any

      Returns { a: number; b: number; c: number; d: number; e: number; f: number }[K]

    • Type Parameters

      • T

      Parameters

      • key: string
      • notSetValue: T

      Returns T

    • Parameters

      Returns any

    • Parameters

      • key: string

      Returns key is "b" | "a" | "c" | "d" | "e" | "f"

    • Returns number

    • Parameters

      Returns boolean

    • Calculates the inverse matrix. This requires the determinant to be != 0, which is always granted since the matrix can only hold affine transformations (all affine transformations are easily invertible).

      We exploit the fact that the matrix is affine to speed things up.

      Returns TransformationMatrix

    • Parameters

      • ...collections: (
            | Iterable<[string, any]>
            | Partial<
                { a: number; b: number; c: number; d: number; e: number; f: number },
            >
        )[]

      Returns this

    • Parameters

      • ...collections: (
            | Iterable<[string, any]>
            | Partial<
                { a: number; b: number; c: number; d: number; e: number; f: number },
            >
        )[]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • ...collections: any[]

      Returns this

    • Parameters

      • merger: (oldVal: any, newVal: any, key: any) => any
      • ...collections: (
            | Iterable<[string, any]>
            | Partial<
                { a: number; b: number; c: number; d: number; e: number; f: number },
            >
        )[]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • ...collections: any[]

      Returns this

    • Parameters

      • merger: (oldVal: any, newVal: any, key: "b" | "a" | "c" | "d" | "e" | "f") => any
      • ...collections: (
            | Iterable<[string, any]>
            | Partial<
                { a: number; b: number; c: number; d: number; e: number; f: number },
            >
        )[]

      Returns this

    • Type Parameters

      • K extends "b" | "a" | "c" | "d" | "e" | "f"

      Parameters

      • key: K

      Returns this

    • Parameters

      Returns this

    • Rotates the matrix by deg degrees in the xy-plane clockwise about the origin of the Cartesian coordinate system.

      Parameters

      • degCW: number

      Returns TransformationMatrix

    • Rotates the matrix by rad radian in the xy-plane clockwise about the origin of the Cartesian coordinate system.

      Parameters

      • a: number

      Returns TransformationMatrix

    • Applies a scaling to the matrix. If only sx is set and sy is undefined, we will scale x and y by sx.

      A scale of 1 does not modify a dimension.

           | sx  0  0 |
      

      M' = M * | 0 sy 0 | | 0 0 1 |

      Parameters

      • sx: number
      • Optionalsy: number

      Returns TransformationMatrix

    • Type Parameters

      • K extends "b" | "a" | "c" | "d" | "e" | "f"

      Parameters

      • key: K
      • value: { a: number; b: number; c: number; d: number; e: number; f: number }[K]

      Returns this

    • Parameters

      Returns this

    • Returns the matrix's values as a CSS transform string.

      Returns string

    • Deeply converts this Record to equivalent native JavaScript Object.

      Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead.

      Returns { a: any; b: any; c: any; d: any; e: any; f: any }

    • Shallowly converts this Record to equivalent native JavaScript Object.

      Returns { a: number; b: number; c: number; d: number; e: number; f: number }

    • Shallowly converts this Record to equivalent JavaScript Object.

      Returns { a: number; b: number; c: number; d: number; e: number; f: number }

    • Returns Keyed<"b" | "a" | "c" | "d" | "e" | "f", number>

    • Multiplies current matrix values with a new transformation matrix.

      The transformation will be applied on the left side of the multiplication, so that they are applied in the order transform() is called.

      | a' c' e' | | a2 c2 e2 | | a c e | | b' d' f' | = | b2 d2 f2 | * | b d f | | 0 0 1 | | 0 0 1 | | 0 0 1 |

      Parameters

      • a2: number
      • b2: number
      • c2: number
      • d2: number
      • e2: number
      • f2: number

      Returns TransformationMatrix

    • Applies a translation to the matrix

           | 1 0 tx |
      

      M' = M * | 0 1 ty | | 0 0 1 |

      Parameters

      • __namedParameters: { x: number; y: number }

      Returns TransformationMatrix

    • Type Parameters

      • K extends "b" | "a" | "c" | "d" | "e" | "f"

      Parameters

      • key: K
      • updater: (
            value: {
                a: number;
                b: number;
                c: number;
                d: number;
                e: number;
                f: number;
            }[K],
        ) => { a: number; b: number; c: number; d: number; e: number; f: number }[K]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • updater: (value: any) => any

      Returns this

    • Returns boolean

      Map#wasAltered

    • Note: Not all methods can be used on a mutable collection or within withMutations! Only set may be used mutatively.

      Parameters

      • mutator: (mutable: this) => any

      Returns this

      Map#withMutations