public static final class Parallelogram.Builder extends Object
Parallelogram
instances. Parallelograms are constructed
by transforming the vertices of a unit square centered at the origin with a transform built from
the values configured here. The transformations applied are scaling, rotation,
and translation, in that order. When applied in this order, the scale factors determine
the width and height of the parallelogram, the rotation determines the orientation, and the translation
determines the position of the center point.Modifier and Type | Method and Description |
---|---|
Parallelogram |
build()
Build a new parallelogram instance with the values configured in this builder.
|
Parallelogram.Builder |
setPosition(Vector2D pos)
Set the center position of the created parallelogram.
|
Parallelogram.Builder |
setRotation(Rotation2D rot)
Set the rotation of the created parallelogram.
|
Parallelogram.Builder |
setScale(double scaleFactor)
Set the scaling for the created parallelogram.
|
Parallelogram.Builder |
setScale(double x,
double y)
Set the scaling for the created parallelogram.
|
Parallelogram.Builder |
setScale(Vector2D scaleFactors)
Set the scaling for the created parallelogram.
|
Parallelogram.Builder |
setXDirection(Vector2D xDirection)
Set the rotation of the created parallelogram such that the
relative x-axis of the shape points in the given direction.
|
Parallelogram.Builder |
setYDirection(Vector2D yDirection)
Set the rotation of the created parallelogram such that the
relative y-axis of the shape points in the given direction.
|
public Parallelogram.Builder setPosition(Vector2D pos)
pos
- center position of the created parallelogrampublic Parallelogram.Builder setScale(Vector2D scaleFactors)
scaleFactors
- scale factorspublic Parallelogram.Builder setScale(double x, double y)
x
- x scale factory
- y scale factorpublic Parallelogram.Builder setScale(double scaleFactor)
scaleFactor
- scale factor for x and y directionspublic Parallelogram.Builder setRotation(Rotation2D rot)
rot
- the rotation of the created parallelogrampublic Parallelogram.Builder setXDirection(Vector2D xDirection)
xDirection
- the direction of the relative x-axisIllegalArgumentException
- if the given vector cannot be normalizedsetRotation(Rotation2D)
public Parallelogram.Builder setYDirection(Vector2D yDirection)
yDirection
- the direction of the relative y-axisIllegalArgumentException
- if the given vector cannot be normalizedsetRotation(Rotation2D)
public Parallelogram build()
IllegalArgumentException
- if the length of any side of the parallelogram is zero,
as determined by the configured precision contextParallelogram.fromTransformedUnitSquare(Transform, Precision.DoubleEquivalence)
Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.