Interface for rNd. More...
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | rNd_rvec |
A N-vector. More... | |
struct | rNd_dvec |
An integer N-vector for grid indexing. More... | |
struct | rNd_plane |
A hyperplane. More... | |
struct | rNd_vertex |
A doubly-linked vertex. More... | |
struct | rNd_poly |
An RND_DIM -dimensional polytope. More... | |
Macros | |
#define | RND_DIM 4 |
#define | RND_MAX_VERTS 1024 |
Typedefs | |
typedef double | rNd_real |
Real type specifying the precision to be used in calculations. More... | |
typedef int32_t | rNd_int |
Integer type used for indexing. More... | |
typedef int64_t | rNd_long |
Functions | |
void | rNd_clip (rNd_poly *poly, rNd_plane *planes, rNd_int nplanes) |
Clip a polytope against an arbitrary number of hyperplanes (find its intersection with a set of half-spaces). More... | |
void | rNd_reduce (rNd_poly *poly, rNd_real *moments, rNd_int polyorder) |
Integrate a polynomial density over a polytope. Still under development. More... | |
rNd_int | rNd_is_good (rNd_poly *poly) |
Checks a polytope to see if it is a valid RND_DIM -polyhedral graph, by testing compliance with Balinski's theorem. More... | |
rNd_real | rNd_orient (rNd_rvec verts[RND_DIM+1]) |
Get the signed volume of the RND_DIM -simplex defined by the input vertices. More... | |
void | rNd_print (rNd_poly *poly) |
Prints the vertices and connectivity of a polytope. For debugging. More... | |
void | rNd_rotate (rNd_poly *poly, rNd_real theta, rNd_int ax1, rNd_int ax2) |
Rotate a polytope about one axis. More... | |
void | rNd_translate (rNd_poly *poly, rNd_rvec shift) |
Translate a polytope. More... | |
void | rNd_scale (rNd_poly *poly, rNd_rvec scale) |
Scale a polytope. More... | |
void | rNd_shear (rNd_poly *poly, rNd_real shear, rNd_int axb, rNd_int axs) |
Shear a polytope. Each vertex undergoes the transformation pos.xyz[axb] += shear*pos.xyz[axs] . More... | |
void | rNd_affine (rNd_poly *poly, rNd_real mat[RND_DIM+1][RND_DIM+1]) |
Apply a general affine transformation to a polytope. More... | |
void | rNd_init_simplex (rNd_poly *poly, rNd_rvec verts[RND_DIM+1]) |
Initialize a polytope as an RND_DIM -simplex. More... | |
void | rNd_init_box (rNd_poly *poly, rNd_rvec rbounds[2]) |
Initialize a polytope as an axis-aligned hyperrectangle. More... | |
Detailed Description
Interface for rNd.
- Date
- 31 August 2015
Macro Definition Documentation
◆ RND_DIM
#define RND_DIM 4 |
◆ RND_MAX_VERTS
#define RND_MAX_VERTS 1024 |
Typedef Documentation
◆ rNd_int
typedef int32_t rNd_int |
Integer type used for indexing.
◆ rNd_long
typedef int64_t rNd_long |
◆ rNd_real
typedef double rNd_real |
Real type specifying the precision to be used in calculations.
Default is double
(recommended). float
precision is enabled by compiling with -DSINGLE_PRECISION
.
Function Documentation
◆ rNd_affine()
Apply a general affine transformation to a polytope.
- Parameters
-
[in,out] poly The polytope to transform. [in] mat The (RND_DIM+1)*(RND_DIM+1)
homogeneous transformation matrix.
◆ rNd_clip()
Clip a polytope against an arbitrary number of hyperplanes (find its intersection with a set of half-spaces).
- Parameters
-
[in,out] poly The polytope to be clipped. [in] planes An array of hyperplanes against which to clip this polytope. [in] nplanes The number of hyperplanes in the input array.
◆ rNd_init_box()
Initialize a polytope as an axis-aligned hyperrectangle.
- Parameters
-
[out] poly The polytope to initialize. [in] rbounds An array of two vectors, giving the lower and upper corners of the box.
◆ rNd_init_simplex()
Initialize a polytope as an RND_DIM
-simplex.
- Parameters
-
[out] poly The polytope to initialize. [in] verts An array of RND_DIM+1
vectors, giving the vertices of the simplex.
◆ rNd_is_good()
Checks a polytope to see if it is a valid RND_DIM
-polyhedral graph, by testing compliance with Balinski's theorem.
- Parameters
-
[in] poly The polytope to check.
- Returns
- 1 if the polytope is valid, 0 if not.
◆ rNd_orient()
Get the signed volume of the RND_DIM
-simplex defined by the input vertices.
- Parameters
-
[in] verts RND_DIM+1
vertices defining a simplex from which to calculate a volume.
- Returns
- The signed volume of the input simplex.
◆ rNd_print()
void rNd_print | ( | rNd_poly * | poly | ) |
Prints the vertices and connectivity of a polytope. For debugging.
- Parameters
-
[in] poly The polytope to print.
◆ rNd_reduce()
Integrate a polynomial density over a polytope. Still under development.
- Parameters
-
[in] poly The polytope over which to integrate. [in] polyorder Order of the polynomial density field. 0 for constant (1 moment), 1 for linear ( RND_DIM+1
moments), etc.[in,out] moments Array to be filled with the integration results, up to the specified polyorder
. Order of moments is row-major.
◆ rNd_rotate()
Rotate a polytope about one axis.
- Parameters
-
[in,out] poly The polytope to rotate. [in] theta The angle, in radians, by which to rotate the polytope. [in] ax1 Along with ax2
, the plane in which to rotate the polytope.[in] ax2 Along with ax1
, the plane in which to rotate the polytope.
◆ rNd_scale()
Scale a polytope.
- Parameters
-
[in,out] poly The polytope to scale. [in] scale The factor by which to scale the polytope along each dimension.
◆ rNd_shear()
Shear a polytope. Each vertex undergoes the transformation pos.xyz[axb] += shear*pos.xyz[axs]
.
- Parameters
-
[in,out] poly The polytope to shear. [in] shear The factor by which to shear the polytope. [in] axb The axis along which to shear the polytope. [in] axs The axis across which to shear the polytope.