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 Rectangle2d
create(Rectangle2d other)
Creates a new instance.static Rectangle2d
create(List<? extends Vector2d> vertices)
Creates a new instance from the given points.boolean
equalsWithTolerance(Rectangle2d rectangle, double epsilon)
Verifies if two 2D rectangles are equal (with epsilon difference).Segment2d
getLongerRectangleSegment()
Returns the longer segment of the rectangle.double
getLongerRectangleSegmentLength()
Returns the length of the longer rectangle segment.List<Segment2d>
getLongerRectangleSegments()
Returns the longer segments of the rectangle.Segment2d
getShorterRectangleSegment()
Returns the shorter segment of the rectangle.double
getShorterRectangleSegmentLength()
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, spliterator
Methods 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
-