MutableParallelogram



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

Summary

Public constructors

Constructs an empty MutableParallelogram with a center at the origin, a zero width, a zero height, zero rotation, and zero shear factor.

android

Public functions

open operator Boolean
equals(other: Any?)
android
open Int
android
MutableParallelogram

Fills this MutableParallelogram with the same values contained in input.

android
MutableParallelogram
populateFromCenterAndDimensions(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float
)

Populates a MutableParallelogram to have a given center, width and height.

android
MutableParallelogram
populateFromCenterDimensionsAndRotation(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotation: @AngleRadiansFloat Float
)

Populates the MutableParallelogram to have a given center, width, height and rotation and zero shearFactor.

android
MutableParallelogram
populateFromCenterDimensionsRotationAndShear(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotation: @AngleRadiansFloat Float,
    shearFactor: Float
)

Populates the MutableParallelogram to have a given center, width, height, rotation and shearFactor.

android
MutableParallelogram

Populates the MutableParallelogram to be aligned with the segment with its bounds padding units away from the segment and shear of zero.

android
open String
android

Public properties

open MutableVec
android
open 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.

android
open Float
android
open 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).

android
open Float

A Parallelogram may not have a negative width.

android

Inherited functions

From androidx.ink.geometry.Parallelogram
ImmutableBox

Returns the minimum bounding box containing the Parallelogram.

android
MutableBox

Returns the minimum bounding box containing the Parallelogram.

android
List<ImmutableVec>

Returns a list containing the 4 corners of the Parallelogram.

android
Unit
computeCorners(
    outCorner1: MutableVec,
    outCorner2: MutableVec,
    outCorner3: MutableVec,
    outCorner4: MutableVec
)

Populates the 4 output points with the corners of the Parallelogram.

android
List<ImmutableVec>

Returns the semi axes of this Parallelogram.

android
Unit
computeSemiAxes(outAxis1: MutableVec, outAxis2: MutableVec)

Fills the MutableVecs with the semi axes of this Parallelogram.

android
Float

Returns the signed area of the Parallelogram.

android
operator Boolean

Returns whether the given point is contained within the Box.

android
Boolean
isAlmostEqual(other: Parallelogram, tolerance: @FloatRange(from = 0.0) Float)

Compares this Parallelogram with other, and returns true if both center points are considered almost equal with the given tolerance, and the difference between width and other.width is less than tolerance, and likewise for height, rotation, and shearFactor.

android

Public constructors

MutableParallelogram

MutableParallelogram()

Constructs an empty MutableParallelogram with a center at the origin, a zero width, a zero height, zero rotation, and zero shear factor. This is intended for subsequent population with one of the populateFrom methods.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

populateFrom

fun populateFrom(input: Parallelogram): MutableParallelogram

Fills this MutableParallelogram with the same values contained in input.

Returns the modified instance to allow chaining calls.

Returns
MutableParallelogram

this

populateFromCenterAndDimensions

fun populateFromCenterAndDimensions(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float
): MutableParallelogram

Populates a MutableParallelogram to have 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.

Returns
MutableParallelogram

this

populateFromCenterDimensionsAndRotation

fun populateFromCenterDimensionsAndRotation(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotation: @AngleRadiansFloat Float
): MutableParallelogram

Populates the MutableParallelogram to have a given center, width, height and rotation and zero shearFactor. If the width is less than zero or if the rotation is not in the range [0, 2π), it will be normalized.

Returns
MutableParallelogram

this

populateFromCenterDimensionsRotationAndShear

fun populateFromCenterDimensionsRotationAndShear(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotation: @AngleRadiansFloat Float,
    shearFactor: Float
): MutableParallelogram

Populates the MutableParallelogram to have 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π), it will be normalized.

Returns
MutableParallelogram

this

populateFromSegmentAndPadding

fun populateFromSegmentAndPadding(segment: Segment, padding: Float): MutableParallelogram

Populates the MutableParallelogram to be aligned with the segment with its bounds padding units away from the segment and shear of zero.

Returns
MutableParallelogram

this

toString

open fun toString(): String

Public properties

center

open var centerMutableVec

height

open var heightFloat

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.

rotation

open var rotationFloat

shearFactor

open var shearFactorFloat

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

width

open var widthFloat

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