test_helpers.h
Go to the documentation of this file.
1 /*
2  *
3  * test_helpers.h
4  *
5  * Helper function declarations for r3d unit testing.
6  *
7  * Devon Powell
8  * 31 August 2015
9  *
10  * This program was prepared by Los Alamos National Security, LLC at Los Alamos National
11  * Laboratory (LANL) under contract No. DE-AC52-06NA25396 with the U.S. Department of Energy (DOE).
12  * All rights in the program are reserved by the DOE and Los Alamos National Security, LLC.
13  * Permission is granted to the public to copy and use this software without charge, provided that
14  * this Notice and any statement of authorship are reproduced on all copies. Neither the U.S.
15  * Government nor LANS makes any warranty, express or implied, or assumes any liability
16  * or responsibility for the use of this software.
17  *
18  */
19 
20 #ifndef _TEST_HELPERS_H_
21 #define _TEST_HELPERS_H_
22 
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <time.h>
27 #include <math.h>
28 
29 #include "r3d.h"
30 #include "r2d.h"
31 #include "rNd.h"
32 
33 #include "v3d.h"
34 #include "v2d.h"
35 #include "vNd.h"
36 
37 /*
38  * Random number utilities.
39  */
40 
41 // random number generators
42 int rand_int(int N); // random integers from 0 (incl) to N (excl)
43 double rand_uniform(); // random uniform in (0, 1)
44 double rand_normal(); // random normal
45 
46 
47 /*
48  * 3D geometry utilities.
49  */
50 
51 // functions for generating different clip plane orientations around a polyhedron
58 extern r3d_plane (*choptions_3d[6]) (r3d_poly* poly); // keep an array of these cutting options
59 
60 // get the centroid of a poly
62 
63 // generate a plane through the three points
65 
66 // randomly oriented (isotropic) unit vector
68 
69 // random tet with verts on the unit sphere
70 r3d_real rand_tet_3d(r3d_rvec3 verts[4], r3d_real minvol);
71 
72 
73 /*
74  * 2D geometry utilities.
75  */
76 
81 extern r2d_plane (*choptions_2d[4]) (r2d_poly* poly); // keep an array of these cutting options
82 
83 
86 r2d_real rand_tri_2d(r2d_rvec2 verts[3], r2d_real minvol);
88 
89 
97 
99 
100 void get_centroid_Nd(rNd_poly* poly, rNd_rvec centroid);
101 
102 
103 #endif // _TEST_HELPERS_H_
r3d_plane(* choptions_3d[6])(r3d_poly *poly)
r3d_plane thru_cent_3d(r3d_poly *poly)
r2d_plane thru_edge_2d(r2d_poly *poly)
r2d_rvec2 get_centroid_2d(r2d_poly *poly)
int rand_int(int N)
double rNd_real
Real type specifying the precision to be used in calculations.
Definition: rNd.h:52
rNd_plane thru_cent_Nd(rNd_poly *poly)
A N-vector.
Definition: rNd.h:64
void get_centroid_Nd(rNd_poly *poly, rNd_rvec centroid)
r2d_plane thru_vert_cent_2d(r2d_poly *poly)
A polygon.
Definition: r2d.h:97
r2d_plane point_plane_2d(r2d_rvec2 p0, r2d_rvec2 p1)
r2d_plane thru_vert_rand_2d(r2d_poly *poly)
r3d_rvec3 get_centroid_3d(r3d_poly *poly)
double rand_normal()
rNd_real rand_simplex_Nd(rNd_rvec verts[RND_DIM+1], rNd_real minvol)
Interface for r3d voxelization routines.
r2d_rvec2 rand_uvec_2d()
r2d_plane(* choptions_2d[4])(r2d_poly *poly)
Interface for rNd voxelization routines.
Vector struct.
Definition: r3d.h:56
r3d_plane point_plane_3d(r3d_rvec3 p0, r3d_rvec3 p1, r3d_rvec3 p2)
r3d_real rand_tet_3d(r3d_rvec3 verts[4], r3d_real minvol)
r3d_plane thru_edge_rand_3d(r3d_poly *poly)
r3d_plane thru_edge_cent_3d(r3d_poly *poly)
A hyperplane.
Definition: rNd.h:78
r3d_plane thru_vert_cent_3d(r3d_poly *poly)
A plane.
Definition: r3d.h:74
A plane.
Definition: r2d.h:72
r3d_plane thru_vert_rand_3d(r3d_poly *poly)
r3d_plane thru_face_3d(r3d_poly *poly)
Vector struct.
Definition: r2d.h:56
Interface for r2d rasterization routines.
A polyhedron.
Definition: r3d.h:99
r3d_rvec3 rand_uvec_3d()
An RND_DIM-dimensional polytope.
Definition: rNd.h:95
#define RND_DIM
Definition: rNd.h:41
r2d_real rand_tri_2d(r2d_rvec2 verts[3], r2d_real minvol)
double r2d_real
Real type specifying the precision to be used in calculations.
Definition: r2d.h:40
r2d_plane thru_cent_2d(r2d_poly *poly)
Interface for rNd.
double r3d_real
Real type specifying the precision to be used in calculations.
Definition: r3d.h:40
double rand_uniform()