Class HalfPlane

  • All Implemented Interfaces:
    Shapeable, java.io.Serializable, java.lang.Comparable

    public class HalfPlane
    extends Line

    A half plane divides the 2d-space in two subspaces being divided at a certain infinite line. This implementation holds a coordinate representation of this line. It evaluates coordinates of being inside by computing a normal vector pointing out of the inner half space and a corresponding double scalar to scale the half plane away from the origin.


    Now we want to explore, how we compute a vector laying inside the inner half space in inside(Coordinate):

    So we state that a is the normal vector pointing out of the inner half space, b is the scalar and x is the vector to test.

    If evaluation is strict, the test evaluates true, if

    ⟨ a, x ⟩ > b.

    Else, it already evaluates true, if the following statement is true:

    ⟨ a, x ⟩ ≥ b.

    The half plane is represented as an infinite line in coordinate form. To perform inside(Coordinate), we compute the corresponding normal vector and scalar. For two coordinates c1 and c2, the inner half space lies on the right-hand-side of the vector from c1 to c2.

    See Also:
    inside(Coordinate), Serialized Form
    • Field Summary

      • Fields inherited from class org.locationtech.jts.geom.LineSegment

        p0, p1
    • Constructor Summary

      Constructors 
      Constructor Description
      HalfPlane​(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2)
      Convenience constructor for non-strict half planes.
      HalfPlane​(org.locationtech.jts.geom.Coordinate c1, org.locationtech.jts.geom.Coordinate c2, boolean strict)
      Default constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canEqual​(java.lang.Object other)  
      boolean equals​(java.lang.Object o)  
      static HalfPlane from​(org.locationtech.jts.math.Vector2D normal, double scalar)
      Construct a HalfPlane with its normal vector and its scalar.
      int hashCode()  
      boolean inside​(org.locationtech.jts.geom.Coordinate c)
      Evaluates, if a location vector of a point lies in the inner half space.
      For strict half planes, it must satisfy the following condition: ⟨ a, x ⟩ > b, otherwise, it tests the condition: ⟨ a, x ⟩ ≥ b.
      java.awt.Shape toShape​(AdvancedShapeWriter shapeWriter)
      Transfers the emerging polygon to a shape for rendering.
      • Methods inherited from class org.locationtech.jts.geom.LineSegment

        angle, closestPoint, closestPoints, compareTo, distance, distance, distancePerpendicular, equalsTopo, getCoordinate, isHorizontal, isVertical, lineIntersection, maxX, maxY, midPoint, midPoint, minX, minY, normalize, orientationIndex, orientationIndex, pointAlong, pointAlongOffset, project, project, projectionFactor, reverse, segmentFraction, setCoordinates, setCoordinates, toGeometry, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HalfPlane

        public HalfPlane​(org.locationtech.jts.geom.Coordinate c1,
                         org.locationtech.jts.geom.Coordinate c2,
                         boolean strict)
        Default constructor. The half plane divides the space in two sections. The side, that the method inside(Coordinate) evaluates true on is on the right side of the vector from c1 to c2.
        Parameters:
        c1 - first coordinate the half planes line is going through
        c2 - second coordinate the half planes line is going through
        strict - whether points on the line are not inside the half plane
      • HalfPlane

        public HalfPlane​(org.locationtech.jts.geom.Coordinate c1,
                         org.locationtech.jts.geom.Coordinate c2)
        Convenience constructor for non-strict half planes.
        Parameters:
        c1 - first coordinate the half planes line is going through
        c2 - second coordinate the half planes line is going through
    • Method Detail

      • from

        public static HalfPlane from​(org.locationtech.jts.math.Vector2D normal,
                                     double scalar)
        Construct a HalfPlane with its normal vector and its scalar. The vector and scalar are the matrix representation components of the half plane. These components are directly involved in determining, if a coordinate lies inside the half lane.
        Parameters:
        normal - normal vector of the half plane pointing outwards
        scalar - scalar for translating the half plane away from the origin point
        Returns:
        a half plane in coordinate representation
        See Also:
        inside(Coordinate)
      • inside

        public boolean inside​(org.locationtech.jts.geom.Coordinate c)
        Evaluates, if a location vector of a point lies in the inner half space.
        For strict half planes, it must satisfy the following condition: ⟨ a, x ⟩ > b, otherwise, it tests the condition: ⟨ a, x ⟩ ≥ b.
        Parameters:
        c - coordinate to test
        Returns:
        whether the coordinate lays in the inner half space
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class org.locationtech.jts.geom.LineSegment
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class org.locationtech.jts.geom.LineSegment