Class Line2D

  • Direct Known Subclasses:
    Segment2D

    public class Line2D
    extends java.lang.Object
    Consists of two points and represents line object
    • Constructor Summary

      Constructors 
      Constructor Description
      Line2D​(float x1, float y1, float x2, float y2)  
      Line2D​(android.graphics.PointF a, android.graphics.PointF b)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double distance​(android.graphics.PointF point)
      Calculates distance from a point to a line
      float getX1()  
      float getX2()  
      float getY1()  
      float getY2()  
      void set​(float x1, float y1, float x2, float y2)
      Sets coordinates of two points.
      void set​(android.graphics.PointF a, android.graphics.PointF b)
      Sets coordinates of two points
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Line2D

        public Line2D​(android.graphics.PointF a,
                      android.graphics.PointF b)
      • Line2D

        public Line2D​(float x1,
                      float y1,
                      float x2,
                      float y2)
    • Method Detail

      • getX1

        public float getX1()
        Returns:
        x coordinate of point 1
      • getY1

        public float getY1()
        Returns:
        y coordinate of point 1
      • getX2

        public float getX2()
        Returns:
        x coordinate of point 2
      • getY2

        public float getY2()
        Returns:
        y coordinate of point 1
      • set

        public final void set​(float x1,
                              float y1,
                              float x2,
                              float y2)
        Sets coordinates of two points.
        Parameters:
        x1 - x coordinate of first point.
        y1 - y coordinate of first point.
        x2 - x coordinate of second point.
        y2 - y coordinate of second point.
      • set

        public final void set​(android.graphics.PointF a,
                              android.graphics.PointF b)
        Sets coordinates of two points
        Parameters:
        a - first point.
        b - second point.
      • distance

        public double distance​(android.graphics.PointF point)
        Calculates distance from a point to a line
        Parameters:
        point - point from distance is calculated.
        Returns:
        distance to line