Node3

Type Alias Node3 

Source
pub type Node3<T, L> = NodeN<T, L, 3, 8>;
Expand description

A 3D node in the tree

Aliased Type§

pub enum Node3<T, L> {
    Branch {
        nodes: Box<[NodeN<T, L, 3, 8>; 8]>,
        center: VecN<T, 3>,
        mass: T,
        center_of_mass: VecN<T, 3>,
        width: T,
    },
    Leaf {
        body: Option<L>,
        pos: (VecN<T, 3>, VecN<T, 3>),
    },
}

Variants§

§

Branch

Quadrant

Fields

§nodes: Box<[NodeN<T, L, 3, 8>; 8]>

Nodes in this quadrant

§center: VecN<T, 3>

Geometric center of this quadrant

§mass: T

Cumulated mass of the nodes in this quadrant

§center_of_mass: VecN<T, 3>

Center of mass of the nodes in this quadrant

§width: T

Width

§

Leaf

Body

Fields

§body: Option<L>

Body or not body, that is the question

§pos: (VecN<T, 3>, VecN<T, 3>)

Position (or the position of a quadrant’s corner if there is no body)

Trait Implementations§

Source§

impl<T: Real, C: Clone, L: Body<T, C, 3>> Node<T, C, L, 3> for Node3<T, L>

Source§

fn new(pos: (Vec3<T>, Vec3<T>)) -> Self

Create a node with given AABB points
Source§

fn add_body(&mut self, new_body: L, depth: usize)

Add a body to the node, at a given recursion depth
Source§

fn apply<F1: Fn(Vec3<T>, Vec3<T>, T, T, C) -> Vec3<T>, F2: Fn(Vec3<T>, Vec3<T>, T, T, C, C) -> Vec3<T>>( &self, on: Vec3<T>, theta: T, custom: C, f1: &F1, f2: &F2, ) -> Vec3<T>

Compute the force applied on a virtual body at a given position