parsegraph-extent
TypeScript icon, indicating that this package has built-in type declarations

1.4.16 • Public • Published

parsegraph-extent

This module provides a class to manage separation between graphs. It is intended to be used in a set, with one extent managing a specific axis and direction. Methods are provided to calculate the minimum distance needed to separate two extents, as well as methods to combine two extents into a single extent that covers both.

import Extent from 'parsegraph-extent'

const rootNode = new Extent();
const forwardNode = new Extent();

rootNode.appendLS(50, 25);
forwardNode.appendLS(12, 6);
const separation = rootNode.separation(forwardNode);

const combined = rootNode.combinedExtent(forwardNode, 0, separation);

const expected = new Extent();
expected.appendLS(12, separation + 6);
expected.appendLS(38, 25);

assert.ok(expected.equals(combined), "Combining extents does not work.");

/parsegraph-extent/

    Package Sidebar

    Install

    npm i parsegraph-extent

    Weekly Downloads

    20

    Version

    1.4.16

    License

    MIT

    Unpacked Size

    78.6 kB

    Total Files

    16

    Last publish

    Collaborators

    • dafrito
    • tracy3