A Topology instance offers a number of geometric operations for a particular topology. Currently only the calculation of intersections between two Shape instances is supported.

Instances of this interface must be created using the factory methods from the TopologyFactory module.

Hierarchy

  • Topology

Methods

  • Calculates intersection points between two Shape instances. The intersection points are returned in an array. For each intersection point, for each shape, the segments on which the intersection occurs are returned. Segments are two consecutive points in a shape, expect if the shape is a Point. The format of the response is illustrated in the example below, where a line is intersected with a square.

        ^
    |
    9 + +-----------------------+
    | | |
    | | |
    | (3,6) | | (9, 6)
    6 + ====+=======================+====
    | | |
    | | |
    | | |
    3 + +-----------------------+
    |
    |
    |
    +---+---+---+---+---+---+---+---+---+---+---->
    3 9
    var polyline = createPolyline(ref, [
    createPoint(ref, [2, 6]),
    createPoint(ref, [10, 6])
    ]);
    var polygon = createPolygon(ref, [
    createPoint(ref, [3, 3]),
    createPoint(ref, [3, 9]),
    createPoint(ref, [9, 9]),
    createPoint(ref, [9, 3])
    ]);
    var result = topology.calculateIntersections(polyline, polygon);

    result is an array with meta data for two intersection points:

    [
    {
    intersectionPoint: luciad.shape.Point<3, 6>,
    intersectionSegments: [
    {
    shape: luciad.shape.Polyline[<2, 6>, <10, 6>],
    points: [luciad.shape.Point<2, 6>, luciad.shape.Point<10, 6>]
    },
    {
    shape: luciad.shape.Polygon[<3, 3>, <3, 9>, <9, 9>, <9, 3>],
    points: [luciad.shape.Point<3, 3>, luciad.shape.Point<3, 9>]
    }
    ]
    },
    {
    intersectionPoint: luciad.shape.Point<9, 6>,
    intersectionSegments: [
    {
    shape: luciad.shape.Polyline[<2, 6>, <10, 6>],
    points: [luciad.shape.Point<2, 6>, luciad.shape.Point<10, 6>]
    },
    {
    shape: luciad.shape.Polygon[<3, 3>, <3, 9>, <9, 9>, <9, 3>],
    points: [luciad.shape.Point<9, 9>, luciad.shape.Point<9, 3>]
    }
    ]
    }
    ]

    Parameters

    • shape0: Shape

      The first shape to be intersected.

    • shape1: Shape

      The second shape to be intersected.

    Returns Intersection[]

    An array of intersection point metadata.