Class PolarPoint


  • public class PolarPoint
    extends java.lang.Object
    A polar point in a standard polar coordinates system.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int r
      The radial coordinate
      double theta
      The angular coordinate in radians
    • Constructor Summary

      Constructors 
      Constructor Description
      PolarPoint​(int r, double theta)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      static PolarPoint point2PolarPoint​(org.eclipse.draw2d.geometry.Point pole, org.eclipse.draw2d.geometry.Point point)
      convert a point to polar point
      void rotateAxis​(double axisDirection, boolean inRadians)
      rotate the x axis of the polar coordinate system to the axisDirection
      org.eclipse.draw2d.geometry.Point toAbsolutePoint​(org.eclipse.draw2d.geometry.Rectangle rect)
      Transform the polar point to the Point in the absolute coordinate system.
      org.eclipse.draw2d.geometry.Point toPoint()
      Transform the polar point to the Point in rectangular coordinates.
      org.eclipse.draw2d.geometry.Point toRelativePoint​(org.eclipse.draw2d.geometry.Rectangle rect)
      Transform the polar point to the Point in the relative coordinate system, whose origin is (rect.x, rect.y).
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • r

        public int r
        The radial coordinate
      • theta

        public double theta
        The angular coordinate in radians
    • Constructor Detail

      • PolarPoint

        public PolarPoint​(int r,
                          double theta)
        Parameters:
        r - The radial coordinate
        theta - The angular coordinate in radians
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toPoint

        public org.eclipse.draw2d.geometry.Point toPoint()
        Transform the polar point to the Point in rectangular coordinates. The rectangular coordinates has the same origin as the polar coordinates.
        Returns:
        the point in rectangular coordinates
      • toAbsolutePoint

        public org.eclipse.draw2d.geometry.Point toAbsolutePoint​(org.eclipse.draw2d.geometry.Rectangle rect)
        Transform the polar point to the Point in the absolute coordinate system. It is assumed that the origin of the polar coordinate system is the central point of the rectangle.
        Parameters:
        rect - the paint area of the figure
        Returns:
        the point in absolute coordinate system.
      • toRelativePoint

        public org.eclipse.draw2d.geometry.Point toRelativePoint​(org.eclipse.draw2d.geometry.Rectangle rect)
        Transform the polar point to the Point in the relative coordinate system, whose origin is (rect.x, rect.y). It is assumed that the origin of the polar coordinate system is the central point of the rectangle.
        Parameters:
        rect - the paint area of the figure
        Returns:
        the point in relative coordinate system.
      • point2PolarPoint

        public static PolarPoint point2PolarPoint​(org.eclipse.draw2d.geometry.Point pole,
                                                  org.eclipse.draw2d.geometry.Point point)
        convert a point to polar point
        Parameters:
        pole - the pole of the polar coordinate system.
        point - the point to be converted
        Returns:
        the corresponding polar point.
      • rotateAxis

        public void rotateAxis​(double axisDirection,
                               boolean inRadians)
        rotate the x axis of the polar coordinate system to the axisDirection
        Parameters:
        axisDirection - the direction of the new axis
        inRadians - true if the axisDirection is in radians, false if in degrees.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object