gmlewis/fonts/geom does not have a README file

    AffineMatrix

    pub(all) struct AffineMatrix {
    a : Double
    b : Double
    c : Double
    d : Double
    tx : Double
    ty : Double
    } derive(Eq,
    Debug
    )

    AffineMatrix represents a 2D affine transform that preserves parallel lines. See: https://en.wikipedia.org/wiki/Affine_transformation
    impl Mul for AffineMatrix

    AffineMatrix::clone

    clone returns a copy of this 2D affine matrix.

    AffineMatrix::copy

    fn AffineMatrix::copy(self : AffineMatrix, other : AffineMatrix) -> Unit

    copy copies another 2D affine matrix into itself.

    AffineMatrix::determinant

    fn AffineMatrix::determinant(self : AffineMatrix) -> Double

    determinant returns the determinant of the 2D affine matrix.

    AffineMatrix::from_center_scale

    fn AffineMatrix::from_center_scale(center : Vec2, scale : Vec2) -> AffineMatrix

    AffineMatrix::from_center_scale returns a new 2D affine matrix that scales from the provided center point.

    AffineMatrix::from_rotation

    fn AffineMatrix::from_rotation(angle : Double) -> AffineMatrix

    AffineMatrix::from_rotation returns a new 2D affine matrix from a rotation angle in degrees.

    AffineMatrix::from_scale

    fn AffineMatrix::from_scale(v : Vec2) -> AffineMatrix

    AffineMatrix::from_scale returns a new 2D affine matrix from scale v.

    AffineMatrix::from_scale_scalar

    fn AffineMatrix::from_scale_scalar(s : Double) -> AffineMatrix

    AffineMatrix::from_scale_scalar returns a new 2D affine matrix from uniform scale s.

    AffineMatrix::from_transform

    fn AffineMatrix::from_transform(transform : Transform) -> AffineMatrix

    AffineMatrix::from_transform returns a new 2D affine matrix from a Transform.

    AffineMatrix::from_translation

    fn AffineMatrix::from_translation(v : Vec2) -> AffineMatrix

    AffineMatrix::from_translation returns a new 2D affine matrix from translation v.

    AffineMatrix::from_translation_points

    fn AffineMatrix::from_translation_points(p1 : Vec2, p2 : Vec2) -> AffineMatrix

    AffineMatrix::from_translation_points returns a new 2D affine matrix that translates from p1 to p2.

    AffineMatrix::invert

    fn AffineMatrix::invert(self : AffineMatrix) -> AffineMatrix

    invert inverts this 2D affine matrix, returning a new one.

    AffineMatrix::is_identity

    fn AffineMatrix::is_identity(self : AffineMatrix) -> Bool

    is_identity returns true if this 2D affine matrix is the identity matrix.

    AffineMatrix::is_inf

    fn AffineMatrix::is_inf(self : AffineMatrix) -> Bool

    is_inf returns true if any elements of this 2D affine matrix are infinite.

    AffineMatrix::is_invertible

    fn AffineMatrix::is_invertible(self : AffineMatrix) -> Bool

    is_invertible returns true if this 2D affine matrix is invertible.

    AffineMatrix::is_mirror

    fn AffineMatrix::is_mirror(self : AffineMatrix) -> Bool

    is_mirror returns true if this 2D affine matrix mirrors either axis.

    AffineMatrix::is_nan

    fn AffineMatrix::is_nan(self : AffineMatrix) -> Bool

    is_nan returns true if any elements of this 2D affine matrix are NaN (not a number).

    AffineMatrix::is_orthogonal

    fn AffineMatrix::is_orthogonal(self : AffineMatrix, tolerance? : Double) -> Bool

    is_orthogonal returns true if the two basis vectors of the 2D affine matrix are orthogonal within the provided tolerance.

    AffineMatrix::is_uniform_scale

    fn AffineMatrix::is_uniform_scale(self : AffineMatrix, tolerance? : Double) -> Bool

    is_uniform_scale returns true if both basis vectors of this 2D affine matrix are of the same length.

    AffineMatrix::mul

    AffineMatrix::mul_without_translation

    fn AffineMatrix::mul_without_translation(self : AffineMatrix, m : AffineMatrix) -> AffineMatrix

    mul_without_translation multiplies this 2D affine matrix with another, discarding the transation, and returning a new one.

    AffineMatrix::new

    fn AffineMatrix::new(a? : Double, b? : Double, c? : Double, d? : Double, tx? : Double, ty? : Double) -> AffineMatrix

    AffineMatrix::new returns a new 2D affine matrix.

    AffineMatrix::normalize

    fn AffineMatrix::normalize(self : AffineMatrix) -> AffineMatrix

    normalize scales the basis vectors of this 2D affine matrix so that they have unit length, returning a new one.

    AffineMatrix::origin

    fn AffineMatrix::origin(self : AffineMatrix, v : Vec2) -> AffineMatrix

    origin translates the matrix such that the center of future scale, rotate, and skew transformations will be v, returning a new one.

    AffineMatrix::pre_mul

    pre_mul multiplies another matrix m by this 2D affine matrix, returning a new one.

    AffineMatrix::pre_mul_without_translation

    fn AffineMatrix::pre_mul_without_translation(self : AffineMatrix, m : AffineMatrix) -> AffineMatrix

    pre_mul_without_translation multiplies another matrix m by this 2D affine matrix, discarding the translate and returning a new affine matrix.

    AffineMatrix::rotate

    fn AffineMatrix::rotate(self : AffineMatrix, angle : Double) -> AffineMatrix

    rotate rotates this 2D affine matrix by angle degrees, returning a new one.

    AffineMatrix::scale

    fn AffineMatrix::scale(self : AffineMatrix, v : Vec2) -> AffineMatrix

    scale scales this 2D affine matrix by v, returning a new one.

    AffineMatrix::scale_scalar

    fn AffineMatrix::scale_scalar(self : AffineMatrix, s : Double) -> AffineMatrix

    scale_scalar scales this 2D affine matrix uniformly by s, returning a new one.

    AffineMatrix::self_mul

    fn AffineMatrix::self_mul(self : AffineMatrix, m : AffineMatrix) -> Unit

    self_mul multiplies this 2D affine matrix with another, storing the result in itself.

    AffineMatrix::skew

    fn AffineMatrix::skew(self : AffineMatrix, angle : Double) -> AffineMatrix

    skew skews the Y basis vector of this 2D affine matrix by angle degrees, returning a new one.

    AffineMatrix::to_transform

    fn AffineMatrix::to_transform(self : AffineMatrix, origin? : Vec2) -> Transform

    to_transform converts this 2D affine matrix to a Transform.

    AffineMatrix::translate

    fn AffineMatrix::translate(self : AffineMatrix, v : Vec2) -> AffineMatrix

    translate translates this 2D affine matrix by position v, returning a new one.

    Alignment

    pub(all) enum Alignment {
    Unchanged
    TopLeft
    TopCenter
    TopRight
    CenterLeft
    Center
    CenterRight
    BaselineLeft
    BaselineCenter
    BaselineRight
    BottomLeft
    BottomCenter
    BottomRight
    RatioXY(Double, Double)
    } derive(Eq,
    Debug
    )

    Alignment represents where to place the origin (0,0) of the glyph relative to its minimum bounding box.
    impl Show for Alignment

    BoundingBox

    pub(all) struct BoundingBox {
    min : Vec2
    max : Vec2
    } derive(Eq,
    Debug
    )

    BoundingBox represents a minimum bounding box as an axis-aligned rectangle.
    impl Show for BoundingBox

    BoundingBox::area

    fn BoundingBox::area(self : BoundingBox) -> Double

    area represents the signed area of the bounding box (width*height). If min > max, the area will be negative.

    BoundingBox::boolean_intersect

    fn BoundingBox::boolean_intersect(self : BoundingBox, boxes : Array[BoundingBox]) -> BoundingBox?

    boolean_intersect returns a new BoundingBox representing the intersection of this bounding box with one or more boxes if one exists.

    BoundingBox::bounds

    fn BoundingBox::bounds(self : BoundingBox) -> (Double, Double, Double, Double)

    bounds returns the tuple (xmin, ymin, xmax, ymax).

    BoundingBox::canonicalize

    fn BoundingBox::canonicalize(self : BoundingBox) -> Unit

    canonicalize ensures that min < max.

    BoundingBox::center

    fn BoundingBox::center(self : BoundingBox) -> Vec2

    center returns the center point of the bounding box (the average of min and max).

    BoundingBox::clone

    fn BoundingBox::clone(self : BoundingBox) -> BoundingBox

    clone makes a new copy of the bounding box.

    BoundingBox::contains_bounding_box

    fn BoundingBox::contains_bounding_box(self : BoundingBox, box : BoundingBox) -> Bool

    contains_bounding_box returns true if box is contained within this bounding box.

    BoundingBox::contains_point

    fn BoundingBox::contains_point(self : BoundingBox, point : Vec2) -> Bool

    contains_point returns true if point is contained within this bounding box.

    BoundingBox::copy

    fn BoundingBox::copy(self : BoundingBox, other : BoundingBox) -> Unit

    BoundingBox::dx

    fn BoundingBox::dx(self : BoundingBox) -> Double

    dx returns the width of the bounding box.

    BoundingBox::dy

    fn BoundingBox::dy(self : BoundingBox) -> Double

    dy returns the height of the bounding box.

    BoundingBox::expand_scalar

    fn BoundingBox::expand_scalar(self : BoundingBox, distance : Double) -> Unit

    expand_scalar expands this bounding box by a scalar distance on all sides.

    BoundingBox::expand_to_include_bounding_box

    fn BoundingBox::expand_to_include_bounding_box(self : BoundingBox, box : BoundingBox) -> Unit

    expand_to_include_bounding_box expands this bounding box to also cover box.

    BoundingBox::expand_to_include_point

    fn BoundingBox::expand_to_include_point(self : BoundingBox, point : Vec2) -> Unit

    expand_to_include_point expands this bounding box to include point.

    BoundingBox::from_points

    fn BoundingBox::from_points(points : Array[Vec2]) -> BoundingBox

    BoundingBox::from_points constructs the minimum bounding box containing points.

    BoundingBox::height

    fn BoundingBox::height(self : BoundingBox) -> Double

    height returns the height of the bounding box.

    BoundingBox::inset

    fn BoundingBox::inset(self : BoundingBox, n : Double) -> BoundingBox

    inset returns the bounding box inset by n, which may be negative. If either of the dimensions is less than 2*n then an empty bounding box near the center will be returned.

    BoundingBox::intersect

    fn BoundingBox::intersect(self : BoundingBox, s : BoundingBox) -> BoundingBox

    intersect returns the largest rectangle contained by both self and s. If the two rectangles do not overlap then an empty rectangle will be returned.

    BoundingBox::is_empty

    fn BoundingBox::is_empty(self : BoundingBox) -> Bool

    is_empty returns true if the bounding box has no area.

    BoundingBox::is_in

    fn BoundingBox::is_in(self : BoundingBox, s : BoundingBox) -> Bool

    is_in reports whether every point in self is in s.

    BoundingBox::is_inf

    fn BoundingBox::is_inf(self : BoundingBox) -> Bool

    is_inf returns true if either min or max is_inf.

    BoundingBox::is_nan

    fn BoundingBox::is_nan(self : BoundingBox) -> Bool

    is_nan returns true if either min or max is_nan.

    BoundingBox::max_reversed

    fn BoundingBox::max_reversed() -> BoundingBox

    BoundingBox::max_reversed returns a new BoundingBox with min=+infinity and max=-infinity.

    BoundingBox::new

    fn BoundingBox::new(min? : Vec2, max? : Vec2) -> BoundingBox

    BoundingBox::new returns a new empty BoundingBox.

    BoundingBox::overlaps

    fn BoundingBox::overlaps(self : BoundingBox, s : BoundingBox) -> Bool

    overlaps reports whether self and s have a non-empty intersection.

    BoundingBox::overlaps_bounding_box

    fn BoundingBox::overlaps_bounding_box(self : BoundingBox, box : BoundingBox) -> Bool

    overlaps_bounding_box returns true if any part of box overlaps this bounding box.

    BoundingBox::size

    fn BoundingBox::size(self : BoundingBox) -> Vec2

    size returns a vector representing the (width,height) of the bounding box.

    BoundingBox::union

    union returns the smallest bounding box that contains both self and s.

    BoundingBox::width

    fn BoundingBox::width(self : BoundingBox) -> Double

    width returns the width of the bounding box.

    Transform

    pub(all) struct Transform {
    position : Vec2
    rotation : Double
    scale : Vec2
    skew : Double
    origin : Vec2
    } derive(Eq,
    Debug
    )

    Transform represents transform arguments.
    impl Show for Transform

    Transform::new

    fn Transform::new(position? : Vec2, rotation? : Double, scale? : Vec2, skew? : Double, origin? : Vec2) -> Transform

    Transform::new returns a new identity transform.

    Vec2

    pub(all) struct Vec2 {
    x : Double
    y : Double
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Vec2 represents a 2D vector.
    impl Add for Vec2
    impl Div for Vec2
    impl Mul for Vec2
    impl Neg for Vec2
    impl Show for Vec2
    impl Sub for Vec2

    Vec2::add

    fn Vec2::add(self : Vec2, other : Vec2) -> Vec2

    Vec2::add_scalar

    fn Vec2::add_scalar(self : Vec2, s : Double) -> Vec2

    add_scalar adds scalar s to self and returns a new vector.

    Vec2::affine_transform

    fn Vec2::affine_transform(self : Vec2, affine_matrix : AffineMatrix) -> Vec2

    affine_transform transforms this Vec2 by the affine_matrix. This is used when transforming a point or position.

    Vec2::affine_transform_without_translation

    fn Vec2::affine_transform_without_translation(self : Vec2, affine_matrix : AffineMatrix) -> Vec2

    affine_transform_without_translation transforms this Vec2 by the affine_matrix but without performing translation. This is used when transforming a normal or tangent.

    Vec2::almost_equals

    fn Vec2::almost_equals(self : Vec2, other : Vec2, tolerance? : Double) -> Bool

    almost_equals returns true if the vectors are equal within the provided tolerance.

    Vec2::angle

    fn Vec2::angle(self : Vec2) -> Double

    angle returns the angle of this vector in degrees.

    Vec2::angle_radians

    fn Vec2::angle_radians(self : Vec2) -> Double

    angle_radians returns the angle of this vector in radians.

    Vec2::apply

    fn Vec2::apply(self : Vec2, func : (Double) -> Double) -> Vec2

    apply applies the provided func to both components of this vector and returns a new one.

    Vec2::ceil

    fn Vec2::ceil(self : Vec2) -> Vec2

    ceil rounds the components of this vector to the next-higher integer.

    Vec2::clone

    fn Vec2::clone(self : Vec2) -> Vec2

    clone returns a new copy of this Vec2.

    Vec2::copy

    fn Vec2::copy(self : Vec2, v : Vec2) -> Unit

    copy copies v into this Vec2.

    Vec2::cross

    fn Vec2::cross(self : Vec2, v : Vec2) -> Double

    cross returns the cross product between this vector and the vector v.

    Vec2::distance

    fn Vec2::distance(self : Vec2, v : Vec2) -> Double

    distance returns the distance from this vector to v.

    Vec2::distance_squared

    fn Vec2::distance_squared(self : Vec2, v : Vec2) -> Double

    distance_squared returns the squared distance from this vector to v.

    Vec2::distance_squared_tuple

    fn Vec2::distance_squared_tuple(a : (Double, Double), b : (Double, Double)) -> Double

    distance_squared_tuple returns the squared distance between two tuples.

    Vec2::dot

    fn Vec2::dot(self : Vec2, v : Vec2) -> Double

    dot returns the dot product between this vector and the vector v.

    Vec2::floor

    fn Vec2::floor(self : Vec2) -> Vec2

    floor rounds the components of this vector to the next-lower integer.

    Vec2::from_angle

    fn Vec2::from_angle(angle : Double) -> Vec2

    Vec2::from_angle returns a new unit Vec2 from an angle in degrees.

    Vec2::from_angle_radians

    fn Vec2::from_angle_radians(rad : Double) -> Vec2

    Vec2::from_angle_radians returns a new unit Vec2 from an angle in radians.

    Vec2::from_tuple

    fn Vec2::from_tuple(t : (Double, Double)) -> Vec2

    from_tuple creates a Vec2 from a tuple.

    Vec2::infinity

    fn Vec2::infinity() -> Vec2

    Vec2::infinity returns a new Vec2 with infinite x and y.

    Vec2::is_clockwise_from

    fn Vec2::is_clockwise_from(self : Vec2, v : Vec2) -> Bool

    is_clockwise_from returns true if this vector lies in the 180° region clockwise from v.

    Vec2::is_in

    fn Vec2::is_in(self : Vec2, box : BoundingBox) -> Bool

    Vec2::is_inf

    fn Vec2::is_inf(self : Vec2) -> Bool

    is_inf returns true if either component is infinite.

    Vec2::is_nan

    fn Vec2::is_nan(self : Vec2) -> Bool

    is_nan returns true if either component is NaN (not a number).

    Vec2::is_valid

    fn Vec2::is_valid(self : Vec2) -> Bool

    is_valid returns whether or not this Vec2 is valid.

    Vec2::is_zero

    fn Vec2::is_zero(self : Vec2) -> Bool

    is_zero returns true if both components of this vector are 0.

    Vec2::length

    fn Vec2::length(self : Vec2) -> Double

    length returns the length of this vector.

    Vec2::length_squared

    fn Vec2::length_squared(self : Vec2) -> Double

    length_squared returns the squared length of this vector.

    Vec2::max

    fn Vec2::max(self : Vec2, v : Vec2) -> Unit

    max compares the components of this vector and v and sets this vector's components to the maximum of the two.

    Vec2::min

    fn Vec2::min(self : Vec2, v : Vec2) -> Unit

    min compares the components of this vector and v and sets this vector's components to the minimum of the two.

    Vec2::mix

    fn Vec2::mix(self : Vec2, v : Vec2, t : Double) -> Vec2

    mix linearly interpolates this vector to the vector v by the mixing factor t (0..1) and returns a new one.

    Vec2::mul_scalar

    fn Vec2::mul_scalar(self : Vec2, s : Double) -> Vec2

    mul_scalar multiplies scalar s to self and returns a new vector.

    Vec2::neg_infinity

    fn Vec2::neg_infinity() -> Vec2

    Vec2::neg_infinity returns a new Vec2 with negative infinite x and y.

    Vec2::negate

    fn Vec2::negate(self : Vec2) -> Unit

    negate multiplies both components (in-place) by -1.

    Vec2::new

    fn Vec2::new(x? : Double, y? : Double) -> Vec2

    Vec2::new returns a new Vec2.

    Vec2::normalize

    fn Vec2::normalize(self : Vec2) -> Unit

    normalize scales this vector so that its length is 1. Note that this vector must already have a non-zero length.

    Vec2::project_onto

    fn Vec2::project_onto(self : Vec2, v : Vec2) -> Vec2

    project_onto projects this vector onto a non-zero vector v and returns a new one.

    Vec2::rotate

    fn Vec2::rotate(self : Vec2, angle : Double) -> Vec2

    rotate rotates this vector clockwise by angle in degrees.

    Vec2::rotate90

    fn Vec2::rotate90(self : Vec2) -> Vec2

    rotate90 rotates this vector clockwise by 90° and returns a new one.

    Vec2::rotate_neg90

    fn Vec2::rotate_neg90(self : Vec2) -> Vec2

    rotate_neg90 rotates this vector counter-clockwise by 90° and returns a new one.

    Vec2::rotate_radians

    fn Vec2::rotate_radians(self : Vec2, rad : Double) -> Vec2

    rotate_radians rotates this vector clockwise by rad in radians and returns a new one.

    Vec2::round

    fn Vec2::round(self : Vec2) -> Vec2

    round rounds the components of this vector to the next-higher integer.

    Vec2::round_to_fixed

    fn Vec2::round_to_fixed(self : Vec2, digits : Int) -> Vec2

    round_to_fixed rounds the components of this vector to the provided number of digits and returns a new one.

    Vec2::round_to_multiple

    fn Vec2::round_to_multiple(self : Vec2, v : Double) -> Vec2

    round_to_multiple rounds the components of this vector to the closest multiple of v and returns a new one.

    Vec2::self_add

    fn Vec2::self_add(self : Vec2, v : Vec2) -> Unit

    self_add adds the vector v to this vector.

    Vec2::self_add_scalar

    fn Vec2::self_add_scalar(self : Vec2, s : Double) -> Unit

    self_add_scalar adds scalar s to this vector.

    Vec2::self_div

    fn Vec2::self_div(self : Vec2, v : Vec2) -> Unit

    self_div divides this vector by vector v.

    Vec2::self_div_scalar

    fn Vec2::self_div_scalar(self : Vec2, s : Double) -> Unit

    self_div_scalar divides this vector by scalar s.

    Vec2::self_mul

    fn Vec2::self_mul(self : Vec2, v : Vec2) -> Unit

    self_mul multiplies the vector v to this vector.

    Vec2::self_mul_scalar

    fn Vec2::self_mul_scalar(self : Vec2, s : Double) -> Unit

    self_mul_scalar multiplies scalar s to this vector.

    Vec2::self_sub

    fn Vec2::self_sub(self : Vec2, v : Vec2) -> Unit

    self_sub subtracts the vector v from this vector.

    Vec2::self_sub_scalar

    fn Vec2::self_sub_scalar(self : Vec2, s : Double) -> Unit

    self_sub_scalar subtracts scalar s from this vector.

    Vec2::set

    fn Vec2::set(self : Vec2, x : Double, y : Double) -> Unit

    set sets the x and y components of this Vec2.

    Vec2::sub

    fn Vec2::sub(self : Vec2, other : Vec2) -> Vec2

    Vec2::to_tuple

    fn Vec2::to_tuple(self : Vec2) -> (Double, Double)

    to_tuple returns this Vec2 as a (Double, Double) tuple.

    Vec2::transform

    fn Vec2::transform(self : Vec2, position? : Vec2, rotation? : Double, scale? : Vec2, skew? : Double, origin? : Vec2) -> Vec2

    transform provides a convenient API for a common task.

    DEFAULT_TOLERANCE

    let DEFAULT_TOLERANCE : Double

    DEFAULT_TOLERANCE is the default tolerance used for floating point comparisons.

    bbox

    fn bbox(minx : Double, miny : Double, maxx : Double, maxy : Double) -> BoundingBox

    bbox is a convenience function.
    fn pt(x : Double, y : Double) -> Vec2

    pt is shorthand for vec2(x, y).

    rect

    fn rect(x0 : Double, y0 : Double, x1 : Double, y1 : Double) -> BoundingBox

    rect is shorthand for @draw.bbox(x0, y0, x1, y1). The returned bounding box has minimum and maximum coordinates swapped if necessary.

    round_to_fixed

    fn round_to_fixed(val : Double, digits : Int) -> Double

    round_to_fixed rounds a Double to the provided number of digits.

    vec2

    fn vec2(x : Double, y : Double) -> Vec2

    vec2 returns a new Vec2.