Sign in

    LING71671/moon_strtree/src/core/geometry does not have a README file

    Box3D

    pub struct Box3D {
    min_x : Double
    min_y : Double
    min_z : Double
    max_x : Double
    max_y : Double
    max_z : Double
    } derive(Default, Eq,
    Debug
    )

    Axis-Aligned Bounding Box (AABB) in continuous 3D space.

    Box3D::center_x

    fn Box3D::center_x(self : Box3D) -> Double

    Center X coordinate.

    Box3D::center_y

    fn Box3D::center_y(self : Box3D) -> Double

    Center Y coordinate.

    Box3D::center_z

    fn Box3D::center_z(self : Box3D) -> Double

    Center Z coordinate.

    Box3D::contains_box

    fn Box3D::contains_box(self : Box3D, other : Box3D) -> Bool

    Returns true if this box completely encloses another 3D box.

    Box3D::contains_point

    fn Box3D::contains_point(self : Box3D, x : Double, y : Double, z : Double) -> Bool

    Returns true if point (x, y, z) is contained within or on the boundaries of this 3D box.

    Box3D::default

    fn Box3D::default() -> Box3D

    Box3D::distance_squared_to_point

    fn Box3D::distance_squared_to_point(self : Box3D, x : Double, y : Double, z : Double) -> Double

    Computes squared Euclidean distance from this 3D box to point (x, y, z).

    Box3D::distance_to_box

    fn Box3D::distance_to_box(self : Box3D, other : Box3D) -> Double

    Computes minimum Euclidean distance between this 3D box and another 3D box. Returns 0.0 if boxes intersect or touch.

    Box3D::equal

    fn Box3D::equal(Box3D, Box3D) -> Bool

    Box3D::expand

    fn Box3D::expand(self : Box3D, delta : Double) -> Box3D

    Returns a new 3D box expanded uniformly by delta along all 6 faces.

    Box3D::from_point

    fn Box3D::from_point(x : Double, y : Double, z : Double) -> Box3D

    Constructs a degenerate zero-volume box centered at (x, y, z).

    Box3D::intersection

    fn Box3D::intersection(self : Box3D, other : Box3D) -> Box3D?

    Computes the intersection 3D box of two boxes, or None if disjoint.

    Box3D::intersects

    fn Box3D::intersects(self : Box3D, other : Box3D) -> Bool

    Returns true if this box intersects or touches another 3D box.

    Box3D::intersects_segment

    fn Box3D::intersects_segment(self : Box3D, x1 : Double, y1 : Double, z1 : Double, x2 : Double, y2 : Double, z2 : Double) -> Bool

    Returns true if this 3D box intersects the 3D line segment between (x1, y1, z1) and (x2, y2, z2).

    Box3D::intersects_sphere

    fn Box3D::intersects_sphere(self : Box3D, cx : Double, cy : Double, cz : Double, radius : Double) -> Bool

    Returns true if this 3D box intersects a sphere centered at (cx, cy, cz) with given radius.

    Box3D::iou

    fn Box3D::iou(self : Box3D, other : Box3D) -> Double

    Computes volumetric Intersection over Union (IoU) of two 3D boxes in [0.0, 1.0].

    Box3D::new

    fn Box3D::new(min_x : Double, min_y : Double, min_z : Double, max_x : Double, max_y : Double, max_z : Double) -> Box3D

    Constructs a new normalized Box3D where min <= max along all 3 axes.

    Box3D::not_equal

    fn Box3D::not_equal(x : Box3D, y : Box3D) -> Bool

    Box3D::surface_area

    fn Box3D::surface_area(self : Box3D) -> Double

    Computes total surface area of this 3D box.

    Box3D::to_repr

    Box3D::union

    fn Box3D::union(self : Box3D, other : Box3D) -> Box3D

    Returns the Minimum Bounding Box (MBB) enclosing both 3D boxes.

    Box3D::volume

    fn Box3D::volume(self : Box3D) -> Double

    Computes the volume of this 3D box.

    Box4D

    pub struct Box4D {
    min_x : Double
    min_y : Double
    min_z : Double
    min_t : Double
    max_x : Double
    max_y : Double
    max_z : Double
    max_t : Double
    } derive(Default, Eq,
    Debug
    )

    Axis-Aligned Spatiotemporal Bounding Box (4D Hypervolume) in continuous (x, y, z, t) space.

    Box4D::contains_box

    fn Box4D::contains_box(self : Box4D, other : Box4D) -> Bool

    Returns true if this box completely contains another 4D box.

    Box4D::contains_point

    fn Box4D::contains_point(self : Box4D, x : Double, y : Double, z : Double, t : Double) -> Bool

    Returns true if 4D coordinate (x, y, z, t) is contained within or on boundaries.

    Box4D::default

    fn Box4D::default() -> Box4D

    Box4D::equal

    fn Box4D::equal(Box4D, Box4D) -> Bool

    Box4D::expand

    fn Box4D::expand(self : Box4D, dx : Double, dy : Double, dz : Double, dt : Double) -> Box4D

    Expands 4D box by delta margins along each dimension.

    Box4D::from_point

    fn Box4D::from_point(x : Double, y : Double, z : Double, t : Double) -> Box4D

    Constructs a degenerate zero-hypervolume Box4D centered at (x, y, z, t).

    Box4D::hyper_volume

    fn Box4D::hyper_volume(self : Box4D) -> Double

    Computes the 4D hypervolume (length_x * length_y * length_z * length_t).

    Box4D::intersection

    fn Box4D::intersection(self : Box4D, other : Box4D) -> Box4D?

    Computes intersection of two 4D boxes, or None if disjoint.

    Box4D::intersects

    fn Box4D::intersects(self : Box4D, other : Box4D) -> Bool

    Returns true if this 4D box intersects another 4D box across all dimensions (x, y, z, t).

    Box4D::intersects_at_time

    fn Box4D::intersects_at_time(self : Box4D, other : Box4D, t : Double) -> Bool

    Checks if this 4D box intersects another at a specific instant of time t.

    Box4D::new

    fn Box4D::new(min_x : Double, min_y : Double, min_z : Double, min_t : Double, max_x : Double, max_y : Double, max_z : Double, max_t : Double) -> Box4D

    Constructs a new normalized Box4D where min <= max along each axis.

    Box4D::not_equal

    fn Box4D::not_equal(x : Box4D, y : Box4D) -> Bool

    Box4D::to_box3d

    fn Box4D::to_box3d(self : Box4D) -> Box3D

    Extracts the spatial 3D bounding box (Box3D) ignoring time dimension.

    Box4D::to_repr

    Box4D::union

    fn Box4D::union(self : Box4D, other : Box4D) -> Box4D

    Computes the Minimum Bounding Hypervolume enclosing both 4D boxes.

    Rect

    pub struct Rect {
    min_x : Double
    min_y : Double
    max_x : Double
    max_y : Double
    } derive(Default, Eq,
    Debug
    )

    Axis-Aligned Bounding Box (AABB) in continuous 2D space.

    Rect::area

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

    Returns the area of the rectangle.

    Rect::center_x

    fn Rect::center_x(self : Rect) -> Double

    Returns the horizontal center coordinate.

    Rect::center_y

    fn Rect::center_y(self : Rect) -> Double

    Returns the vertical center coordinate.

    Rect::contains

    fn Rect::contains(self : Rect, other : Rect) -> Bool

    Returns true if this rectangle contains another rectangle with non-empty interior intersection.

    Rect::contains_point

    fn Rect::contains_point(self : Rect, x : Double, y : Double) -> Bool

    Returns true if point (x, y) is contained within or on the boundaries of this rectangle.

    Rect::contains_rect

    fn Rect::contains_rect(self : Rect, other : Rect) -> Bool

    Returns true if this rectangle completely contains another rectangle.

    Rect::covered_by

    fn Rect::covered_by(self : Rect, other : Rect) -> Bool

    Returns true if this rectangle is topologically covered by another rectangle.

    Rect::covers

    fn Rect::covers(self : Rect, other : Rect) -> Bool

    Returns true if this rectangle topologically covers another rectangle.

    Rect::default

    fn Rect::default() -> Rect

    Rect::disjoint

    fn Rect::disjoint(self : Rect, other : Rect) -> Bool

    Returns true if two rectangles are completely disjoint (no common points).

    Rect::distance_squared_to_point

    fn Rect::distance_squared_to_point(self : Rect, x : Double, y : Double) -> Double

    Computes the minimum squared Euclidean distance from this rectangle to a point (x, y). Returns 0.0 if the point is inside or on the boundary of the rectangle.

    Rect::distance_squared_to_rect

    fn Rect::distance_squared_to_rect(self : Rect, other : Rect) -> Double

    Computes minimum squared Euclidean distance between two rectangles. Returns 0.0 if the rectangles intersect.

    Rect::distance_to_point

    fn Rect::distance_to_point(self : Rect, x : Double, y : Double) -> Double

    Computes minimum Euclidean distance from this rectangle to a point.

    Rect::distance_to_rect

    fn Rect::distance_to_rect(self : Rect, other : Rect) -> Double

    Computes minimum Euclidean distance between two rectangles.

    Rect::equal

    fn Rect::equal(Rect, Rect) -> Bool

    Rect::equals_exact

    fn Rect::equals_exact(self : Rect, other : Rect) -> Bool

    Returns true if two rectangles have identical boundaries.

    Rect::evaluate_predicate

    fn Rect::evaluate_predicate(self : Rect, other : Rect, predicate : SpatialPredicate) -> Bool

    Evaluates a named spatial predicate between two rectangles.

    Rect::expand

    fn Rect::expand(self : Rect, delta : Double) -> Rect

    Returns a new rectangle expanded uniformly by delta on all 4 sides. If delta is negative, the rectangle shrinks (normalized so min <= max).

    Rect::from_point

    fn Rect::from_point(x : Double, y : Double) -> Rect

    Constructs a degenerate zero-area rectangle centered at (x, y).

    Rect::height

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

    Returns the height of the rectangle.

    Rect::intersection

    fn Rect::intersection(self : Rect, other : Rect) -> Rect?

    Computes the intersection rectangle of two rectangles. Returns None if the rectangles do not intersect.

    Rect::intersects

    fn Rect::intersects(self : Rect, other : Rect) -> Bool

    Returns true if this rectangle intersects or touches another rectangle.

    Rect::intersects_circle

    fn Rect::intersects_circle(self : Rect, cx : Double, cy : Double, radius : Double) -> Bool

    Returns true if this rectangle intersects or touches a circle centered at (cx, cy) with given radius.

    Rect::intersects_segment

    fn Rect::intersects_segment(self : Rect, x1 : Double, y1 : Double, x2 : Double, y2 : Double) -> Bool

    Returns true if this rectangle intersects the line segment between (x1, y1) and (x2, y2).

    Rect::iou

    fn Rect::iou(self : Rect, other : Rect) -> Double

    Computes Intersection over Union (IoU) metric in [0.0, 1.0].

    Rect::is_valid

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

    Validates that coordinates are non-NaN and min <= max.

    Rect::new

    fn Rect::new(min_x : Double, min_y : Double, max_x : Double, max_y : Double) -> Rect

    Constructs a new normalized Rect where min_x <= max_x and min_y <= max_y.

    Rect::not_equal

    fn Rect::not_equal(x : Rect, y : Rect) -> Bool

    Rect::overlaps

    fn Rect::overlaps(self : Rect, other : Rect) -> Bool

    Returns true if two rectangles overlap (interiors intersect, but neither covers the other).

    Rect::relate

    fn Rect::relate(self : Rect, other : Rect) -> String

    Computes the Dimensionally Extended 9-Intersection Model (DE-9IM) matrix string (9 characters).

    Rect::to_repr

    Rect::touches

    fn Rect::touches(self : Rect, other : Rect) -> Bool

    Returns true if this rectangle touches another rectangle (boundaries intersect, interiors disjoint).

    Rect::union

    fn Rect::union(self : Rect, other : Rect) -> Rect

    Returns the Minimum Bounding Rectangle (MBR) enclosing both rectangles.

    Rect::width

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

    Returns the width of the rectangle.

    Rect::within

    fn Rect::within(self : Rect, other : Rect) -> Bool

    Returns true if this rectangle is within another rectangle.

    SpatialPredicate

    pub(all) enum SpatialPredicate {
    Intersects
    Contains
    Within
    Touches
    Overlaps
    Disjoint
    Equals
    Covers
    CoveredBy
    } derive(Eq,
    Debug
    )

    Named spatial predicates for Dimensionally Extended 9-Intersection Model (DE-9IM).

    SpatialPredicate::equal

    SpatialPredicate::from_string

    fn SpatialPredicate::from_string(name : String) -> SpatialPredicate?

    Parses a string representation into a SpatialPredicate.

    SpatialPredicate::not_equal

    fn SpatialPredicate::not_equal(x : SpatialPredicate, y : SpatialPredicate) -> Bool

    SpatialPredicate::to_string

    fn SpatialPredicate::to_string(self : SpatialPredicate) -> String

    Converts a SpatialPredicate into its standard name string.

    Triangle3D

    pub struct Triangle3D {
    p0_x : Double
    p0_y : Double
    p0_z : Double
    p1_x : Double
    p1_y : Double
    p1_z : Double
    p2_x : Double
    p2_y : Double
    p2_z : Double
    } derive(Default, Eq,
    Debug
    )

    3D Triangle represented by three 3D vertices in continuous space.

    Triangle3D::area

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

    Computes the surface area of the triangle.

    Triangle3D::centroid

    fn Triangle3D::centroid(self : Triangle3D) -> (Double, Double, Double)

    Computes the centroid (arithmetic center) of the triangle.

    Triangle3D::default

    fn Triangle3D::default() -> Triangle3D

    Triangle3D::equal

    fn Triangle3D::equal(Triangle3D, Triangle3D) -> Bool

    Triangle3D::intersects_segment

    fn Triangle3D::intersects_segment(self : Triangle3D, x1 : Double, y1 : Double, z1 : Double, x2 : Double, y2 : Double, z2 : Double) -> Bool

    Tests if a finite 3D line segment (x1, y1, z1) -> (x2, y2, z2) intersects the triangle.

    Triangle3D::new

    fn Triangle3D::new(p0_x : Double, p0_y : Double, p0_z : Double, p1_x : Double, p1_y : Double, p1_z : Double, p2_x : Double, p2_y : Double, p2_z : Double) -> Triangle3D

    Constructs a new Triangle3D with vertices (p0, p1, p2).

    Triangle3D::normal

    fn Triangle3D::normal(self : Triangle3D) -> (Double, Double, Double)

    Computes the surface normal vector of the triangle (unnormalized if degenerate, normalized otherwise).

    Triangle3D::not_equal

    fn Triangle3D::not_equal(x : Triangle3D, y : Triangle3D) -> Bool

    Triangle3D::ray_intersection

    fn Triangle3D::ray_intersection(self : Triangle3D, ox : Double, oy : Double, oz : Double, dx : Double, dy : Double, dz : Double) -> Double?

    Tests if a 3D ray from (ox, oy, oz) with direction (dx, dy, dz) intersects the triangle. Returns Some(t) where t >= 0.0 is the ray distance if hit, or None if missed. Implemented using the two-sided Möller–Trumbore intersection algorithm.

    Triangle3D::to_box

    fn Triangle3D::to_box(self : Triangle3D) -> Box3D

    Computes the tight Axis-Aligned Bounding Box (Box3D) enclosing the triangle.

    matches_de9im_pattern

    fn matches_de9im_pattern(matrix : String, pattern : String) -> Bool

    Checks whether a 9-character DE-9IM intersection matrix matches an intersection pattern.