DYNAMICS C API
C-compatible interface to the DYNAMICS library
Loading...
Searching...
No Matches
Geometry operations

Functions

void c_plane_normal (const c_plane *pln, double nrm[3])
 Extract a plane normal.
 
void c_plane_from_3_points (const double pt1[3], const double pt2[3], const double pt3[3], c_plane *pln)
 Construct a plane through three points.
 
void c_plane_from_point_and_normal (const double pt[3], const double nrm[3], c_plane *pln)
 Construct a plane from a point and normal.
 
void c_plane_from_points (int n, const double *pts, int ldp, c_plane *pln)
 Fit a plane to point data.
 
void c_flip_plane_normal (c_plane *pln)
 Reverse a plane normal and its equation.
 
void c_line_from_2_points (const double pt1[3], const double pt2[3], c_line *ln)
 Construct a line through two points.
 
void c_line_from_2_planes (const c_plane *p1, const c_plane *p2, c_line *ln)
 Construct the intersection line of two planes.
 
void c_line_from_points (int n, const double *pts, int ldp, c_line *ln)
 Fit a line to point data.
 
void c_evaluate_line_position (const c_line *ln, double t, double x[3])
 Evaluate a point on a line.
 
bool c_is_parallel_vectors (int n, const double *x, const double *y, double tol)
 Test whether two vectors are parallel within a tolerance.
 
bool c_is_parallel_lines (const c_line *x, const c_line *y, double tol)
 Test whether two lines are parallel.
 
bool c_is_parallel_planes (const c_plane *x, const c_plane *y, double tol)
 Test whether two planes are parallel.
 
bool c_is_point_on_plane (const double pt[3], const c_plane *pln, double tol)
 Test whether a point lies on a plane.
 
bool c_is_point_on_line (const double pt[3], const c_line *ln, double tol)
 Test whether a point lies on a line.
 
double c_nearest_point_on_line (const double pt[3], const c_line *ln)
 Find the parameter of the nearest point on a line.
 
double c_point_to_line_distance (const double pt[3], const c_line *ln)
 Compute the distance from a point to a line.
 
double c_point_to_plane_distance (const double pt[3], const c_plane *pln)
 Compute the distance from a point to a plane.
 
void c_vector_plane_projection (const double x[3], const c_plane *pln, double px[3])
 Project a vector onto a plane.
 
void c_point_plane_projection (const double pt[3], const c_plane *pln, double ppt[3])
 Project a point onto a plane.
 
void c_plucker_line_from_2_points (const double pt1[3], const double pt2[3], c_plucker_line *ln)
 Construct a Pluecker line through two points.
 
void c_plucker_line_from_line (const c_line *src, c_plucker_line *ln)
 Convert a line to Pluecker coordinates.
 
void c_plucker_line_from_2_planes (const c_plane *p1, const c_plane *p2, c_plucker_line *ln)
 Construct a Pluecker line from two planes.
 
void c_plucker_line_from_array (const double x[6], c_plucker_line *ln)
 Construct a Pluecker line from six coordinates.
 
void c_plucker_line_mtx_mult (int n, const double *x, int ldx, const c_plucker_line *ln, double *y)
 Apply a matrix to a Pluecker line.
 
void c_plucker_line_to_array (const c_plucker_line *ln, double x[6])
 Convert a Pluecker line to six coordinates.
 
void c_line_common_normal (const c_line *ln1, const c_line *ln2, c_line *ln)
 Compute the common normal of two lines.
 
void c_do_lines_intersect (const c_line *ln1, const c_line *ln2, bool *intersect, double *t1, double *t2, double tol)
 Determine whether two lines intersect and return their parameters.
 
void c_line_from_point_and_vector (const double pt[3], const double v[3], c_line *ln)
 Construct a line from a point and direction.
 
void c_poincare_map (int n, const double *x, const double *y, const double *z, const c_plane *pln, int side, int nbuffer, double *xbuffer, double *ybuffer, double *zbuffer, int *nactual)
 Compute a Poincare section map from sampled trajectories.
 
void c_poincare_map_ode (c_ode_equations fcn, const double tspan[2], int n, const double *iv, int sample_count, const c_plane *pln, int side, int solver, c_poincare_coordinates coordinates, int nbuffer, double *xbuffer, double *ybuffer, double *zbuffer, int *nactual, void *user_data)
 Compute a Poincare section map by integrating an ODE and intersecting uniformly spaced solution samples with a plane.
 

Detailed Description

Geometry representations and operations

Function Documentation

◆ c_plane_normal()

void c_plane_normal ( const c_plane *  pln,
double  nrm[3] 
)

Extract a plane normal.

Parameters
plnPlane.
nrmOutput normal vector.

◆ c_plane_from_3_points()

void c_plane_from_3_points ( const double  pt1[3],
const double  pt2[3],
const double  pt3[3],
c_plane *  pln 
)

Construct a plane through three points.

Parameters
pt1First point.
pt2Second point.
pt3Third point.
plnOutput plane.

◆ c_plane_from_point_and_normal()

void c_plane_from_point_and_normal ( const double  pt[3],
const double  nrm[3],
c_plane *  pln 
)

Construct a plane from a point and normal.

Parameters
ptPoint on plane.
nrmPlane normal.
plnOutput plane.

◆ c_plane_from_points()

void c_plane_from_points ( int  n,
const double *  pts,
int  ldp,
c_plane *  pln 
)

Fit a plane to point data.

Parameters
nPoint count.
ptsPoint matrix.
ldpLeading dimension of pts.
plnOutput plane.

◆ c_flip_plane_normal()

void c_flip_plane_normal ( c_plane *  pln)

Reverse a plane normal and its equation.

Parameters
plnPlane updated in place.

◆ c_line_from_2_points()

void c_line_from_2_points ( const double  pt1[3],
const double  pt2[3],
c_line *  ln 
)

Construct a line through two points.

Parameters
pt1First point.
pt2Second point.
lnOutput line.

◆ c_line_from_2_planes()

void c_line_from_2_planes ( const c_plane *  p1,
const c_plane *  p2,
c_line *  ln 
)

Construct the intersection line of two planes.

Parameters
p1First plane.
p2Second plane.
lnOutput line.

◆ c_line_from_points()

void c_line_from_points ( int  n,
const double *  pts,
int  ldp,
c_line *  ln 
)

Fit a line to point data.

Parameters
nPoint count.
ptsPoint matrix.
ldpLeading dimension of pts.
lnOutput line.

◆ c_evaluate_line_position()

void c_evaluate_line_position ( const c_line *  ln,
double  t,
double  x[3] 
)

Evaluate a point on a line.

Parameters
lnLine.
tLine parameter.
xOutput position.

◆ c_is_parallel_vectors()

bool c_is_parallel_vectors ( int  n,
const double *  x,
const double *  y,
double  tol 
)

Test whether two vectors are parallel within a tolerance.

Parameters
nVector length.
xFirst vector.
ySecond vector.
tolAngular or residual tolerance.
Returns
true when parallel.

◆ c_is_parallel_lines()

bool c_is_parallel_lines ( const c_line *  x,
const c_line *  y,
double  tol 
)

Test whether two lines are parallel.

Parameters
xFirst line.
ySecond line.
tolTolerance.
Returns
true when parallel.

◆ c_is_parallel_planes()

bool c_is_parallel_planes ( const c_plane *  x,
const c_plane *  y,
double  tol 
)

Test whether two planes are parallel.

Parameters
xFirst plane.
ySecond plane.
tolTolerance.
Returns
true when parallel.

◆ c_is_point_on_plane()

bool c_is_point_on_plane ( const double  pt[3],
const c_plane *  pln,
double  tol 
)

Test whether a point lies on a plane.

Parameters
ptPoint.
plnPlane.
tolTolerance.
Returns
true when on the plane.

◆ c_is_point_on_line()

bool c_is_point_on_line ( const double  pt[3],
const c_line *  ln,
double  tol 
)

Test whether a point lies on a line.

Parameters
ptPoint.
lnLine.
tolTolerance.
Returns
true when on the line.

◆ c_nearest_point_on_line()

double c_nearest_point_on_line ( const double  pt[3],
const c_line *  ln 
)

Find the parameter of the nearest point on a line.

Parameters
ptPoint.
lnLine.
Returns
Line parameter.

◆ c_point_to_line_distance()

double c_point_to_line_distance ( const double  pt[3],
const c_line *  ln 
)

Compute the distance from a point to a line.

Parameters
ptPoint.
lnLine.
Returns
Distance.

◆ c_point_to_plane_distance()

double c_point_to_plane_distance ( const double  pt[3],
const c_plane *  pln 
)

Compute the distance from a point to a plane.

Parameters
ptPoint.
plnPlane.
Returns
Distance.

◆ c_vector_plane_projection()

void c_vector_plane_projection ( const double  x[3],
const c_plane *  pln,
double  px[3] 
)

Project a vector onto a plane.

Parameters
xInput vector.
plnPlane.
pxOutput projection.

◆ c_point_plane_projection()

void c_point_plane_projection ( const double  pt[3],
const c_plane *  pln,
double  ppt[3] 
)

Project a point onto a plane.

Parameters
ptInput point.
plnPlane.
pptOutput projected point.

◆ c_plucker_line_from_2_points()

void c_plucker_line_from_2_points ( const double  pt1[3],
const double  pt2[3],
c_plucker_line *  ln 
)

Construct a Pluecker line through two points.

Parameters
pt1First point.
pt2Second point.
lnOutput Pluecker line.

◆ c_plucker_line_from_line()

void c_plucker_line_from_line ( const c_line *  src,
c_plucker_line *  ln 
)

Convert a line to Pluecker coordinates.

Parameters
srcInput line.
lnOutput Pluecker line.

◆ c_plucker_line_from_2_planes()

void c_plucker_line_from_2_planes ( const c_plane *  p1,
const c_plane *  p2,
c_plucker_line *  ln 
)

Construct a Pluecker line from two planes.

Parameters
p1First plane.
p2Second plane.
lnOutput line.

◆ c_plucker_line_from_array()

void c_plucker_line_from_array ( const double  x[6],
c_plucker_line *  ln 
)

Construct a Pluecker line from six coordinates.

Parameters
xSix coordinates.
lnOutput line.

◆ c_plucker_line_mtx_mult()

void c_plucker_line_mtx_mult ( int  n,
const double *  x,
int  ldx,
const c_plucker_line *  ln,
double *  y 
)

Apply a matrix to a Pluecker line.

Parameters
nMatrix row count.
xMatrix.
ldxLeading dimension of x.
lnPluecker line.
yOutput vector.

◆ c_plucker_line_to_array()

void c_plucker_line_to_array ( const c_plucker_line *  ln,
double  x[6] 
)

Convert a Pluecker line to six coordinates.

Parameters
lnInput line.
xOutput coordinates.

◆ c_line_common_normal()

void c_line_common_normal ( const c_line *  ln1,
const c_line *  ln2,
c_line *  ln 
)

Compute the common normal of two lines.

Parameters
ln1First line.
ln2Second line.
lnOutput common normal.

◆ c_do_lines_intersect()

void c_do_lines_intersect ( const c_line *  ln1,
const c_line *  ln2,
bool *  intersect,
double *  t1,
double *  t2,
double  tol 
)

Determine whether two lines intersect and return their parameters.

Parameters
ln1First line.
ln2Second line.
intersectOutput intersection flag.
t1Output parameter on ln1.
t2Output parameter on ln2.
tolTolerance.

◆ c_line_from_point_and_vector()

void c_line_from_point_and_vector ( const double  pt[3],
const double  v[3],
c_line *  ln 
)

Construct a line from a point and direction.

Parameters
ptPoint.
vDirection vector.
lnOutput line.

◆ c_poincare_map()

void c_poincare_map ( int  n,
const double *  x,
const double *  y,
const double *  z,
const c_plane *  pln,
int  side,
int  nbuffer,
double *  xbuffer,
double *  ybuffer,
double *  zbuffer,
int *  nactual 
)

Compute a Poincare section map from sampled trajectories.

Parameters
nSample count.
xX samples.
yY samples.
zZ samples.
plnSection plane.
sideSection orientation selector.
nbufferBuffer capacity.
xbufferOutput section x values.
ybufferOutput section y values.
zbufferOutput section z values.
nactualOutput number of intersections.

◆ c_poincare_map_ode()

void c_poincare_map_ode ( c_ode_equations  fcn,
const double  tspan[2],
int  n,
const double *  iv,
int  sample_count,
const c_plane *  pln,
int  side,
int  solver,
c_poincare_coordinates  coordinates,
int  nbuffer,
double *  xbuffer,
double *  ybuffer,
double *  zbuffer,
int *  nactual,
void *  user_data 
)

Compute a Poincare section map by integrating an ODE and intersecting uniformly spaced solution samples with a plane.

The coordinate callback is held per thread for the duration of the call, so this routine must not be re-entered from within its own callbacks.

Parameters
fcnODE callback.
tspanIncreasing start and end times.
nState dimension. At least 3 if coordinates is NULL.
ivn-element initial state at tspan[0].
sample_countNumber of uniformly spaced samples across tspan, including both endpoints; at least 2.
plnSection plane.
sideSection orientation selector.
solverODE integration method (e.g. DYN_RUNGE_KUTTA_45).
coordinatesOptional callback mapping each sample onto section coordinates; pass NULL to use the first three state components.
nbufferBuffer capacity.
xbufferOutput section x values.
ybufferOutput section y values.
zbufferOutput section z values.
nactualOutput number of intersections stored, at most nbuffer.
user_dataOpaque caller data forwarded to fcn and coordinates.