home | project pages | download | documentation | doxygen | contact |
#include <VoxTree.h>
The VoxTree includes the memory menagement of all of the nodes in the octtree.
Public Member Functions | |
VoxTree (double _size) | |
Construct a voxel space. | |
~VoxTree (void) | |
void | generatePOVCode (void) |
Generate POV-RAY code. | |
void | addCSGObject (const CSGObject *obj, VoxOperation &csg_op) |
Render a CSG object into voxel space. | |
void | prune (void) |
Reduce the memory footprint of the voxel space. | |
Public Attributes | |
uint64_t | nr_nodes_created |
A counter showing the number of nodes created. | |
uint64_t | nr_nodes_destroyed |
A counter showing the number of nodes removed. | |
Private Member Functions | |
uint32_t | alloc (void) |
Alocate a new oct-tree node. | |
void | free (uint32_t node_nr) |
Frees an oct-tree node. | |
void | checkSize (void) |
Checks and resizes the available memory for holding the nodes. | |
Voxel | pruneVoxel (uint32_t node_nr, const VoxCoord &coord, int voxel_index) |
Optimizes the voxel tree. | |
Voxel | pruneNode (uint32_t node_nr, const VoxCoord &coord) |
Optimizes the voxel tree. | |
Voxel | addCSGObjectToVoxel (uint32_t node_nr, const VoxCoord &coord, int voxel_index, const CSGObject *obj, VoxOperation &csg_op) |
Adds an CSG object to a voxel. | |
Voxel | addCSGObjectToNode (uint32_t node_nr, const VoxCoord &coord, const CSGObject *obj, VoxOperation &csg_op) |
Adds an CSG object to a voxel. | |
void | generatePOVCodeForVoxel (uint32_t node_nr, const VoxCoord &coord, int voxel_index) |
Generate POVRAY code. | |
void | generatePOVCodeForNode (uint32_t node_nr, const VoxCoord &coord) |
Generate POVRAY code. | |
Private Attributes | |
FreeList | free_list |
uint32_t | nodes_size |
vox_node_t * | nodes |
uint32_t | root |
double | size |
The length of each axis of voxel space. | |
double | scale |
The size of the smallest possible voxel. |
camvox::VoxTree::VoxTree | ( | double | _size | ) |
Construct a voxel space.
_size | size of each axis of the voxel space in mm, inches or anything else. but make sure that you keep units consistant troughout. |
camvox::VoxTree::~VoxTree | ( | void | ) |
uint32_t camvox::VoxTree::alloc | ( | void | ) | [inline, private] |
Alocate a new oct-tree node.
This takes a node from the free list, this is garanteed to be the lowest value available.
void camvox::VoxTree::free | ( | uint32_t | node_nr | ) | [inline, private] |
Frees an oct-tree node.
This returns the node back to the free list.
node_nr | The node_nr of the node to be freed. |
void camvox::VoxTree::checkSize | ( | void | ) | [private] |
Checks and resizes the available memory for holding the nodes.
This should be run everytime a new node gets allocated. It increases the size of the buffer by 50%. Because the nodes may be moved in memory after this call, one should always use node_nrs when accesing nodes.
Voxel camvox::VoxTree::pruneVoxel | ( | uint32_t | node_nr, | |
const VoxCoord & | coord, | |||
int | voxel_index | |||
) | [private] |
Optimizes the voxel tree.
Optimizes the voxel tree.
Voxel camvox::VoxTree::addCSGObjectToVoxel | ( | uint32_t | node_nr, | |
const VoxCoord & | coord, | |||
int | voxel_index, | |||
const CSGObject * | obj, | |||
VoxOperation & | csg_op | |||
) | [private] |
Adds an CSG object to a voxel.
Voxel camvox::VoxTree::addCSGObjectToNode | ( | uint32_t | node_nr, | |
const VoxCoord & | coord, | |||
const CSGObject * | obj, | |||
VoxOperation & | csg_op | |||
) | [private] |
Adds an CSG object to a voxel.
void camvox::VoxTree::generatePOVCodeForVoxel | ( | uint32_t | node_nr, | |
const VoxCoord & | coord, | |||
int | voxel_index | |||
) | [private] |
void camvox::VoxTree::generatePOVCodeForNode | ( | uint32_t | node_nr, | |
const VoxCoord & | coord | |||
) | [private] |
void camvox::VoxTree::generatePOVCode | ( | void | ) |
Generate POV-RAY code.
This method outputs a POV-RAY file representing the oct-tree. It writes out a set of boxes in different colors, each one node of the oct-tree.
void camvox::VoxTree::addCSGObject | ( | const CSGObject * | obj, | |
VoxOperation & | csg_op | |||
) |
Render a CSG object into voxel space.
obj | An CSGObject, either a primative or a compound object. | |
new_data | The new data and the command to be executed when a voxel is inside the CSG Object. |
void camvox::VoxTree::prune | ( | void | ) |
Reduce the memory footprint of the voxel space.
addCSGObject* alreay automatically prune, so this function rarelly needs to be called.
FreeList camvox::VoxTree::free_list [private] |
uint32_t camvox::VoxTree::nodes_size [private] |
vox_node_t* camvox::VoxTree::nodes [private] |
uint32_t camvox::VoxTree::root [private] |
double camvox::VoxTree::size [private] |
The length of each axis of voxel space.
double camvox::VoxTree::scale [private] |
The size of the smallest possible voxel.
uint64_t camvox::VoxTree::nr_nodes_created |
A counter showing the number of nodes created.
uint64_t camvox::VoxTree::nr_nodes_destroyed |
A counter showing the number of nodes removed.