The utilities package is the standard home for shared functions which many modules may use. The spirit of utilities is also to isolate sections of critical code so that unit tests can be used to ensure a minimum of bugginess.
Colorizers.
Utilities for coordinate handling and munging.
Adjust a set of coords according to a face.
The face is a standard string descriptor, such as “+x”.
The “noop” face is supported.
Split a pair of coordinates into chunk and subchunk coordinates.
Parameters: | |
---|---|
Returns: | a tuple of the X chunk, X subchunk, Z chunk, and Z subchunk |
More affectionately known as “bit-twiddling.”
General decorators for a variety of purposes.
This is Bresenham’s algorithm with a little twist: all the blocks that intersect with the line are yielded.
Generalization of Bresenham’s line algorithm in 3d.
It yields blocks coordinates along a line that is at all times only one block in width.
It is a simplified version that does nothing fancy with integers or such: all computation is done on float (maybe it should be changed?)
Bases: bravo.utilities.spatial.SpatialDict
Class for tracking blocks in the XZ-plane.
Bases: bravo.utilities.spatial.SpatialDict
Class for tracking blocks in the XZ-plane.
Bases: object, UserDict.DictMixin
A spatial dictionary, for accelerating spatial lookups.
This particular class is a template for specific spatial dictionaries; in order to make it work, subclass it and add key_for_bucket().
Create a Morton number by interleaving the bits of two numbers.
This can be used to map 2D coordinates into the integers.
Inputs will be masked off to 16 bits, unsigned.
Evaluate a rotated 3D sinusoidal wave at a given point, angle, and wavelength.
The function used is:
This function has a handful of useful properties; it has a local minimum at f(0, 0) and oscillates infinitely betwen 0 and 1.
Parameters: | |
---|---|
Returns: | float of f(x, y) |