69 #ifndef __OutOfBoundsException_h 90 switch (aParameter.m_density_function)
93 return (evaluateSphere(r));
96 return (evaluateBlobbyMolecule(r, aParameter.m_a, aParameter.m_b));
99 return (evaluateMetaBall(r, aParameter.m_a, aParameter.m_b));
102 return (evaluateSoftObject(r, aParameter.m_a, aParameter.m_b));
128 const VEC3& aControlPoint)
131 m_control_point_set.push_back(std::pair<DensityFunctionParameterType, VEC3>(aParameter, aControlPoint));
137 const VEC3& aControlPoint1,
138 const VEC3& aControlPoint2)
201 if (anIndex >= m_control_point_set.size())
206 return (m_control_point_set[anIndex].second);
227 if (anIndex >= m_control_line_set.size())
232 return (m_control_line_set[anIndex].second);
252 const VEC3& aVoxelSize,
253 unsigned char aVerboseLevel)
256 voxelise(aNumberOfVoxels, aCenter, aVoxelSize, aVerboseLevel);
264 writeVoxelData(aFileName.data());
331 return (1.0 / (r * r));
348 return (a * exp(-b * r * r));
363 if (0 <= r && r <= b / 3.0)
365 return (a * (1.0 - (3.0 * r * r) / (b * b)));
367 else if (b / 3.0 <= r && r <= b)
369 return (((3.0 * a) / 2.0) * pow((1.0 - (r / b)), 2.0));
384 if (0 <= r && r <= b)
388 (( 4.0 * std::pow(r, 6)) / (9.0 * std::pow(b, 6))) +
389 ((17.0 * std::pow(r, 4)) / (9.0 * std::pow(b, 4))) -
390 ((22.0 * std::pow(r, 2)) / (9.0 * std::pow(b, 2)))));
void addControlPoint(const DensityFunctionParameterType &aParameter, const VEC3 &aControlPoint)
Add a control point.
void writePolygonMesh(const char *aFileName)
Write the polygon data.
DensityFunctionType
Type of density function.
RATIONAL_NUMBER evaluateMetaBall(RATIONAL_NUMBER r, RATIONAL_NUMBER a, RATIONAL_NUMBER b) const
void setControlPointParameters(unsigned int aPointID, DensityFunctionType aDentityFunction, float aParameter1, float aParameter2=0.0)
RATIONAL_NUMBER evaluateBlobbyMolecule(RATIONAL_NUMBER r, RATIONAL_NUMBER a, RATIONAL_NUMBER b) const
const VEC3 & getControlPoint(unsigned int anIndex) const
Accessor on a given control point.
void resetControlPoints()
Remove all the control points.
const std::pair< VEC3, VEC3 > & getControlLine(unsigned int anIndex) const
Accessor on a given control line.
unsigned int getNumberOfControlLineSegments() const
Accessor on the number of control line segments.
Image< RATIONAL_NUMBER > m_volume
std::vector< std::pair< DensityFunctionParameterType, std::pair< VEC3, VEC3 > > > m_control_line_set
RATIONAL_NUMBER evaluateSphere(RATIONAL_NUMBER r) const
void voxelise(const Vec3ui &aNumberOfVoxels, const VEC3 &aCenter, const VEC3 &aVoxelSize, unsigned char aVerboseLevel=0)
Accessor on a given control line.
std::vector< std::pair< DensityFunctionParameterType, VEC3 > > m_control_point_set
PolygonMesh is a class to handle polygon (triangles) meshes.
void voxelize(const Vec3ui &aNumberOfVoxels, const VEC3 &aCenter, const VEC3 &aVoxelSize, unsigned char aVerboseLevel=0)
Accessor on a given control line.
RATIONAL_NUMBER evaluateSoftObject(RATIONAL_NUMBER r, RATIONAL_NUMBER a, RATIONAL_NUMBER b) const
float RATIONAL_NUMBER
Type of data used to store real numbers.
PolygonMesh & getPolygonMesh()
Accessor on the polygon data.
void resetControlLines()
Remove all the control lines.
void addControlLine(const DensityFunctionParameterType &aParameter, const VEC3 &aControlPoint1, const VEC3 &aControlPoint2)
Add a control line.
void setControlLineSegmentParameters(unsigned int aLineSegmentID, DensityFunctionType aDentityFunction, float aParameter1, float aParameter2=0.0)
unsigned int getNumberOfControlPoints() const
Accessor on the number of control points.
Class to handle exceptions when accessing an array cell that is not accessible, i.e. out of bounds memory access.
void writeVoxelData(const char *aFileName) const
Write the current voxel data into a file.
RATIONAL_NUMBER evaluate(RATIONAL_NUMBER r, const DensityFunctionParameterType &aParameter) const
Evaluate the density function for the distance r.
Type of density function parameter.
const Image< RATIONAL_NUMBER > & getVolume() const