Alternaria
fit cylinders and ellipsoids to fungus
|
An Alterneria spore modeled as a symmetric ellipsoid. More...
#include <spore.h>
Public Member Functions | |
Spore (float centroid_x, float centroid_y, float centroid_z, float length, float width, float base_theta, float base_psi, float theta, float psi, float opacity, size_t level, const class Spore_density *density) throw (jwscxx::base::Arg_error) | |
Constructs a parent-less Spore positioned w.r.t. a centroid. | |
Spore (Structure *parent, float length, float width, float base_theta, float base_psi, float theta, float psi, float opacity, const class Spore_density *density) throw (jwscxx::base::Arg_error, Apical_error) | |
Constructs a Spore and attaches it to a parent. | |
Spore (Structure *parent, float centroid_x, float centroid_y, float centroid_z, float length, float width, float base_theta, float base_psi, float opacity, const class Spore_density *density) throw (jwscxx::base::Arg_error, Apical_error) | |
Constructs a Spore and attaches it to a parent. | |
Spore (const Spore &s) | |
Constructs a Spore by copying another. | |
Spore (const class Apical_hypha &h, float width, const Spore_density *density) throw (jwscxx::base::Arg_error) | |
Constructs a Spore by copying another. | |
Spore * | clone () const |
Clones this Spore. | |
Spore & | operator= (const Spore &s) |
Copies a Spore into this Spore. | |
class Spore_density * | get_density () const |
Returns the density parameters used by this Structure. | |
Spore * | split_into_apical (const Spore *rvals_1, const Spore *rvals_2) throw (jwscxx::base::Arg_error) |
Stochastically splits this Spore into this and another Spore. | |
Spore * | merge_with_apical (const Spore *rvals) throw (jwscxx::base::Arg_error) |
Stochastically merges this Spore with its Spore::apical. | |
class Apical_hypha * | split_into_apical (const Apical_hypha *rvals_1, const Apical_hypha *rvals_2) throw (jwscxx::base::Arg_error) |
Splits a Spore into 2 Apical_hypha. | |
void | replace (class Apical_hypha *hypha) throw (jwscxx::base::Arg_error) |
Replaces this Spore with an Apical_hypha. | |
bool | draw_in_matrix_f (jwsc::Matrix_f *M, float x, float y, float z, float x_scale, float y_scale, float z_scale, bool fill=true) const |
Draws this Spore in a matrix. | |
bool | draw_in_matblock_f (jwsc::Matblock_f *M_blk, float x, float y, float z, float x_scale, float y_scale, float z_scale, bool fill=true) const |
Draws this Spore in a matrix block. | |
float | get_intersection (jwsc::Vector_f **isect_out, uint32_t n, const jwsc::Vector_f *p1_in, const jwsc::Vector_f *p2_in) throw (jwscxx::base::Arg_error) |
Draws this Spore in an OpenGL environment. | |
const char * | get_type_str () const |
Returns the type of this Structure in the form of a string. | |
Static Public Member Functions | |
static const char * | type_str () |
Returns the type of this Structure in the form of a string. | |
Protected Member Functions | |
void | draw_in_zeroed_matrix_f (jwsc::Matrix_f *M, float x, float y, float z, float x_scale, float y_scale, float z_scale, bool fill=true) const |
Draws this Spore in a zeroed matrix. | |
void | update_log_prob () |
Updates Structure::log_prob. | |
Protected Attributes | |
class Spore_density * | density |
Parameters for density functions over a Spore. |
An Alterneria spore modeled as a symmetric ellipsoid.
The ellipsoid is symmetric with respect to two of its minor axis.
Spore::Spore | ( | float | centroid_x, |
float | centroid_y, | ||
float | centroid_z, | ||
float | length, | ||
float | width, | ||
float | base_theta, | ||
float | base_psi, | ||
float | theta, | ||
float | psi, | ||
float | opacity, | ||
size_t | level, | ||
const class Spore_density * | density | ||
) | throw (jwscxx::base::Arg_error) |
Constructs a parent-less Spore positioned w.r.t. a centroid.
centroid_x | X-coord of the Structure::centroid. |
centroid_y | Y-coord of the Structure::centroid. |
centroid_z | Z-coord of the Structure::centroid. |
length | Length from the Structure::begin_pt to Structure::end_pt. |
width | Width of the Structure. |
base_theta | Euler angle: base rotation about the x-axis. |
base_psi | Euler angle: base rotation about the z-axis. |
theta | Euler angle: rotation about the x-axis. |
psi | Euler angle: rotation about the z-axis. |
opacity | Opacity of the Spore. |
level | Level of the Spore. |
density | Spore_density parameters for probabilities. |
jwscxx::base::Arg_error | Spore values are not in the density parameter ranges. |
Spore::Spore | ( | Structure * | parent, |
float | length, | ||
float | width, | ||
float | base_theta, | ||
float | base_psi, | ||
float | theta, | ||
float | psi, | ||
float | opacity, | ||
const class Spore_density * | density | ||
) | throw (jwscxx::base::Arg_error, Apical_error) |
Constructs a Spore and attaches it to a parent.
parent | Parent Structure to add this Spore to. |
length | Length from the Structure::begin_pt to Structure::end_pt. |
width | Width of the Structure. |
base_theta | Euler angle: base rotation about the x-axis. |
base_psi | Euler angle: base rotation about the z-axis. |
theta | Euler angle: rotation about the x-axis. |
psi | Euler angle: rotation about the z-axis. |
opacity | Opacity of the Spore. |
density | Spore_density parameters for probabilities. |
jwscxx::base::Arg_error | Spore values are not in the density parameter range. |
Apical_error | The parent already has an apical growth. |
Spore::Spore | ( | Structure * | parent, |
float | centroid_x, | ||
float | centroid_y, | ||
float | centroid_z, | ||
float | length, | ||
float | width, | ||
float | base_theta, | ||
float | base_psi, | ||
float | opacity, | ||
const class Spore_density * | density | ||
) | throw (jwscxx::base::Arg_error, Apical_error) |
Constructs a Spore and attaches it to a parent.
parent | Parent Structure to add this Spore to. |
centroid_x | X-coord of the Structure::centroid. |
centroid_y | Y-coord of the Structure::centroid. |
centroid_z | Z-coord of the Structure::centroid. |
length | Length from the Structure::begin_pt to Structure::end_pt. |
width | Width of the Structure. |
base_theta | Euler angle: base rotation about the x-axis. |
base_psi | Euler angle: base rotation about the z-axis. |
opacity | Opacity of the Spore. |
density | Spore_density parameters for probabilities. |
jwscxx::base::Arg_error | Spore values are not in the density parameter range. |
Apical_error | The parent already has an apical growth. |
Spore::Spore | ( | const Spore & | s | ) |
Spore::Spore | ( | const class Apical_hypha & | h, |
float | width, | ||
const Spore_density * | density | ||
) | throw (jwscxx::base::Arg_error) |
Constructs a Spore by copying another.
h | Apical_hypha to construct a new Spore from. |
Spore * Spore::clone | ( | ) | const [virtual] |
class Spore_density* Spore::get_density | ( | ) | const [inline] |
Spore * Spore::split_into_apical | ( | const Spore * | rvals_1, |
const Spore * | rvals_2 | ||
) | throw (jwscxx::base::Arg_error) |
Stochastically splits this Spore into this and another Spore.
rvals_1 | Random values to use for the stochastic split. |
rvals_2 | Random values to use for the stochastic split. |
jwscxx::base::Arg_error | The change would result in a Structure parameter that is not consistent with the parameter density functions. |
Spore * Spore::merge_with_apical | ( | const Spore * | rvals | ) | throw (jwscxx::base::Arg_error) |
Stochastically merges this Spore with its Spore::apical.
rvals | Random values to use for the stochastic merge. |
jwscxx::base::Arg_error | The change would result in a Structure parameter that is not consistent with the parameter density functions or there is no apical to merge with. |
class Apical_hypha * Spore::split_into_apical | ( | const Apical_hypha * | rvals_1, |
const Apical_hypha * | rvals_2 | ||
) | throw (jwscxx::base::Arg_error) |
Splits a Spore into 2 Apical_hypha.
rvals_1 | Random values to use for the stochastic split. |
rvals_2 | Random values to use for the stochastic split. |
jwscxx::base::Arg_error | The change would result in a Structure parameter that is not consistent with the parameter density functions. |
void Spore::replace | ( | class Apical_hypha * | hypha | ) | throw (jwscxx::base::Arg_error) |
Replaces this Spore with an Apical_hypha.
hypha | Apical_hypha to use for replacement. |
bool Spore::draw_in_matrix_f | ( | jwsc::Matrix_f * | M, |
float | x, | ||
float | y, | ||
float | z, | ||
float | x_scale, | ||
float | y_scale, | ||
float | z_scale, | ||
bool | fill = true |
||
) | const |
Draws this Spore in a matrix.
The drawing plane (M) has normal vector <x,y,z> = <0,0,1> in 3-space, i.e., it is parallel to the xy-plane. The parameter z specifies the distance of the drawing plane from the origin (0,0,1).
The parameters x and y specify the location of M->elts[0][0] in the spore coordinate system. Increasing indices of m correspond to increasing values of x and y scaled by x_scale and y_scale, respectively.
Formally, the center of the (i,j)th element of M in spore coordinates will be
x_0 = x + x_scale*(i + 0.5); y_0 = y + y_scale*(j + 0.5); z_0 = z + z_scale*0.5;
The position of (x_0,y_0,z_0) in m is given by
i = floor((x_0 - x) / x_scale + 0.5); j = floor((y_0 - y) / y_scale + 0.5);
M | Matrix to draw spore in. |
x | Position of the first m column index in the spore coordinate system. |
y | Position of the first m row index in the spore coordinate system. |
z | Position of m in the spore coordinate system. |
x_scale | Number of spore coordinate system units per column in m. |
y_scale | Number of spore coordinate system units per row in m. |
z_scale | Number of spore coordinate system units per matrix. |
fill | Set to true if the spore is to be filled; false otherwise. |
bool Spore::draw_in_matblock_f | ( | jwsc::Matblock_f * | M_blk, |
float | x, | ||
float | y, | ||
float | z, | ||
float | x_scale, | ||
float | y_scale, | ||
float | z_scale, | ||
bool | fill = true |
||
) | const [virtual] |
Draws this Spore in a matrix block.
The drawing planes (M_blk) have normal vectors <x,y,z> = <0,0,1> in 3-space, i.e., parallel to the xy-plane. The parameter z specifies the distance of the drawing plane from the origin (0,0,1).
The parameters x, y, and z specify the location of mb->elts[0][0][0] in the spore coordinate system. Increasing indices of mb correspond to increasing values of x, y, and z scaled by x_scale, y_scale and z_scale, respectively.
Formally, the center of the (i,j,k)th element of M_blk in spore coordinates will be
x_0 = x + x_scale*(i + 0.5); y_0 = y + y_scale*(j + 0.5); z_0 = z + z_scale*(k + 0.5);
The position of (x_0,y_0,z_0) in M_blk is given by
i = floor((x_0 - x) / x_scale + 0.5); j = floor((y_0 - y) / y_scale + 0.5); k = floor((z_0 - z) / z_scale + 0.5);
M_blk | Matrix block to draw spore in. |
x | Position of the first mb column index in the spore coordinate system. |
y | Position of the first mb row index in the spore coordinate system. |
z | Position of the first mb matrix in the spore coordinate system. |
x_scale | Number of spore coordinate system units per column in mb. |
y_scale | Number of spore coordinate system units per row in mb. |
z_scale | Number of spore coordinate system units per matrix in mb. |
fill | Set to true if the spore is to be filled; false otherwise. |
Implements Structure.
float Spore::get_intersection | ( | jwsc::Vector_f ** | isect_out, |
uint32_t | n, | ||
const jwsc::Vector_f * | p1_in, | ||
const jwsc::Vector_f * | p2_in | ||
) | throw (jwscxx::base::Arg_error) [virtual] |
Draws this Spore in an OpenGL environment.
Calculates an intersection point between a line and this Spore, if it exists.
quad | GLUquadric to use for drawing. |
scale | Number of GL units per spore coordinate system units. |
isect_out | Result parameter. If *isect_out is NULL, an vector in R^3 is allocated; otherwise its space is re-used. |
n | The number of the intersection to return, counting begins at points going from p1 to p2. |
p1_in | End point of the line to intersect. |
p2_in | End point of the line to intersect. |
jwscxx::base::Arg_error | The line end-points p1 and p2 must be in R^3. The intersection number to return n must be 1 or 2. |
Implements Structure.
const char* Spore::get_type_str | ( | ) | const [inline, virtual] |
static const char* Spore::type_str | ( | ) | [inline, static] |
void Spore::draw_in_zeroed_matrix_f | ( | jwsc::Matrix_f * | M, |
float | x, | ||
float | y, | ||
float | z, | ||
float | x_scale, | ||
float | y_scale, | ||
float | z_scale, | ||
bool | fill = true |
||
) | const [protected] |
Draws this Spore in a zeroed matrix.
The drawing plane (M) has normal vector <x,y,z> = <0,0,1> in 3-space, i.e., it is parallel to the xy-plane. The parameter z specifies the distance of the drawing plane from the origin (0,0,1).
The parameters x and y specify the location of M->elts[0][0] in the spore coordinate system. Increasing indices of m correspond to increasing values of x and y scaled by x_scale and y_scale, respectively.
Formally, the center of the (i,j)th element of m in spore coordinates will be
x_0 = x + x_scale*(i + 0.5); y_0 = y + y_scale*(j + 0.5); z_0 = z + z_scale*0.5;
The position of (x_0,y_0,z_0) in m is given by
i = floor((x_0 - x) / x_scale + 0.5); j = floor((y_0 - y) / y_scale + 0.5);
M | Matrix to draw spore in. |
x | Position of the first m column index in the spore coordinate system. |
y | Position of the first m row index in the spore coordinate system. |
z | Position of m in the spore coordinate system. |
x_scale | Number of spore coordinate system units per column in m. |
y_scale | Number of spore coordinate system units per row in m. |
z_scale | Number of spore coordinate system units per matrix. |
fill | Set to true if the spore is to be filled; false otherwise. |
void Spore::update_log_prob | ( | ) | [protected, virtual] |
Updates Structure::log_prob.
Calls the base virtual update_log_prob members.
Reimplemented from Apical_structure.
class Spore_density* Spore::density [protected] |
Parameters for density functions over a Spore.
Reimplemented from Apical_structure.