Package com.solibri.geometry.primitive2d
Interface Rectangle2d
- All Known Subinterfaces:
MRectangle2d
public interface Rectangle2d extends Polygon2d
Read-only interface for handling rectangles in the XY-plane.
- Since:
- 9.10.2
-
Method Summary
Modifier and Type Method Description static Rectangle2dcreate(Rectangle2d other)Creates a new instance.static Rectangle2dcreate(List<? extends Vector2d> vertices)Creates a new instance from the given points.booleanequalsWithTolerance(Rectangle2d rectangle, double epsilon)Verifies if two 2D rectangles are equal (with epsilon difference).Segment2dgetLongerRectangleSegment()Returns the longer segment of the rectangle.doublegetLongerRectangleSegmentLength()Returns the length of the longer rectangle segment.List<Segment2d>getLongerRectangleSegments()Returns the longer segments of the rectangle.Segment2dgetShorterRectangleSegment()Returns the shorter segment of the rectangle.doublegetShorterRectangleSegmentLength()Returns the length of shorter rectangle segment.List<Segment2d>getShorterRectangleSegments()Returns the shorter segments of the rectangle.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface com.solibri.geometry.primitive2d.Polygon2d
contains, contains, distance, distance, distance, distanceSquared, distanceSquared, distanceSquared, getArea, getBoundingRectangle, getCentroid, getEdgeIterator, getOrientedBoundingRectangle, getPerimeter, getVertexCount, getVertices, intersectEdges, intersects, isConvex, isCounterClockwise, shortestSegmentTo, toArea
-
Method Details
-
getLongerRectangleSegment
Segment2d getLongerRectangleSegment()Returns the longer segment of the rectangle.- Returns:
- segment the longer segment
- Since:
- 9.10.2
-
getLongerRectangleSegments
Returns the longer segments of the rectangle.- Returns:
- segments list with the longer segments
- Since:
- 9.10.2
-
getLongerRectangleSegmentLength
double getLongerRectangleSegmentLength()Returns the length of the longer rectangle segment.- Returns:
- the length of the longer segment
- Since:
- 9.10.2
-
getShorterRectangleSegment
Segment2d getShorterRectangleSegment()Returns the shorter segment of the rectangle.- Returns:
- segment the shorter segment
- Since:
- 9.10.2
-
getShorterRectangleSegments
Returns the shorter segments of the rectangle.- Returns:
- segments list with the shorter segments
- Since:
- 9.10.2
-
getShorterRectangleSegmentLength
double getShorterRectangleSegmentLength()Returns the length of shorter rectangle segment.- Returns:
- the length of the shorter segment
- Since:
- 9.10.2
-
equalsWithTolerance
Verifies if two 2D rectangles are equal (with epsilon difference). It checks that the vertices of the rectangles are the same (or in the specified epsilon radius).- Parameters:
rectangle- the rectangle to compare toepsilon- the tolerance radius- Returns:
- true is they are epsilon equal, false otherwise
-
create
Creates a new instance from the given points.- Parameters:
vertices- list of points to create the rectangle- Returns:
- a Rectangle2d instance
- Throws:
IllegalArgumentException- if the points do not form a rectangle- Since:
- 9.10.2
-
create
Creates a new instance.- Parameters:
other- the other rectangle- Returns:
- the newly created instance
- Since:
- 9.10.2
-