MutableParallelogram



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

Summary

Public constructors

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

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
populateFromCenterDimensionsAndRotationInDegrees(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotationDegrees: @FloatRange(from = 0.0, to = 360.0, toInclusive = false) @AngleDegreesFloat Float
)

Populates the MutableParallelogram to have a given center, width, height and rotationDegrees, with zero skew.

android
MutableParallelogram
populateFromCenterDimensionsRotationInDegreesAndSkew(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotationDegrees: @FloatRange(from = 0.0, to = 360.0, toInclusive = false) @AngleDegreesFloat Float,
    skew: Float
)

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

android
MutableParallelogram

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

android
open String
android

Public properties

open MutableVec
android
open Float

The height of the Parallelogram.

android
open Float

The rotation of the Parallelogram in degrees from its original axis-aligned orientation in the direction from the positive x-axis towards the positive y-axis.

android
open Float

The horizontal displacement between the two horizontal edges of the Parallelogram pre-rotation, as a multiple of the height.

android
open Float

The width of the Parallelogram.

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

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 skew. 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 skew. If the width is less than zero, the Parallelogram will be normalized.

See the corresponding fields on Parallelogram for details about these parameters.

Returns
MutableParallelogram

this

populateFromCenterDimensionsAndRotationInDegrees

fun populateFromCenterDimensionsAndRotationInDegrees(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotationDegrees: @FloatRange(from = 0.0, to = 360.0, toInclusive = false) @AngleDegreesFloat Float
): MutableParallelogram

Populates the MutableParallelogram to have a given center, width, height and rotationDegrees, with zero skew. If the width is less than zero or if the rotationDegrees is not in the range [0, 360), it will be normalized.

See the corresponding fields on Parallelogram for details about these parameters.

Returns
MutableParallelogram

this

populateFromCenterDimensionsRotationInDegreesAndSkew

fun populateFromCenterDimensionsRotationInDegreesAndSkew(
    center: MutableVec,
    width: @FloatRange(from = 0.0) Float,
    height: Float,
    rotationDegrees: @FloatRange(from = 0.0, to = 360.0, toInclusive = false) @AngleDegreesFloat Float,
    skew: Float
): MutableParallelogram

Populates the MutableParallelogram to have a given center, width, height, rotationDegrees and skew. If the width is less than zero or if rotationDegrees is not within the range [0, 360.0), it will be normalized.

See the corresponding fields on Parallelogram for details about these parameters.

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 skew of zero.

Returns
MutableParallelogram

this

toString

open fun toString(): String

Public properties

center

open var centerMutableVec

height

open var heightFloat

The height of the Parallelogram. May be positive or negative, corresponding to whether the angle from the first semi-axis to the second is also positive or negative.

rotationDegrees

open var rotationDegreesFloat

The rotation of the Parallelogram in degrees from its original axis-aligned orientation in the direction from the positive x-axis towards the positive y-axis.

skew

open var skewFloat

The horizontal displacement between the two horizontal edges of the Parallelogram pre-rotation, as a multiple of the height. Equivalently, this is the cotangent of the absolute angle between the semi-axes. A Parallelogram may have a positive or negative skew, a greater skew indicates a smaller absolute angle between the semi-axes.

width

open var widthFloat

The width of the Parallelogram. 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 180 to rotationDegrees and normalizing that to the range [0, 360).