BRL-CAD
voxels.c File Reference
#include "common.h"
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "vmath.h"
#include "raytrace.h"
#include "analyze.h"
Include dependency graph for voxels.c:

Go to the source code of this file.

Functions

HIDDEN struct voxelRegiongetRegionByName (struct voxelRegion *head, const char *regionName)
 
int hit_voxelize (struct application *ap, struct partition *PartHeadp, struct seg *segs)
 
void voxelize (struct rt_i *rtip, fastf_t sizeVoxel[3], int levelOfDetail, void(*create_boxes)(void *callBackData, int x, int y, int z, const char *regionName, fastf_t percentageFill), void *callBackData)
 

Function Documentation

HIDDEN struct voxelRegion* getRegionByName ( struct voxelRegion head,
const char *  regionName 
)

Function to get the corresponding region entry to a region name.

Definition at line 38 of file voxels.c.

References BU_ALLOC, BU_ASSERT, bu_strcmp(), bu_strdup, voxelRegion::nextRegion, and voxelRegion::regionName.

Referenced by hit_voxelize().

Here is the call graph for this function:

int hit_voxelize ( struct application ap,
struct partition PartHeadp,
struct seg segs 
)

rt_shootray() was told to call this on a hit.

This callback routine utilizes the application structure which describes the current state of the raytrace.

This callback routine is provided a circular linked list of partitions, each one describing one in and out segment of one region for each region encountered.

The 'segs' segment list is unused in this example.

hitInp, hitOutp are hit structures to save distances where ray entered and exited the present partition. hitDistIn, hitDistOut are the respective distances from the origin of ray. voxelNumIn, voxelNumOut are the voxel numbers where ray entered and exited the present partition.

If voxel entered and voxel exited are same then nothing can be evaluated till we see the next partition too. If not, evaluate entry voxel. Also, all the intermediate voxels are in.

Definition at line 85 of file voxels.c.

References application::a_uptr, rayInfo::fillDistances, FMAX, getRegionByName(), hit::hit_dist, partition::pt_forw, partition::pt_inhit, partition::pt_outhit, partition::pt_regionp, region::reg_name, voxelRegion::regionDistance, rayInfo::regionList, and rayInfo::sizeVoxel.

Referenced by voxelize().

Here is the call graph for this function:

void voxelize ( struct rt_i rtip,
fastf_t  sizeVoxel[3],
int  levelOfDetail,
void(*)(void *callBackData, int x, int y, int z, const char *regionName, fastf_t percentageFill)  create_boxes,
void *  callBackData 
)

voxelize function takes raytrace instance and user parameters as inputs

Definition at line 147 of file voxels.c.

References application::a_hit, application::a_miss, application::a_onehit, application::a_ray, application::a_rt_i, application::a_uptr, BU_ASSERT_LONG, bu_calloc(), bu_free(), BU_FREE, create_boxes(), rayInfo::fillDistances, hit_voxelize(), rt_i::mdl_max, rt_i::mdl_min, voxelRegion::nextRegion, xray::r_dir, xray::r_pt, voxelRegion::regionDistance, rayInfo::regionList, voxelRegion::regionName, RT_APPLICATION_INIT, rt_prep_parallel(), rt_shootray(), rayInfo::sizeVoxel, and VSET.

Referenced by ged_voxelize().

Here is the call graph for this function: