All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class CH.ifa.draw.util.Geom

java.lang.Object
   |
   +----CH.ifa.draw.util.Geom

public class Geom
extends Object
Some geometric utilities.


Variable Index

 o EAST
 o NORTH
 o SOUTH
 o WEST

Method Index

 o angleToPoint(Rectangle, double)
Gets the point on a rectangle that corresponds to the given angle.
 o center(Rectangle)
 o direction(int, int, int, int)
Returns the direction NORTH, SOUTH, WEST, EAST from one point to another one.
 o east(Rectangle)
 o intersect(int, int, int, int, int, int, int, int)
Standard line intersection algorithm Return the point of intersection if it exists, else null
 o length(int, int, int, int)
Gets the distance between to points
 o length2(int, int, int, int)
Gets the square distance between two points.
 o lineContainsPoint(int, int, int, int, int, int)
Tests if a point is on a line.
 o north(Rectangle)
 o ovalAngleToPoint(Rectangle, double)
Gets the point on an oval that corresponds to the given angle.
 o pointToAngle(Rectangle, Point)
Gets the angle of a point relative to a rectangle.
 o polarToPoint(double, double, double)
Converts a polar to a point
 o range(int, int, int)
Constains a value to the given range.
 o south(Rectangle)
 o west(Rectangle)

Variables

 o NORTH
 public static final int NORTH
 o SOUTH
 public static final int SOUTH
 o WEST
 public static final int WEST
 o EAST
 public static final int EAST

Methods

 o 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.

 o 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.

 o south
 public static Point south(Rectangle r)
 o center
 public static Point center(Rectangle r)
 o west
 public static Point west(Rectangle r)
 o east
 public static Point east(Rectangle r)
 o north
 public static Point north(Rectangle r)
 o range
 public static int range(int min,
                         int max,
                         int value)
Constains a value to the given range.

Returns:
the constrained value
 o length2
 public static long length2(int x1,
                            int y1,
                            int x2,
                            int y2)
Gets the square distance between two points.

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

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

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

 o polarToPoint
 public static Point polarToPoint(double angle,
                                  double fx,
                                  double fy)
Converts a polar to a point

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

 o intersect
 public static 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


All Packages  Class Hierarchy  This Package  Previous  Next  Index