Definitions for functions to manipulate and calculate block values.
#include <stdint.h>
#include "routing_table.h"
Go to the source code of this file.
|
uint8_t | weighted_average (void) |
| Calculates a block value based on the on the weighted average of neighbors block values.
|
|
uint8_t | inverse (uint8_t bv) |
| Returns the inverse of the supplied block value.
|
|
uint8_t | minimum (void) |
| Returns the smallest block value from neighboring blocks.
|
|
uint8_t | maximum (void) |
| Returns the largest block value from neighboring blocks.
|
|
void | set_block_value (uint32_t id, uint8_t bv) |
| Manually override the block value of a specific block in the construction.
|
|
uint8_t | get_block_value (uint32_t id) |
| Get the block value of a remote Cubelet.
|
|
◆ weighted_average()
uint8_t weighted_average |
( |
void | | ) |
|
Calculates the average of the block values from surrounding neighbors. With closer neighbors being weighted heavier than neighbors far away.
- Returns
- The weighed average of neighbor block values. 0-255.
◆ inverse()
uint8_t inverse |
( |
uint8_t | bv | ) |
|
Returns the inverse of the supplied block value. 255->0 0->255.
- Parameters
-
bv | The block value to invert |
- Returns
- The inverse of the supplied block value. Unsigned byte 0-255.
◆ minimum()
Returns the smallest block value from neighboring blocks with a valid block value.
- Returns
- The minimum block value of neighboring blocks. 0-255
◆ maximum()
Returns the largest block value from neighboring blocks with a valid block value.
- Returns
- The largest block value of neighboring blocks. 0-255
◆ set_block_value()
void set_block_value |
( |
uint32_t | id, |
|
|
uint8_t | bv ) |
Manually override the block value of a specific block in the construction.
- Parameters
-
id | The ID of the Cubelet to override |
bv | The block value to set for the remote Cubelet |
◆ get_block_value()
uint8_t get_block_value |
( |
uint32_t | id | ) |
|
Get the blov value of a Cubelet from it's ID
- Parameters
-
id | The ID of block you wish to retrieve the block value for |
- Returns
- The block value of the Cubelet that hss the specified ID