Class Line2D

  • All Implemented Interfaces:
    Component2D

    public final class Line2D
    extends Object
    implements Component2D
    2D geo line implementation represented as a balanced interval tree of edges.

    Line Line2D Construction takes O(n log n) time for sorting and tree construction. relate() are O(n), but for most practical lines are much faster than brute force.

    • Method Detail

      • getMinX

        public double getMinX()
        Description copied from interface: Component2D
        min X value for the component
        Specified by:
        getMinX in interface Component2D
      • getMaxX

        public double getMaxX()
        Description copied from interface: Component2D
        max X value for the component
        Specified by:
        getMaxX in interface Component2D
      • getMinY

        public double getMinY()
        Description copied from interface: Component2D
        min Y value for the component
        Specified by:
        getMinY in interface Component2D
      • getMaxY

        public double getMaxY()
        Description copied from interface: Component2D
        max Y value for the component
        Specified by:
        getMaxY in interface Component2D
      • contains

        public boolean contains​(double x,
                                double y)
        Description copied from interface: Component2D
        relates this component2D with a point
        Specified by:
        contains in interface Component2D
      • relate

        public PointValues.Relation relate​(double minX,
                                           double maxX,
                                           double minY,
                                           double maxY)
        Description copied from interface: Component2D
        relates this component2D with a bounding box
        Specified by:
        relate in interface Component2D
      • relateTriangle

        public PointValues.Relation relateTriangle​(double minX,
                                                   double maxX,
                                                   double minY,
                                                   double maxY,
                                                   double ax,
                                                   double ay,
                                                   double bx,
                                                   double by,
                                                   double cx,
                                                   double cy)
        Description copied from interface: Component2D
        relates this component2D with a triangle
        Specified by:
        relateTriangle in interface Component2D
      • withinTriangle

        public Component2D.WithinRelation withinTriangle​(double minX,
                                                         double maxX,
                                                         double minY,
                                                         double maxY,
                                                         double ax,
                                                         double ay,
                                                         boolean ab,
                                                         double bx,
                                                         double by,
                                                         boolean bc,
                                                         double cx,
                                                         double cy,
                                                         boolean ca)
        Description copied from interface: Component2D
        Compute the within relation of this component2D with a triangle
        Specified by:
        withinTriangle in interface Component2D
      • create

        public static Component2D create​(Line... lines)
        create a Line2D edge tree from provided array of Linestrings
      • create

        public static Component2D create​(XYLine... lines)
        create a Line2D edge tree from provided array of Linestrings