math.geom2d.polygon
Class HalfPlane2D

java.lang.Object
  extended by math.geom2d.polygon.HalfPlane2D
All Implemented Interfaces:
java.awt.Shape, Domain2D, Shape2D

public class HalfPlane2D
extends java.lang.Object
implements Domain2D

a Half-plane, delimited by a straight line.


Field Summary
protected  StraightLine2D line
           
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY, defaultClipWindow, EMPTY_SET
 
Constructor Summary
HalfPlane2D(StraightObject2D line)
          Main constructor
 
Method Summary
 Shape2D clip(Box2D box)
          Clip the shape with the given box, and returns a new shape.
 boolean contains(double x, double y)
          Tests if the point lies inside the halfplane.
 boolean contains(double x, double y, double w, double h)
          Tests if the given rectangle lies completely inside the halfplane.
 boolean contains(java.awt.geom.Point2D p)
          Tests if the point lies inside the halfplane.
 boolean contains(java.awt.geom.Rectangle2D r)
          Tests if the given rectangle lies completely inside the halfplane.
 Boundary2D getBoundary()
          Returns the straight line that defines the limit of this half-plane.
 Box2D getBoundingBox()
          Return the bounding box of the half-plane.
 java.awt.Rectangle getBounds()
          Return bounding box of the shape.
 java.awt.geom.Rectangle2D getBounds2D()
          Return more precise bounds for the shape.
 double getDistance(double x, double y)
          Gets the distance of the point to the half-plane.
 double getDistance(java.awt.geom.Point2D p)
          Gets the distance of the point to the half-plane.
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform t)
          Returns PathIterator of halfplane clipped by the default clipping window.
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform t, double flatness)
          Returns PathIterator of halfplane clipped by the default clipping window.
 double getSignedDistance(java.awt.geom.Point2D p)
          Gets the signed distance of the point to this half-plane.
 boolean intersects(double x, double y, double w, double h)
          Tests if the half-plane intersects the given rectangle.
 boolean intersects(java.awt.geom.Rectangle2D r)
          Tests if the half-plane intersects the given rectangle.
 boolean isBounded()
          Always returns false, because a half-plane is not bounded.
 HalfPlane2D transform(AffineTransform2D trans)
          Return the new HalfPlane created by an affine transform of this halfplane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

line

protected StraightLine2D line
Constructor Detail

HalfPlane2D

public HalfPlane2D(StraightObject2D line)
Main constructor

Method Detail

getBoundary

public Boundary2D getBoundary()
Returns the straight line that defines the limit of this half-plane.

Specified by:
getBoundary in interface Domain2D
Returns:
the boundary of the domain

isBounded

public boolean isBounded()
Always returns false, because a half-plane is not bounded.

Specified by:
isBounded in interface Shape2D

getDistance

public double getDistance(java.awt.geom.Point2D p)
Gets the distance of the point to the half-plane. This distance is zero if the point lies inside the plane.

Specified by:
getDistance in interface Shape2D

getDistance

public double getDistance(double x,
                          double y)
Gets the distance of the point to the half-plane. This distance is zero if the point lies inside the plane.

Specified by:
getDistance in interface Shape2D

getSignedDistance

public double getSignedDistance(java.awt.geom.Point2D p)
Gets the signed distance of the point to this half-plane. Result is negative if the point lies inside the half-plane. In this case, absolute value of the distance equals the distance to the limiting line.


clip

public Shape2D clip(Box2D box)
Description copied from interface: Shape2D
Clip the shape with the given box, and returns a new shape.

Specified by:
clip in interface Shape2D
Parameters:
box - the clipping box
Returns:
the clipped shape

transform

public HalfPlane2D transform(AffineTransform2D trans)
Return the new HalfPlane created by an affine transform of this halfplane.

Specified by:
transform in interface Shape2D
Parameters:
trans - an affine transform
Returns:
the transformed shape

getBoundingBox

public Box2D getBoundingBox()
Return the bounding box of the half-plane. If support line of the half-plane is vertical or horizontal, one of the bounds of the bounding box is finite.

Specified by:
getBoundingBox in interface Shape2D
Returns:
the bounding box of the shape.

contains

public boolean contains(double x,
                        double y)
Tests if the point lies inside the halfplane.

Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Point2D p)
Tests if the point lies inside the halfplane.

Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Tests if the given rectangle lies completely inside the halfplane.

Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Rectangle2D r)
Tests if the given rectangle lies completely inside the halfplane.

Specified by:
contains in interface java.awt.Shape

getBounds

public java.awt.Rectangle getBounds()
Return bounding box of the shape.

Specified by:
getBounds in interface java.awt.Shape

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Return more precise bounds for the shape.

Specified by:
getBounds2D in interface java.awt.Shape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Tests if the half-plane intersects the given rectangle.

Specified by:
intersects in interface java.awt.Shape

intersects

public boolean intersects(java.awt.geom.Rectangle2D r)
Tests if the half-plane intersects the given rectangle.

Specified by:
intersects in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform t)
Returns PathIterator of halfplane clipped by the default clipping window.

Specified by:
getPathIterator in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform t,
                                                  double flatness)
Returns PathIterator of halfplane clipped by the default clipping window.

Specified by:
getPathIterator in interface java.awt.Shape