math.geom2d.polygon
Class HRectangle2D
- java.lang.Object
-
- java.awt.geom.RectangularShape
-
- java.awt.geom.Rectangle2D
-
- java.awt.geom.Rectangle2D.Double
-
- 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 classjava.awt.geom.Rectangle2D.Doublewith interfaceAbstractPolygon.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HRectangle2D()Deprecated.Empty constructor (size and position zero)HRectangle2D(double x0, double y0, double w, double h)Deprecated.Main constructorHRectangle2D(Point2D point, double w, double h)Deprecated.Main constructorHRectangle2D(java.awt.geom.Rectangle2D rect)Deprecated.Constructor from awt, to allow easy construction from existing apps.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidaddVertex(Point2D point)Deprecated.Adds a vertex as last vertex of this polygon.booleanalmostEquals(GeometricObject2D obj, double eps)Deprecated.Checks if the two objects are similar up to a given threshold value.doublearea()Deprecated.Computes the signed area of the polygon.Polygon2DasPolygon(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.Box2DboundingBox()Deprecated.Returns the bounding box of the shape.CirculinearDomain2Dbuffer(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.Point2Dcentroid()Deprecated.Computes the centroid (center of mass) of the polygon.HRectangle2Dclip(Box2D box)Deprecated.Returns the clipping of the rectangle, as an instance of HRectangle2D.intclosestVertexIndex(Point2D point)Deprecated.Computes the index of the closest vertex to the input point.Polygon2Dcomplement()Deprecated.Returns the complementary polygon.booleancontains(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.doubledistance(double x, double y)Deprecated.Returns the distance of the point to the polygon.doubledistance(Point2D p)Deprecated.Returns the distance of the point to the polygon.voiddraw(java.awt.Graphics2D g2)Deprecated.Draws the shape on the given graphics.intedgeNumber()Deprecated.Returns the number of edges of the polygonjava.util.Collection<LineSegment2D>edges()Deprecated.Return the edges as line segments of the polygonbooleanequals(java.lang.Object obj)Deprecated.Test if rectangles are the same.voidfill(java.awt.Graphics2D g2)Deprecated.Fills the interior of the domain, using the Graphics current Paint.voidinsertVertex(int i, Point2D point)Deprecated.Inserts a vertex at the specified position.booleanisBounded()Deprecated.Always returns true, because a rectangle is always bounded.voidremoveVertex(int i)Deprecated.Removes the vertex at the given index.voidsetVertex(int i, Point2D point)Deprecated.Sets the position of the i-th vertexSimplePolygon2Dtransform(AffineTransform2D trans)Deprecated.Return the new Polygon created by an affine transform of this polygon.CirculinearDomain2Dtransform(CircleInversion2D inv)Deprecated.Transforms the shape by a circle inversion.Point2Dvertex(int i)Deprecated.Returns the i-th vertex of the polygon.intvertexNumber()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
-
-
-
-
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:Polygon2DReturns the vertices (singular points) of the polygon
-
vertex
public Point2D vertex(int i)
Deprecated.Returns the i-th vertex of the polygon.
-
setVertex
public void setVertex(int i, Point2D point)Deprecated.Description copied from interface:Polygon2DSets the position of the i-th vertex
-
addVertex
public void addVertex(Point2D point)
Deprecated.Description copied from interface:Polygon2DAdds a vertex as last vertex of this polygon.
-
insertVertex
public void insertVertex(int i, Point2D point)Deprecated.Description copied from interface:Polygon2DInserts a vertex at the specified position.- Specified by:
insertVertexin interfacePolygon2D- Parameters:
i- index at which the specified vertex is to be insertedpoint- the position of the new vertex
-
removeVertex
public void removeVertex(int i)
Deprecated.Description copied from interface:Polygon2DRemoves the vertex at the given index.- Specified by:
removeVertexin interfacePolygon2D- Parameters:
i- index of the vertex to remove
-
vertexNumber
public int vertexNumber()
Deprecated.Returns the number of vertex, which is 4.- Specified by:
vertexNumberin interfacePolygon2D- Since:
- 0.6.3
-
closestVertexIndex
public int closestVertexIndex(Point2D point)
Deprecated.Computes the index of the closest vertex to the input point.- Specified by:
closestVertexIndexin interfacePolygon2D
-
edges
public java.util.Collection<LineSegment2D> edges()
Deprecated.Description copied from interface:Polygon2DReturn the edges as line segments of the polygon
-
edgeNumber
public int edgeNumber()
Deprecated.Description copied from interface:Polygon2DReturns the number of edges of the polygon- Specified by:
edgeNumberin interfacePolygon2D
-
area
public double area()
Deprecated.Computes the signed area of the polygon.
-
centroid
public Point2D centroid()
Deprecated.Computes the centroid (center of mass) of the polygon.
-
transform
public CirculinearDomain2D transform(CircleInversion2D inv)
Deprecated.Description copied from interface:CirculinearShape2DTransforms the shape by a circle inversion. The result is still an instance a CirculinearShape2D.- Specified by:
transformin interfaceCirculinearDomain2D- Specified by:
transformin interfaceCirculinearShape2D- Parameters:
inv- the circle inversion- Returns:
- the transformed shape
-
buffer
public CirculinearDomain2D buffer(double dist)
Deprecated.Description copied from interface:CirculinearShape2DComputes 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:
bufferin interfaceCirculinearShape2D- 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:Domain2DReturns an approximation of the domain as a polygon, or a MultiPolygon.
-
boundary
public CirculinearContourArray2D<LinearRing2D> boundary()
Deprecated.Description copied from interface:Polygon2DOverrides the definition of boundary() such that the boundary of a polygon is defined as a set of LinearRing2D.
-
contours
public java.util.Collection<LinearRing2D> contours()
Deprecated.Description copied from interface:Domain2DReturns the set of contours that enclose this domain. The result is a collection of shapes that implement the Contour2D interface.
-
complement
public Polygon2D complement()
Deprecated.Description copied from interface:Polygon2DReturns the complementary polygon.- Specified by:
complementin interfaceCirculinearDomain2D- Specified by:
complementin interfaceDomain2D- Specified by:
complementin interfacePolygon2D- 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.
-
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.
-
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.
-
isBounded
public boolean isBounded()
Deprecated.Always returns true, because a rectangle is always bounded.
-
boundingBox
public Box2D boundingBox()
Deprecated.Description copied from interface:Shape2DReturns the bounding box of the shape.- Specified by:
boundingBoxin interfaceShape2D- 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.
-
draw
public void draw(java.awt.Graphics2D g2)
Deprecated.Description copied from interface:Shape2DDraws the shape on the given graphics. If the shape is empty, nothing is drawn. If the shape is unbounded, an exception is thrown.
-
fill
public void fill(java.awt.Graphics2D g2)
Deprecated.Description copied from interface:Domain2DFills the interior of the domain, using the Graphics current Paint.
-
almostEquals
public boolean almostEquals(GeometricObject2D obj, double eps)
Deprecated.Description copied from interface:GeometricObject2DChecks 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:
almostEqualsin interfaceGeometricObject2D- Parameters:
obj- the object to compareeps- 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:
equalsin classjava.awt.geom.Rectangle2D
-
-
DMelt 3.0 © DataMelt by jWork.ORG