All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.math.axis_aligned.float32.AABBoxExtensions.kt Maven / Gradle / Ivy

package ru.casperix.math.axis_aligned.float32

import ru.casperix.math.geometry.Polygon2f
import ru.casperix.math.straight_line.float32.LineSegment2f


fun Polygon2f.getAABBox() : Box2f {
    val vertices = getVertices()
    return Box2f(
        vertices.reduce { a, b -> a.lower(b) },
        vertices.reduce { a, b -> a.upper(b) },
    )
}

fun LineSegment2f.getAABBox(): Box2f {
    return Box2f.byCorners(start, finish)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy