ImmutableParallelogram


public final class ImmutableParallelogram extends Parallelogram


Immutable parallelogram (i.e. a quadrilateral with parallel sides), defined by its center, width, height, rotation, and shearFactor.

Summary

Public methods

boolean
equals(Object other)
static final @NonNull ImmutableParallelogram
fromCenterAndDimensions(
    @NonNull ImmutableVec center,
    @FloatRange(from = 0.0) float width,
    float height
)

Constructs an ImmutableParallelogram with a given center, width and height.

static final @NonNull ImmutableParallelogram
fromCenterDimensionsAndRotation(
    @NonNull ImmutableVec center,
    @FloatRange(from = 0.0) float width,
    float height,
    @AngleRadiansFloat float rotation
)

Constructs an ImmutableParallelogram with a given center, width, height and rotation.

static final @NonNull ImmutableParallelogram
fromCenterDimensionsRotationAndShear(
    @NonNull ImmutableVec center,
    @FloatRange(from = 0.0) float width,
    float height,
    @AngleRadiansFloat float rotation,
    float shearFactor
)

Constructs an ImmutableParallelogram with a given center, width, height, rotation and shearFactor.

@NonNull ImmutableVec
float

A Parallelogram may have a positive or negative height; a positive height indicates that the angle from the first semi-axis to the second will also be positive.

float
float

A Parallelogram] may have a positive or negative shear factor; a positive shear factor indicates a smaller absolute angle between the semi-axes (the shear factor is, in fact, the cotangent of that angle).

float

A Parallelogram may not have a negative width.

int
@NonNull String

Inherited methods

From androidx.ink.geometry.Parallelogram
final float

Returns the signed area of the Parallelogram.

Public methods

equals

public boolean equals(Object other)

fromCenterAndDimensions

Added in 1.0.0-alpha01
public static final @NonNull ImmutableParallelogram fromCenterAndDimensions(
    @NonNull ImmutableVec center,
    @FloatRange(from = 0.0) float width,
    float height
)

Constructs an ImmutableParallelogram with a given center, width and height. The resulting Parallelogram has zero rotation and shearFactor. If the width is less than zero, the Parallelogram will be normalized.

fromCenterDimensionsAndRotation

Added in 1.0.0-alpha01
public static final @NonNull ImmutableParallelogram fromCenterDimensionsAndRotation(
    @NonNull ImmutableVec center,
    @FloatRange(from = 0.0) float width,
    float height,
    @AngleRadiansFloat float rotation
)

Constructs an ImmutableParallelogram with a given center, width, height and rotation. The resulting Parallelogram has zero shearFactor. If the width is less than zero or if the rotation is not in the range [0, 2π), the Parallelogram will be normalized.

fromCenterDimensionsRotationAndShear

Added in 1.0.0-alpha01
public static final @NonNull ImmutableParallelogram fromCenterDimensionsRotationAndShear(
    @NonNull ImmutableVec center,
    @FloatRange(from = 0.0) float width,
    float height,
    @AngleRadiansFloat float rotation,
    float shearFactor
)

Constructs an ImmutableParallelogram with a given center, width, height, rotation and shearFactor. If the width is less than zero or if the rotation is not in the range [0, 2π), the Parallelogram will be normalized.

getCenter

Added in 1.0.0-alpha01
public @NonNull ImmutableVec getCenter()

getHeight

Added in 1.0.0-alpha01
public float getHeight()

A Parallelogram may have a positive or negative height; a positive height indicates that the angle from the first semi-axis to the second will also be positive.

getRotation

Added in 1.0.0-alpha01
public float getRotation()

getShearFactor

Added in 1.0.0-alpha01
public float getShearFactor()

A Parallelogram] may have a positive or negative shear factor; a positive shear factor indicates a smaller absolute angle between the semi-axes (the shear factor is, in fact, the cotangent of that angle).

getWidth

Added in 1.0.0-alpha01
public float getWidth()

A Parallelogram may not have a negative width. If an operation on a parallelogram would result in a negative width, it is instead normalized, by negating both the width and the height, adding π to the angle of rotation, and normalizing rotation to the range [0, 2π).

hashCode

public int hashCode()

toString

public @NonNull String toString()