Sums width/height of b with a (ie: a + b), returning result.

import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";
const rectA = { width: 100, height: 100 };
const rectB = { width: 200, height: 200 };

// Yields: { width: 300, height: 300 }
Rects.sum(rectA, rectB);
Rects.sum(rectA, 200, 200);
  • Sums width/height of b with a (ie: a + b), returning result.

    import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";
    const rectA = { width: 100, height: 100 };
    const rectB = { width: 200, height: 200 };

    // Yields: { width: 300, height: 300 }
    Rects.sum(rectA, rectB);

    Parameters

    Returns Rect

  • Sums width/height of b with a, returning result.

    Note that width/height of b is also added to a's x & y properties

    // Yields: { x:101, y:202, width: 110, height: 220 }
    sum({x:1, y:2, width:10, height:20}, {width:100, height: 200});

    x & y values of b are ignored. If you want to sum with those, use sumOffset

    Parameters

    Returns RectPositioned

  • Sums width/height of rect with given width and height

    import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";
    const rect = { width: 100, height: 100 };

    // Yields: { width: 300, height: 300 }
    Rects.subtract(rect, 200, 200);

    Parameters

    • rect: Rect
    • width: number
    • height: number

    Returns Rect

  • Sums width/height of rect with width and height

    width and height is added to rect's x and y values.

    // Yields: { x:101, y:202, width: 110, height: 220 }
    sum({x:1, y:2, width:10, height:20}, 100, 200);

    Parameters

    Returns RectPositioned