Module pasture_core::math[][src]

Useful mathematical tools when working with point clooud data

Structs

AABB

3D axis-aligned bounding box

DynamicMortonIndex

3D Morton index with a dynamic depth

DynamicMortonIndexTooLargeError

Error for a DynamicMortonIndex that is too large (i.e. it has too many levels) to be converted into one of the fixed-size Morton index types (e.g. MortonIndex64, MortonIndex64WithDepth)

MortonIndex64

64-bit 3D Morton index

MortonIndex64WithDepth

64-bit 3D Morton index with depth information. This is the more efficient, but more constraint version of DynamicMortonIndex because it can store at maximum 21 levels. Important note: Since a Morton index defines a node in an octree, one has to define what index the root node has. As each 3 bits within a 3D Morton index identify an octant at a certain level, there is no level that defines the root node since it is just a single node. We now define that the root node is always at level 0, so the level parameter of this structure is always relative to the root node. A MortonIndex64WithLevel with a level of 0 is therefore always zero. The first octant lies at level 1. This can be a bit confusing because it makes the code prone to off-by-one errors, however it is better than the alternative (IMO) where root node has level -1, or None.

Octant

Wrapper type around an u8 that encodes the index of an octant within an octree. Since there are only 8 possible octants, this type is only valid for values in [0;7] and acts as a safeguard to prevent out-of-bounds errors when passing around and setting octant indices

OctantIndexOutOfBoundsError

Error type for an octant index that is out of bounds

Enums

MortonIndexNaming

Defines different ways of turning a Morton index into a string

Traits

Alignable

Trait for aligning a numeric value to a given byte boundary

MinMax

Helper trait for computing minimum and maximum values for types. This is used in conjunction with PrimitiveType to enable min/max computations even for vector types

Functions

expand_bits_by_3

Inserts two zero-bits before any two bits of val

reverse_bits

Reverse the bits in the given 64-bit value, turning the MSB into the LSB and vice versa