MutableParallelogram


public final class MutableParallelogram extends Parallelogram


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

Summary

Public constructors

Public methods

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

Constructs a MutableParallelogram with a given center, width and height.

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

Constructs a MutableParallelogram with a given center, width, height and rotation.

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

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

@NonNull MutableVec
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.

@AngleRadiansFloat 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).

@FloatRange(from = 0.0) float

A Parallelogram may not have a negative width.

int
void
void
setHeight(float height)

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.

void
setRotation(float rotation)
void
setShearFactor(float shearFactor)

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).

void
setWidth(float width)

A Parallelogram may not have a negative width.

@NonNull String

Inherited methods

From androidx.ink.geometry.Parallelogram
final float

Returns the signed area of the Parallelogram.

Public constructors

MutableParallelogram

Added in 1.0.0-alpha02
public MutableParallelogram()

Public methods

equals

public boolean equals(Object other)

fromCenterAndDimensions

Added in 1.0.0-alpha02
public static final @NonNull MutableParallelogram fromCenterAndDimensions(
    @NonNull MutableVec center,
    @FloatRange(from = 0.0) float width,
    float height
)

Constructs a MutableParallelogram 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-alpha02
public static final @NonNull MutableParallelogram fromCenterDimensionsAndRotation(
    @NonNull MutableVec center,
    @FloatRange(from = 0.0) float width,
    float height,
    @AngleRadiansFloat float rotation
)

Constructs a MutableParallelogram 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-alpha02
public static final @NonNull MutableParallelogram fromCenterDimensionsRotationAndShear(
    @NonNull MutableVec center,
    @FloatRange(from = 0.0) float width,
    float height,
    @AngleRadiansFloat float rotation,
    float shearFactor
)

Constructs a MutableParallelogram 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-alpha02
public @NonNull MutableVec getCenter()

getHeight

Added in 1.0.0-alpha02
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-alpha02
public @AngleRadiansFloat float getRotation()

getShearFactor

Added in 1.0.0-alpha02
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-alpha02
public @FloatRange(from = 0.0) 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()

setCenter

Added in 1.0.0-alpha02
public void setCenter(@NonNull MutableVec center)

setHeight

Added in 1.0.0-alpha02
public void setHeight(float height)

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.

setRotation

Added in 1.0.0-alpha02
public void setRotation(float rotation)

setShearFactor

Added in 1.0.0-alpha02
public void setShearFactor(float shearFactor)

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).

setWidth

Added in 1.0.0-alpha02
public void setWidth(float width)

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π).

toString

public @NonNull String toString()