Monte Carlo eXtreme (MCX)
|
3D shape parsing and rasterization unit More...
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "cjson/cJSON.h"
#include "mcx_shapes.h"
Macros | |
#define | MIN(a, b) ((a)<(b)?(a):(b)) |
#define | MAX(a, b) ((a)>(b)?(a):(b)) |
Functions | |
int | mcx_load_jsonshapes (Grid3D *g, char *fname) |
Load a JSON-formatted shape file and process. More... | |
int | mcx_parse_shapestring (Grid3D *g, char *shapedata) |
Load JSON-formatted shape definitions from a string. More... | |
int | mcx_parse_jsonshapes (cJSON *root, Grid3D *g) |
Parse a JSON-formatted shape file and rasterize the objects to the volume. More... | |
int | mcx_raster_origin (cJSON *obj, Grid3D *g) |
Reset the origin of the domain, default is [0,0,0]. More... | |
int | mcx_raster_sphere (cJSON *obj, Grid3D *g) |
Rasterize a 3D sphere and add to the volume. More... | |
int | mcx_raster_subgrid (cJSON *obj, Grid3D *g) |
Rasterize a 3D rectangular region and add to the volume. More... | |
int | mcx_raster_box (cJSON *obj, Grid3D *g) |
Rasterize a 3D rectangular region and add to the volume. More... | |
int | mcx_raster_cylinder (cJSON *obj, Grid3D *g) |
Rasterize a finite 3D cylindrical region and add to the volume. More... | |
int | mcx_raster_slabs (cJSON *obj, Grid3D *g) |
Rasterize a 3D layered-slab structure and add to the volume. More... | |
int | mcx_raster_layers (cJSON *obj, Grid3D *g) |
Rasterize a 3D layer structure and add to the volume. More... | |
int | mcx_raster_upperspace (cJSON *obj, Grid3D *g) |
Rasterize a 3D semi-space region and add to the volume. More... | |
int | mcx_raster_grid (cJSON *obj, Grid3D *g) |
Recreate the background grid with a different dimension or medium. More... | |
int | mcx_find_shapeid (char *shapename) |
Look up the JSON object tag and return the index to the processing function. More... | |
char * | mcx_last_shapeerror () |
return the last error message encountered in the processing | |
Variables | |
const char * | ShapeTags [] |
int(* | Rasterizers [])(cJSON *obj, Grid3D *g) |
char | ErrorMsg [MAX_SHAPE_ERR] = {'\0'} |
3D shape parsing and rasterization unit
In this unit, we load and parse a JSON-formatted shape file, rasterize the 3D objects and subsequently add to a voxelated volume.
int mcx_find_shapeid | ( | char * | shapename | ) |
Look up the JSON object tag and return the index to the processing function.
shapename | The string of the JSON shape object |
int mcx_load_jsonshapes | ( | Grid3D * | g, |
char * | fname | ||
) |
Load a JSON-formatted shape file and process.
g | A structure pointing to the volume and dimension data |
fname | The file name string to the JSON shape file |
int mcx_parse_jsonshapes | ( | cJSON * | root, |
Grid3D * | g | ||
) |
Parse a JSON-formatted shape file and rasterize the objects to the volume.
root | A cJSON pointer points to the root obj of the shape block |
g | A structure pointing to the volume and dimension data |
int mcx_parse_shapestring | ( | Grid3D * | g, |
char * | shapedata | ||
) |
Load JSON-formatted shape definitions from a string.
g | A structure pointing to the volume and dimension data |
shapedata | A string containg the JSON shape data |
int mcx_raster_box | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Rasterize a 3D rectangular region and add to the volume.
obj | A cJSON pointer points to the rectangular obj block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_cylinder | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Rasterize a finite 3D cylindrical region and add to the volume.
obj | A cJSON pointer points to the cylindrical obj block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_grid | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Recreate the background grid with a different dimension or medium.
obj | A cJSON pointer points to the background grid block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_layers | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Rasterize a 3D layer structure and add to the volume.
obj | A cJSON pointer points to the layer structure block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_origin | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Reset the origin of the domain, default is [0,0,0].
obj | A cJSON pointer points to the Origin obj block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_slabs | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Rasterize a 3D layered-slab structure and add to the volume.
obj | A cJSON pointer points to the layered-slab structure block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_sphere | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Rasterize a 3D sphere and add to the volume.
obj | A cJSON pointer points to the sphere obj block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_subgrid | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Rasterize a 3D rectangular region and add to the volume.
obj | A cJSON pointer points to the rectangular obj block |
g | A structure pointing to the volume and dimension data |
int mcx_raster_upperspace | ( | cJSON * | obj, |
Grid3D * | g | ||
) |
Rasterize a 3D semi-space region and add to the volume.
obj | A cJSON pointer points to the semi-space object block |
g | A structure pointing to the volume and dimension data |
int(* Rasterizers[])(cJSON *obj, Grid3D *g) |
const char* ShapeTags[] |