Documentation of 'CH.ifa.draw.util.Geom' Java class
Geom
CH.ifa.draw.util

Class Geom



  • public class Geom
    extends java.lang.Object
    Some geometric utilities.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int EAST 
      static int NORTH 
      static int SOUTH 
      static int WEST 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.awt.Point angleToPoint(java.awt.Rectangle r, double angle)
      Gets the point on a rectangle that corresponds to the given angle.
      static java.awt.Point center(java.awt.Rectangle r) 
      static int direction(int x1, int y1, int x2, int y2)
      Returns the direction NORTH, SOUTH, WEST, EAST from one point to another one.
      static java.awt.Point east(java.awt.Rectangle r) 
      static java.awt.Point intersect(int xa, int ya, int xb, int yb, int xc, int yc, int xd, int yd)
      Standard line intersection algorithm Return the point of intersection if it exists, else null
      static long length(int x1, int y1, int x2, int y2)
      Gets the distance between to points
      static long length2(int x1, int y1, int x2, int y2)
      Gets the square distance between two points.
      static boolean lineContainsPoint(int x1, int y1, int x2, int y2, int px, int py)
      Tests if a point is on a line.
      static java.awt.Point north(java.awt.Rectangle r) 
      static java.awt.Point ovalAngleToPoint(java.awt.Rectangle r, double angle)
      Gets the point on an oval that corresponds to the given angle.
      static double pointToAngle(java.awt.Rectangle r, java.awt.Point p)
      Gets the angle of a point relative to a rectangle.
      static java.awt.Point polarToPoint(double angle, double fx, double fy)
      Converts a polar to a point
      static int range(int min, int max, int value)
      Constains a value to the given range.
      static java.awt.Point south(java.awt.Rectangle r) 
      static java.awt.Point west(java.awt.Rectangle r) 
      • Methods inherited from class java.lang.Object

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

      • lineContainsPoint

        public static boolean lineContainsPoint(int x1,
                                                int y1,
                                                int x2,
                                                int y2,
                                                int px,
                                                int py)
        Tests if a point is on a line.
      • direction

        public static int direction(int x1,
                                    int y1,
                                    int x2,
                                    int y2)
        Returns the direction NORTH, SOUTH, WEST, EAST from one point to another one.
      • south

        public static java.awt.Point south(java.awt.Rectangle r)
      • center

        public static java.awt.Point center(java.awt.Rectangle r)
      • west

        public static java.awt.Point west(java.awt.Rectangle r)
      • east

        public static java.awt.Point east(java.awt.Rectangle r)
      • north

        public static java.awt.Point north(java.awt.Rectangle r)
      • range

        public static int range(int min,
                                int max,
                                int value)
        Constains a value to the given range.
        Returns:
        the constrained value
      • length2

        public static long length2(int x1,
                                   int y1,
                                   int x2,
                                   int y2)
        Gets the square distance between two points.
      • length

        public static long length(int x1,
                                  int y1,
                                  int x2,
                                  int y2)
        Gets the distance between to points
      • pointToAngle

        public static double pointToAngle(java.awt.Rectangle r,
                                          java.awt.Point p)
        Gets the angle of a point relative to a rectangle.
      • angleToPoint

        public static java.awt.Point angleToPoint(java.awt.Rectangle r,
                                                  double angle)
        Gets the point on a rectangle that corresponds to the given angle.
      • polarToPoint

        public static java.awt.Point polarToPoint(double angle,
                                                  double fx,
                                                  double fy)
        Converts a polar to a point
      • ovalAngleToPoint

        public static java.awt.Point ovalAngleToPoint(java.awt.Rectangle r,
                                                      double angle)
        Gets the point on an oval that corresponds to the given angle.
      • intersect

        public static java.awt.Point intersect(int xa,
                                               int ya,
                                               int xb,
                                               int yb,
                                               int xc,
                                               int yc,
                                               int xd,
                                               int yd)
        Standard line intersection algorithm Return the point of intersection if it exists, else null

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.