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.
Simple pixel graphics helpers.
Retrieve the first integer set of coordinates on the line from the first point to the second point.
The set of coordinates corresponding to the first point will not be retrieved.
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().
Clamp or saturate a number to be no lower than a minimum and no higher than a maximum.
Implemented as its own function simply because it’s so easy to mess up when open-coded.
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) |