Class Triangle

    • Constructor Summary

      Constructors 
      Constructor Description
      Triangle​(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3)
      Creates a Triangle.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(org.locationtech.jts.geom.Coordinate p)
      Returns whether this Triangle contains the given coordinate
      boolean equals​(Object o)
      Returns whether this Triangle has the same vertices as the given Triangle
      double getArea()
      Returns the area of the triangle.
      org.locationtech.jts.geom.Envelope getEnvelope()
      Returns the bounds of this Triangle.
      double getMaxSideLength()
      Returns the length of this Triangle's longest side.
      double getMinHeight()
      Returns the smallest of this Triangle's three heights (as measured perpendicularly from each side).
      org.locationtech.jts.geom.Coordinate getP1()
      Returns the first vertex.
      org.locationtech.jts.geom.Coordinate getP2()
      Returns the second vertex.
      org.locationtech.jts.geom.Coordinate getP3()
      Returns the third vertex.
      int hashCode()  
      boolean hasVertex​(org.locationtech.jts.geom.Coordinate v)
      Returns whether v is one of this Triangle's vertices.
      protected org.locationtech.jts.geom.Coordinate min​(org.locationtech.jts.geom.Coordinate a, org.locationtech.jts.geom.Coordinate b)  
      List subTriangles​(org.locationtech.jts.geom.Coordinate newVertex)
      Returns the three triangles that result from splitting this triangle at a given point.
      org.locationtech.jts.geom.Coordinate toEuclideanCoordinate​(org.locationtech.jts.geom.Coordinate simplicialCoordinate)
      Converts from a simplicial coordinate to a Euclidean coordinate.
      org.locationtech.jts.geom.LinearRing toLinearRing()
      Converts this Triangle to a JTS Geometry.
      org.locationtech.jts.geom.Coordinate toSimplicialCoordinate​(org.locationtech.jts.geom.Coordinate euclideanCoordinate)
      Converts from a Euclidean coordinate to a simplicial coordinate.
      String toString()  
    • Constructor Detail

      • Triangle

        public Triangle​(org.locationtech.jts.geom.Coordinate p1,
                        org.locationtech.jts.geom.Coordinate p2,
                        org.locationtech.jts.geom.Coordinate p3)
        Creates a Triangle.
        Parameters:
        p1 - one vertex
        p2 - another vertex
        p3 - another vertex
    • Method Detail

      • getP1

        public org.locationtech.jts.geom.Coordinate getP1()
        Returns the first vertex.
        Returns:
        the first vertex
      • getP2

        public org.locationtech.jts.geom.Coordinate getP2()
        Returns the second vertex.
        Returns:
        the second vertex
      • getP3

        public org.locationtech.jts.geom.Coordinate getP3()
        Returns the third vertex.
        Returns:
        the third vertex
      • getMinHeight

        public double getMinHeight()
        Returns the smallest of this Triangle's three heights (as measured perpendicularly from each side).
        Returns:
        the smallest of this Triangle's three altitudes
      • getArea

        public double getArea()
        Returns the area of the triangle. See http://www.mathcs.emory.edu/~rudolf/math108/summ1-2-3/node7.html
        Returns:
        the area of the triangle
      • getMaxSideLength

        public double getMaxSideLength()
        Returns the length of this Triangle's longest side.
        Returns:
        the length of this Triangle's longest side
      • toLinearRing

        public org.locationtech.jts.geom.LinearRing toLinearRing()
        Converts this Triangle to a JTS Geometry.
        Returns:
        a LinearRing with the same vertices as this Triangle
      • contains

        public boolean contains​(org.locationtech.jts.geom.Coordinate p)
        Returns whether this Triangle contains the given coordinate
        Parameters:
        p - the point to test for containment
        Returns:
        whether this Triangle contains the given coordinate
      • equals

        public boolean equals​(Object o)
        Returns whether this Triangle has the same vertices as the given Triangle
        Overrides:
        equals in class Object
        Parameters:
        o - another Triangle; otherwise, equals will return false
        Returns:
        true if o is a Triangle and has the same vertices (though not necessarily in the same order)
      • hasVertex

        public boolean hasVertex​(org.locationtech.jts.geom.Coordinate v)
        Returns whether v is one of this Triangle's vertices.
        Parameters:
        v - the candidate point
        Returns:
        whether v is equal to one of the vertices of this Triangle
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • subTriangles

        public List subTriangles​(org.locationtech.jts.geom.Coordinate newVertex)
        Returns the three triangles that result from splitting this triangle at a given point.
        Parameters:
        newVertex - the split point, which must be inside triangle
        Returns:
        three Triangles resulting from splitting this triangle at the given Coordinate
      • min

        protected org.locationtech.jts.geom.Coordinate min​(org.locationtech.jts.geom.Coordinate a,
                                                           org.locationtech.jts.geom.Coordinate b)
      • toSimplicialCoordinate

        public org.locationtech.jts.geom.Coordinate toSimplicialCoordinate​(org.locationtech.jts.geom.Coordinate euclideanCoordinate)
        Converts from a Euclidean coordinate to a simplicial coordinate.
        Parameters:
        euclideanCoordinate - the Euclidean coordinate
        Returns:
        a new 3D Coordinate with the corresponding simplicial values
      • toEuclideanCoordinate

        public org.locationtech.jts.geom.Coordinate toEuclideanCoordinate​(org.locationtech.jts.geom.Coordinate simplicialCoordinate)
        Converts from a simplicial coordinate to a Euclidean coordinate.
        Parameters:
        simplicialCoordinate - the simplicial coordinate, which uses x, y, and z
        Returns:
        a new Coordinate with the corresponding Euclidean values
      • getEnvelope

        public org.locationtech.jts.geom.Envelope getEnvelope()
        Returns the bounds of this Triangle.
        Returns:
        the smallest Envelope enclosing this Triangle