math.geom2d.polygon
Class HRectangle2D

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.geom.Rectangle2D.Double
              extended by math.geom2d.polygon.HRectangle2D
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, CirculinearDomain2D, CirculinearShape2D, Domain2D, GeometricObject2D, Polygon2D, Shape2D

Deprecated. since 0.11.0

@Deprecated
public class HRectangle2D
extends java.awt.geom.Rectangle2D.Double
implements Polygon2D

HRectangle2D defines a rectangle with edges parallel to main axis. Thus, it can not be rotated, contrary to Rectangle2D. This class is actually simply a wrapper of class java.awt.geom.Rectangle2D.Double with interface AbstractPolygon.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
 
Field Summary
 
Fields inherited from class java.awt.geom.Rectangle2D.Double
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
HRectangle2D()
          Deprecated. Empty constructor (size and position zero)
HRectangle2D(double x0, double y0, double w, double h)
          Deprecated. Main constructor
HRectangle2D(Point2D point, double w, double h)
          Deprecated. Main constructor
HRectangle2D(java.awt.geom.Rectangle2D rect)
          Deprecated. Constructor from awt, to allow easy construction from existing apps.
 
Method Summary
 void addVertex(Point2D point)
          Deprecated. Adds a vertex as last vertex of this polygon.
 boolean almostEquals(GeometricObject2D obj, double eps)
          Deprecated. Checks if the two objects are similar up to a given threshold value.
 double area()
          Deprecated. Computes the signed area of the polygon.
 Polygon2D asPolygon(int n)
          Deprecated. Returns an approximation of the domain as a polygon, or a MultiPolygon.
 CirculinearContourArray2D<LinearRing2D> boundary()
          Deprecated. Overrides the definition of boundary() such that the boundary of a polygon is defined as a set of LinearRing2D.
 Box2D boundingBox()
          Deprecated. Returns the bounding box of the shape.
 CirculinearDomain2D buffer(double dist)
          Deprecated. Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.
 Point2D centroid()
          Deprecated. Computes the centroid (center of mass) of the polygon.
 HRectangle2D clip(Box2D box)
          Deprecated. Returns the clipping of the rectangle, as an instance of HRectangle2D.
 int closestVertexIndex(Point2D point)
          Deprecated. Computes the index of the closest vertex to the input point.
 Polygon2D complement()
          Deprecated. Returns the complementary polygon.
 boolean contains(Point2D p)
          Deprecated. Checks if the shape contains the given point.
 java.util.Collection<LinearRing2D> contours()
          Deprecated. Returns the set of contours that enclose this domain.
 double distance(double x, double y)
          Deprecated. Returns the distance of the point to the polygon.
 double distance(Point2D p)
          Deprecated. Returns the distance of the point to the polygon.
 void draw(java.awt.Graphics2D g2)
          Deprecated. Draws the shape on the given graphics.
 int edgeNumber()
          Deprecated. Returns the number of edges of the polygon
 java.util.Collection<LineSegment2D> edges()
          Deprecated. Return the edges as line segments of the polygon
 boolean equals(java.lang.Object obj)
          Deprecated. Test if rectangles are the same.
 void fill(java.awt.Graphics2D g2)
          Deprecated. Fills the interior of the domain, using the Graphics current Paint.
 void insertVertex(int i, Point2D point)
          Deprecated. Inserts a vertex at the specified position.
 boolean isBounded()
          Deprecated. Always returns true, because a rectangle is always bounded.
 void removeVertex(int i)
          Deprecated. Removes the vertex at the given index.
 void setVertex(int i, Point2D point)
          Deprecated. Sets the position of the i-th vertex
 SimplePolygon2D transform(AffineTransform2D trans)
          Deprecated. Return the new Polygon created by an affine transform of this polygon.
 CirculinearDomain2D transform(CircleInversion2D inv)
          Deprecated. Transforms the shape by a circle inversion.
 Point2D vertex(int i)
          Deprecated. Returns the i-th vertex of the polygon.
 int vertexNumber()
          Deprecated. Returns the number of vertex, which is 4.
 java.util.Collection<Point2D> vertices()
          Deprecated. Returns the vertices (singular points) of the polygon
 
Methods inherited from class java.awt.geom.Rectangle2D.Double
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect, toString
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface math.geom2d.Shape2D
contains, isEmpty
 

Constructor Detail

HRectangle2D

public HRectangle2D(double x0,
                    double y0,
                    double w,
                    double h)
Deprecated. 
Main constructor


HRectangle2D

public HRectangle2D()
Deprecated. 
Empty constructor (size and position zero)


HRectangle2D

public HRectangle2D(java.awt.geom.Rectangle2D rect)
Deprecated. 
Constructor from awt, to allow easy construction from existing apps.


HRectangle2D

public HRectangle2D(Point2D point,
                    double w,
                    double h)
Deprecated. 
Main constructor

Method Detail

vertices

public java.util.Collection<Point2D> vertices()
Deprecated. 
Description copied from interface: Polygon2D
Returns the vertices (singular points) of the polygon

Specified by:
vertices in interface Polygon2D

vertex

public Point2D vertex(int i)
Deprecated. 
Returns the i-th vertex of the polygon.

Specified by:
vertex in interface Polygon2D
Parameters:
i - index of the vertex, between 0 and 3

setVertex

public void setVertex(int i,
                      Point2D point)
Deprecated. 
Description copied from interface: Polygon2D
Sets the position of the i-th vertex

Specified by:
setVertex in interface Polygon2D
Parameters:
i - the vertex index
point - the new position of the vertex

addVertex

public void addVertex(Point2D point)
Deprecated. 
Description copied from interface: Polygon2D
Adds a vertex as last vertex of this polygon.

Specified by:
addVertex in interface Polygon2D
Parameters:
point - the position of the new vertex

insertVertex

public void insertVertex(int i,
                         Point2D point)
Deprecated. 
Description copied from interface: Polygon2D
Inserts a vertex at the specified position.

Specified by:
insertVertex in interface Polygon2D
Parameters:
i - index at which the specified vertex is to be inserted
point - the position of the new vertex

removeVertex

public void removeVertex(int i)
Deprecated. 
Description copied from interface: Polygon2D
Removes the vertex at the given index.

Specified by:
removeVertex in interface Polygon2D
Parameters:
i - index of the vertex to remove

vertexNumber

public int vertexNumber()
Deprecated. 
Returns the number of vertex, which is 4.

Specified by:
vertexNumber in interface Polygon2D
Since:
0.6.3

closestVertexIndex

public int closestVertexIndex(Point2D point)
Deprecated. 
Computes the index of the closest vertex to the input point.

Specified by:
closestVertexIndex in interface Polygon2D

edges

public java.util.Collection<LineSegment2D> edges()
Deprecated. 
Description copied from interface: Polygon2D
Return the edges as line segments of the polygon

Specified by:
edges in interface Polygon2D

edgeNumber

public int edgeNumber()
Deprecated. 
Description copied from interface: Polygon2D
Returns the number of edges of the polygon

Specified by:
edgeNumber in interface Polygon2D

area

public double area()
Deprecated. 
Computes the signed area of the polygon.

Specified by:
area in interface Polygon2D
Returns:
the signed area of the polygon.
Since:
0.9.1

centroid

public Point2D centroid()
Deprecated. 
Computes the centroid (center of mass) of the polygon.

Specified by:
centroid in interface Polygon2D
Returns:
the centroid of the polygon
Since:
0.9.1

transform

public CirculinearDomain2D transform(CircleInversion2D inv)
Deprecated. 
Description copied from interface: CirculinearShape2D
Transforms the shape by a circle inversion. The result is still an instance a CirculinearShape2D.

Specified by:
transform in interface CirculinearDomain2D
Specified by:
transform in interface CirculinearShape2D
Parameters:
inv - the circle inversion
Returns:
the transformed shape

buffer

public CirculinearDomain2D buffer(double dist)
Deprecated. 
Description copied from interface: CirculinearShape2D
Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.

Specified by:
buffer in interface CirculinearShape2D
Parameters:
dist - the maximal distance between a point of the buffer and the shape
Returns:
the buffer of the shape

asPolygon

public Polygon2D asPolygon(int n)
Deprecated. 
Description copied from interface: Domain2D
Returns an approximation of the domain as a polygon, or a MultiPolygon.

Specified by:
asPolygon in interface Domain2D
Returns:
a polygon

boundary

public CirculinearContourArray2D<LinearRing2D> boundary()
Deprecated. 
Description copied from interface: Polygon2D
Overrides the definition of boundary() such that the boundary of a polygon is defined as a set of LinearRing2D.

Specified by:
boundary in interface CirculinearDomain2D
Specified by:
boundary in interface Domain2D
Specified by:
boundary in interface Polygon2D
Returns:
the boundary of the domain

contours

public java.util.Collection<LinearRing2D> contours()
Deprecated. 
Description copied from interface: Domain2D
Returns the set of contours that enclose this domain. The result is a collection of shapes that implement the Contour2D interface.

Specified by:
contours in interface CirculinearDomain2D
Specified by:
contours in interface Domain2D
Specified by:
contours in interface Polygon2D
See Also:
Contour2D

complement

public Polygon2D complement()
Deprecated. 
Description copied from interface: Polygon2D
Returns the complementary polygon.

Specified by:
complement in interface CirculinearDomain2D
Specified by:
complement in interface Domain2D
Specified by:
complement in interface Polygon2D
Returns:
the polygon complementary to this

distance

public double distance(Point2D p)
Deprecated. 
Returns the distance of the point to the polygon. The result is the minimal distance computed for each edge if the polygon, or ZERO if the point lies inside the polygon.

Specified by:
distance in interface Shape2D

distance

public double distance(double x,
                       double y)
Deprecated. 
Returns the distance of the point to the polygon. The result is the minimal distance computed for each edge if the polygon, or ZERO if the point lies inside the polygon.

Specified by:
distance in interface Shape2D

clip

public HRectangle2D clip(Box2D box)
Deprecated. 
Returns the clipping of the rectangle, as an instance of HRectangle2D. If rectangle is outside clipping box, returns an instance of HRectangle with 0 width and height.

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

isBounded

public boolean isBounded()
Deprecated. 
Always returns true, because a rectangle is always bounded.

Specified by:
isBounded in interface Shape2D

boundingBox

public Box2D boundingBox()
Deprecated. 
Description copied from interface: Shape2D
Returns the bounding box of the shape.

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

transform

public SimplePolygon2D transform(AffineTransform2D trans)
Deprecated. 
Return the new Polygon created by an affine transform of this polygon.

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

draw

public void draw(java.awt.Graphics2D g2)
Deprecated. 
Description copied from interface: Shape2D
Draws the shape on the given graphics. If the shape is empty, nothing is drawn. If the shape is unbounded, an exception is thrown.

Specified by:
draw in interface Domain2D
Specified by:
draw in interface Shape2D
Parameters:
g2 - the Graphics to draw on

fill

public void fill(java.awt.Graphics2D g2)
Deprecated. 
Description copied from interface: Domain2D
Fills the interior of the domain, using the Graphics current Paint.

Specified by:
fill in interface Domain2D
Parameters:
g2 - the Graphics to fill on

almostEquals

public boolean almostEquals(GeometricObject2D obj,
                            double eps)
Deprecated. 
Description copied from interface: GeometricObject2D
Checks if the two objects are similar up to a given threshold value. This method can be used to compare the results of geometric computations, that introduce errors due to numerical computations.

Specified by:
almostEquals in interface GeometricObject2D
Parameters:
obj - the object to compare
eps - a threshold value, for example the minimal coordinate difference
Returns:
true if both object have the same value up to the threshold

equals

public boolean equals(java.lang.Object obj)
Deprecated. 
Test if rectangles are the same. We consider two rectangles are equal if their corners are the same. Then, we can have different origins and different angles, but equal rectangles.

Overrides:
equals in class java.awt.geom.Rectangle2D

contains

public boolean contains(Point2D p)
Deprecated. 
Description copied from interface: Shape2D
Checks if the shape contains the given point.

Specified by:
contains in interface Shape2D