vNd.h
Go to the documentation of this file.
1 /*
2  *
3  * vNd.h
4  *
5  * Routines for voxelizing (analytic volume sampling)
6  * polyhedra to a regular Cartesian grid using rNd.
7  *
8  * Devon Powell
9  * 9 August 2016
10  *
11  * Copyright (c) 2015, The Board of Trustees of the Leland Stanford Junior University,
12  * through SLAC National Accelerator Laboratory (subject to receipt of any required approvals
13  * from the U.S. Dept. of Energy). All rights reserved. Redistribution and use in source and
14  * binary forms, with or without modification, are permitted provided that the following
15  * conditions are met:
16  * (1) Redistributions of source code must retain the above copyright notice,
17  * this list of conditions and the following disclaimer.
18  * (2) Redistributions in binary form must reproduce the above copyright notice,
19  * this list of conditions and the following disclaimer in the documentation and/or other
20  * materials provided with the distribution.
21  * (3) Neither the name of the Leland Stanford Junior University, SLAC National Accelerator
22  * Laboratory, U.S. Dept. of Energy nor the names of its contributors may be used to endorse
23  * or promote products derived from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
26  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER, THE UNITED STATES GOVERNMENT, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
33  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  * You are under no obligation whatsoever to provide any bug fixes, patches, or upgrades to
36  * the features, functionality or performance of the source code ("Enhancements") to anyone;
37  * however, if you choose to make your Enhancements available either publicly, or directly to
38  * SLAC National Accelerator Laboratory, without imposing a separate written license agreement
39  * for such Enhancements, then you hereby grant the following license: a non-exclusive,
40  * royalty-free perpetual license to install, use, modify, prepare derivative works,
41  * incorporate into other computer software, distribute, and sublicense such Enhancements or
42  * derivative works thereof, in binary and source code form.
43  *
44  */
45 
46 #ifndef _VND_H_
47 #define _VND_H_
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 #include "rNd.h"
54 
85 void rNd_voxelize(rNd_poly* poly, rNd_dvec ibox[2], rNd_real* dest_grid, rNd_rvec d, rNd_int polyorder);
86 
104 void rNd_clamp_ibox(rNd_poly* poly, rNd_dvec ibox[2], rNd_dvec clampbox[2], rNd_rvec d);
105 
119 void rNd_get_ibox(rNd_poly* poly, rNd_dvec ibox[2], rNd_rvec d);
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif // _VND_H_
void rNd_clamp_ibox(rNd_poly *poly, rNd_dvec ibox[2], rNd_dvec clampbox[2], rNd_rvec d)
Get the minimal box of grid indices for a polyhedron, given a grid cell spacing, also clamping it to ...
double rNd_real
Real type specifying the precision to be used in calculations.
Definition: rNd.h:52
A N-vector.
Definition: rNd.h:64
void rNd_get_ibox(rNd_poly *poly, rNd_dvec ibox[2], rNd_rvec d)
Get the minimal box of grid indices for a polyhedron, given a grid cell spacing.
int32_t rNd_int
Integer type used for indexing.
Definition: rNd.h:58
An RND_DIM-dimensional polytope.
Definition: rNd.h:95
An integer N-vector for grid indexing.
Definition: rNd.h:71
Interface for rNd.
void rNd_voxelize(rNd_poly *poly, rNd_dvec ibox[2], rNd_real *dest_grid, rNd_rvec d, rNd_int polyorder)
Voxelize a polyhedron to the destination grid.