Alternaria
fit cylinders and ellipsoids to fungus
Spore Class Reference

An Alterneria spore modeled as a symmetric ellipsoid. More...

#include <spore.h>

Inheritance diagram for Spore:
Collaboration diagram for Spore:

List of all members.

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.
Sporeclone () const
 Clones this Spore.
Sporeoperator= (const Spore &s)
 Copies a Spore into this Spore.
class Spore_densityget_density () const
 Returns the density parameters used by this Structure.
Sporesplit_into_apical (const Spore *rvals_1, const Spore *rvals_2) throw (jwscxx::base::Arg_error)
 Stochastically splits this Spore into this and another Spore.
Sporemerge_with_apical (const Spore *rvals) throw (jwscxx::base::Arg_error)
 Stochastically merges this Spore with its Spore::apical.
class Apical_hyphasplit_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_densitydensity
 Parameters for density functions over a Spore.

Detailed Description

An Alterneria spore modeled as a symmetric ellipsoid.

The ellipsoid is symmetric with respect to two of its minor axis.

Definition at line 79 of file spore.h.


Constructor & Destructor Documentation

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.

Parameters:
centroid_xX-coord of the Structure::centroid.
centroid_yY-coord of the Structure::centroid.
centroid_zZ-coord of the Structure::centroid.
lengthLength from the Structure::begin_pt to Structure::end_pt.
widthWidth of the Structure.
base_thetaEuler angle: base rotation about the x-axis.
base_psiEuler angle: base rotation about the z-axis.
thetaEuler angle: rotation about the x-axis.
psiEuler angle: rotation about the z-axis.
opacityOpacity of the Spore.
levelLevel of the Spore.
densitySpore_density parameters for probabilities.
Exceptions:
jwscxx::base::Arg_errorSpore values are not in the density parameter ranges.

Definition at line 341 of file spore.cpp.

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.

Parameters:
parentParent Structure to add this Spore to.
lengthLength from the Structure::begin_pt to Structure::end_pt.
widthWidth of the Structure.
base_thetaEuler angle: base rotation about the x-axis.
base_psiEuler angle: base rotation about the z-axis.
thetaEuler angle: rotation about the x-axis.
psiEuler angle: rotation about the z-axis.
opacityOpacity of the Spore.
densitySpore_density parameters for probabilities.
Exceptions:
jwscxx::base::Arg_errorSpore values are not in the density parameter range.
Apical_errorThe parent already has an apical growth.

Definition at line 381 of file spore.cpp.

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.

Parameters:
parentParent Structure to add this Spore to.
centroid_xX-coord of the Structure::centroid.
centroid_yY-coord of the Structure::centroid.
centroid_zZ-coord of the Structure::centroid.
lengthLength from the Structure::begin_pt to Structure::end_pt.
widthWidth of the Structure.
base_thetaEuler angle: base rotation about the x-axis.
base_psiEuler angle: base rotation about the z-axis.
opacityOpacity of the Spore.
densitySpore_density parameters for probabilities.
Exceptions:
jwscxx::base::Arg_errorSpore values are not in the density parameter range.
Apical_errorThe parent already has an apical growth.

Definition at line 419 of file spore.cpp.

Spore::Spore ( const Spore s)

Constructs a Spore by copying another.

Parameters:
sSpore to construct a new one from.

Definition at line 442 of file spore.cpp.

Spore::Spore ( const class Apical_hypha h,
float  width,
const Spore_density density 
) throw (jwscxx::base::Arg_error)

Constructs a Spore by copying another.

Parameters:
hApical_hypha to construct a new Spore from.

Definition at line 450 of file spore.cpp.


Member Function Documentation

Spore * Spore::clone ( ) const [virtual]

Clones this Spore.

Returns:
A pointer to a cloned Spore.

Implements Apical_structure.

Definition at line 483 of file spore.cpp.

Spore & Spore::operator= ( const Spore s)

Copies a Spore into this Spore.

Parameters:
sSpore to copy.
Returns:
A reference to this Spore with s copied into it.

Definition at line 494 of file spore.cpp.

class Spore_density* Spore::get_density ( ) const [inline]

Returns the density parameters used by this Structure.

Reimplemented from Structure.

Definition at line 161 of file spore.h.

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.

Parameters:
rvals_1Random values to use for the stochastic split.
rvals_2Random values to use for the stochastic split.
Returns:
The Spore that was split into this Spore::apical.
Exceptions:
jwscxx::base::Arg_errorThe change would result in a Structure parameter that is not consistent with the parameter density functions.

Definition at line 515 of file spore.cpp.

Spore * Spore::merge_with_apical ( const Spore rvals) throw (jwscxx::base::Arg_error)

Stochastically merges this Spore with its Spore::apical.

Parameters:
rvalsRandom values to use for the stochastic merge.
Returns:
The Spore::apical that was merged with this Spore.
Note:
The apical and laterals from this Spore::apical are removed and merged into this Spore. So the returned Spore is safe to delete.
Exceptions:
jwscxx::base::Arg_errorThe change would result in a Structure parameter that is not consistent with the parameter density functions or there is no apical to merge with.

Definition at line 540 of file spore.cpp.

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.

Parameters:
rvals_1Random values to use for the stochastic split.
rvals_2Random values to use for the stochastic split.
Returns:
The first Apical_hypha that this Spore was split into. Its apical is set to the other.
Note:
The apical and laterals from this Spore are removed and split into the Apical_hypha. So this Spore can be safely deleted upon return.
Exceptions:
jwscxx::base::Arg_errorThe change would result in a Structure parameter that is not consistent with the parameter density functions.

Definition at line 574 of file spore.cpp.

void Spore::replace ( class Apical_hypha hypha) throw (jwscxx::base::Arg_error)

Replaces this Spore with an Apical_hypha.

Parameters:
hyphaApical_hypha to use for replacement.
Note:
This Spore is safe to delete upon return.

Definition at line 613 of file spore.cpp.

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);
Parameters:
MMatrix to draw spore in.
xPosition of the first m column index in the spore coordinate system.
yPosition of the first m row index in the spore coordinate system.
zPosition of m in the spore coordinate system.
x_scaleNumber of spore coordinate system units per column in m.
y_scaleNumber of spore coordinate system units per row in m.
z_scaleNumber of spore coordinate system units per matrix.
fillSet to true if the spore is to be filled; false otherwise.
Returns:
True if any of the structures intersect with something other than one of its children.

Definition at line 660 of file spore.cpp.

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);
Parameters:
M_blkMatrix block to draw spore in.
xPosition of the first mb column index in the spore coordinate system.
yPosition of the first mb row index in the spore coordinate system.
zPosition of the first mb matrix in the spore coordinate system.
x_scaleNumber of spore coordinate system units per column in mb.
y_scaleNumber of spore coordinate system units per row in mb.
z_scaleNumber of spore coordinate system units per matrix in mb.
fillSet to true if the spore is to be filled; false otherwise.
Returns:
True if any of the structures intersect with something other than one of its children.

Implements Structure.

Definition at line 806 of file spore.cpp.

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.

Parameters:
quadGLUquadric to use for drawing.
scaleNumber of GL units per spore coordinate system units.
isect_outResult parameter. If *isect_out is NULL, an vector in R^3 is allocated; otherwise its space is re-used.
nThe number of the intersection to return, counting begins at points going from p1 to p2.
p1_inEnd point of the line to intersect.
p2_inEnd point of the line to intersect.
Returns:
If the n^th intersection point is found, its parametric distance along the line from p1_in to p2_in is returned in the range [0,1]. Otherwise a value < 0 is returned.
Exceptions:
jwscxx::base::Arg_errorThe line end-points p1 and p2 must be in R^3. The intersection number to return n must be 1 or 2.

Implements Structure.

Definition at line 1158 of file spore.cpp.

const char* Spore::get_type_str ( ) const [inline, virtual]

Returns the type of this Structure in the form of a string.

Implements Structure.

Definition at line 250 of file spore.h.

static const char* Spore::type_str ( ) [inline, static]

Returns the type of this Structure in the form of a string.

Definition at line 256 of file spore.h.

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);
Parameters:
MMatrix to draw spore in.
xPosition of the first m column index in the spore coordinate system.
yPosition of the first m row index in the spore coordinate system.
zPosition of m in the spore coordinate system.
x_scaleNumber of spore coordinate system units per column in m.
y_scaleNumber of spore coordinate system units per row in m.
z_scaleNumber of spore coordinate system units per matrix.
fillSet to true if the spore is to be filled; false otherwise.
Warning:
In order to do proper filling of the spore, the matrix M must be empty (zero) prior to calling this function.

Definition at line 889 of file spore.cpp.

void Spore::update_log_prob ( ) [protected, virtual]

Updates Structure::log_prob.

Calls the base virtual update_log_prob members.

Reimplemented from Apical_structure.

Definition at line 1262 of file spore.cpp.


Member Data Documentation

class Spore_density* Spore::density [protected]

Parameters for density functions over a Spore.

Reimplemented from Apical_structure.

Definition at line 282 of file spore.h.


The documentation for this class was generated from the following files: