Class Parallelogram
java.lang.Object
org.apache.commons.geometry.core.partitioning.AbstractConvexHyperplaneBoundedRegion<Vector2D,LineConvexSubset>
org.apache.commons.geometry.euclidean.twod.ConvexArea
org.apache.commons.geometry.euclidean.twod.shape.Parallelogram
- All Implemented Interfaces:
BoundarySource<LineConvexSubset>,HyperplaneBoundedRegion<Vector2D>,Splittable<Vector2D,,HyperplaneBoundedRegion<Vector2D>> Region<Vector2D>,Sized,BoundarySource2D,Linecastable2D
Class representing parallelograms, i.e. quadrilaterals with two pairs of parallel sides.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classClass designed to aid construction ofParallelograminstances.Nested classes/interfaces inherited from class org.apache.commons.geometry.core.partitioning.AbstractConvexHyperplaneBoundedRegion
AbstractConvexHyperplaneBoundedRegion.ConvexRegionBoundaryBuilder<P extends Point<P>,S extends HyperplaneConvexSubset<P>> -
Field Summary
FieldsModifier and TypeFieldDescriptionVertices defining a square with sides of length 1 centered on the origin. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateParallelogram(List<LineConvexSubset> boundaries) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic ParallelogramaxisAligned(Vector2D a, Vector2D b, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new instance representing an axis-aligned rectangle.static Parallelogram.Builderbuilder(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a newParallelogram.Builderinstance to use for constructing parallelograms.static ParallelogramfromTransformedUnitSquare(Transform<Vector2D> transform, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Create a new instance by transforming a unit square centered at the origin.static ParallelogramunitSquare(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new instance representing a unit square centered on the origin.Methods inherited from class org.apache.commons.geometry.euclidean.twod.ConvexArea
boundaryStream, convexPolygonFromPath, convexPolygonFromVertices, fromBounds, fromBounds, full, getBoundaryPaths, getCentroid, getSize, getVertices, split, toTree, transform, trimMethods inherited from class org.apache.commons.geometry.core.partitioning.AbstractConvexHyperplaneBoundedRegion
classify, getBoundaries, getBoundarySize, isEmpty, isFull, project, splitInternal, swapsInsideOutside, toString, transformInternalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.geometry.euclidean.twod.BoundarySource2D
getBounds, linecast, linecastFirst, toListMethods inherited from interface org.apache.commons.geometry.euclidean.twod.Linecastable2D
linecast, linecastFirstMethods inherited from interface org.apache.commons.geometry.core.Sized
isFinite, isInfinite
-
Field Details
-
UNIT_SQUARE_VERTICES
Vertices defining a square with sides of length 1 centered on the origin.
-
-
Constructor Details
-
Parallelogram
Simple constructor. Callers are responsible for ensuring that the given path represents a parallelogram. No validation is performed.- Parameters:
boundaries- the boundaries of the parallelogram; this must be a list with 4 elements
-
-
Method Details
-
unitSquare
public static Parallelogram unitSquare(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new instance representing a unit square centered on the origin. The vertices of this square are:[ (-0.5 -0.5), (0.5, -0.5), (0.5, 0.5), (-0.5, 0.5) ]- Parameters:
precision- precision context used to construct boundaries- Returns:
- a new instance representing a unit square centered on the origin
-
axisAligned
public static Parallelogram axisAligned(Vector2D a, Vector2D b, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new instance representing an axis-aligned rectangle. The pointsaandbare taken to represent opposite corner points in the rectangle and may be specified in any order.- Parameters:
a- first corner point in the rectangle (opposite ofb)b- second corner point in the rectangle (opposite ofa)precision- precision context used to construct boundaries- Returns:
- a new instance representing an axis-aligned rectangle
- Throws:
IllegalArgumentException- if the length of any side of the parallelogram is zero, as determined by the given precision context
-
fromTransformedUnitSquare
public static Parallelogram fromTransformedUnitSquare(Transform<Vector2D> transform, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Create a new instance by transforming a unit square centered at the origin. The vertices of this input square are:[ (-0.5 -0.5), (0.5, -0.5), (0.5, 0.5), (-0.5, 0.5) ]- Parameters:
transform- the transform to apply to the unit squareprecision- precision context used to construct boundaries- Returns:
- a new instance constructed by transforming the unit square
- Throws:
IllegalArgumentException- if the length of any side of the parallelogram is zero, as determined by the given precision context
-
builder
public static Parallelogram.Builder builder(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a newParallelogram.Builderinstance to use for constructing parallelograms.- Parameters:
precision- precision context used to create boundaries- Returns:
- a new
Parallelogram.Builderinstance
-