Workspace 6.21.5
|
Glypher that produces superquadrics at each node of a model. More...
#include <Rendering/SceneComponents/Models/superquadricglypher.h>
Public Member Functions | |
SuperquadricGlypher () | |
SuperquadricGlypher (const SuperquadricGlypher &glypher) | |
~SuperquadricGlypher () override | |
SuperquadricGlypher * | clone () const override |
Mesh::Vector3d | getDefaultRadius () const |
double | getDefaultShape () const |
Glyph | getGlyph (const Mesh::NodeHandle &node) override |
Mesh::Vector3d | getGlyphRadius (const Mesh::NodeHandle &node) const |
double | getGlyphShape (const Mesh::NodeHandle &node) const |
Mesh::MeshModelLibrary & | getMeshModelLibrary () override |
const QString & | getOrientationStateName () const |
const QString & | getRadiusStateName () const |
const QString & | getShapeStateName () const |
double | getShapeTolerance () const |
int | getSubdivisions () const |
SuperquadricMesher::TextureCoords | getTextureCoordType () const |
bool | load (const DataExecution::SerializedItem &item) override |
SuperquadricGlypher & | operator= (const SuperquadricGlypher &glypher) |
bool | save (DataExecution::SerializedItem &item) const override |
void | setDefaultRadius (const Mesh::Vector3d &radius) |
void | setDefaultShape (double shape) |
void | setGlyphedModel (const Mesh::MeshModelInterface &model) override |
void | setOrientationStateName (const QString &name) |
void | setRadiusStateName (const QString &name) |
void | setShapeStateName (const QString &name) |
void | setShapeTolerance (double tolerance) |
void | setSubdivisions (int subdivisions) |
void | setTextureCoordType (SuperquadricMesher::TextureCoords textureCoords) |
Public Member Functions inherited from Glypher | |
~Glypher () override | |
bool | canSerialize () const override |
Glypher * | clone () const override=0 |
QString | getCacheId () const |
bool | getEnabled () const |
virtual Glyph | getGlyph (const Mesh::ElementHandle &element) |
virtual Glyph | getGlyph (const Mesh::NodeHandle &node)=0 |
int | getInterval () const |
virtual Mesh::MeshModelLibrary & | getMeshModelLibrary ()=0 |
virtual bool | isElementGlypher (const CSIRO::Mesh::ElementType::Type **elementType) const |
virtual bool | isNodeGlypher () const |
bool | load (const DataExecution::SerializedItem &item) override |
bool | save (DataExecution::SerializedItem &item) const override |
void | setEnabled (bool b) |
virtual void | setGlyphedModel (const Mesh::MeshModelInterface &model) |
void | setInterval (int interval) |
void | setIntervalStateName (const QString &stateName) |
Public Member Functions inherited from Clonable | |
virtual | ~Clonable ()=default |
virtual Clonable * | clone () const =0 |
Public Member Functions inherited from Serialize | |
virtual | ~Serialize ()=default |
virtual bool | canSerialize () const =0 |
virtual bool | load (const SerializedItem &item)=0 |
virtual bool | save (SerializedItem &item) const =0 |
Static Public Attributes | |
static const double | MinimumShape = 0.3 |
static const double | MinimumShapeTolerance = 0.01 |
Additional Inherited Members | |
Protected Member Functions inherited from Glypher | |
Glypher () | |
Glypher (const Glypher &glypher) | |
bool | matchInterval (const Mesh::ElementHandle &elt) const |
bool | matchInterval (const Mesh::NodeHandle &node) const |
Glypher & | operator= (const Glypher &glypher) |
The three-dimensional radius of the superquadric is determined by the radius state (scalar or vector) and the shape, i.e. the value 'n' in the superquadric equation:
(x/radius.x)^n + (y/radius.y)^n + (z/radius.z)^n = 1
is determined by the scalar shape state. In both cases defaults are provided. Rotation of superquadrics is specified by a rotation vector (axis-angle, with the magnitude of the vector equal to the angle of rotation), stored in a specified state. If that state does not exist or is not a vector, no rotation is applied.
Superquadric meshes are stored in a library with unit radius. For the purposes of efficiency, two superquadric meshes are considered the same when their shape parameters agree within a specified tolerance (
SuperquadricGlypher | ( | const SuperquadricGlypher & | glypher | ) |
|
override |
|
overridevirtual |
Mesh::Vector3d getDefaultRadius | ( | ) | const |
double getDefaultShape | ( | ) | const |
|
overridevirtual |
Vector3d getGlyphRadius | ( | const Mesh::NodeHandle & | node | ) | const |
For a given node, determine the radius of the superquadric glyph.
double getGlyphShape | ( | const Mesh::NodeHandle & | node | ) | const |
For a given node, determine the shape of the superquadric glyph. Upon return, the shape is greater than 0.
|
overridevirtual |
Implements Glypher.
const QString & getOrientationStateName | ( | ) | const |
const QString & getRadiusStateName | ( | ) | const |
const QString & getShapeStateName | ( | ) | const |
double getShapeTolerance | ( | ) | const |
int getSubdivisions | ( | ) | const |
SuperquadricMesher::TextureCoords getTextureCoordType | ( | ) | const |
|
overridevirtual |
item | Supplies the state to be loaded into this object. |
This function will load the state of this object from item. For many object types, this is most easily implemented in terms of the object's input operator (>>).
It would be reasonable for subclass implementations to assume that the data provided in item is in the same form as would have been saved from a call to save.
Reimplemented from Glypher.
SuperquadricGlypher & operator= | ( | const SuperquadricGlypher & | glypher | ) |
|
overridevirtual |
item | Where to save the state of this object. |
This function will serialise the object by saving it to item. For most object types, this is most easily implemented in terms of the object's output operator (<<).
It is allowable for an object to only serialize part of itself. This would be useful if the data it represents has a set of defaults and only those values different to the defaults need to be serialized. Such an implementation then needs to be careful how it handles the complimentary load member function.
Reimplemented from Glypher.
void setDefaultRadius | ( | const Mesh::Vector3d & | radius | ) |
Set the default radius to use when the radius state cannot be used.
void setDefaultShape | ( | double | shape | ) |
Sets the default superquadric shape parameter.
|
overridevirtual |
model | The model about to be glyphed. |
Subclasses can reimplement this function to save internal data about the model that will be used for subsequent calls to getGlyph(). Clients are free to call this function at any time, so the subclass must keep this in mind, although it will usually only be called by a model appearance processor just before it uses the glypher to process the specified model.
NOTE: Derived classes must call this base class's method.
Reimplemented from Glypher.
void setOrientationStateName | ( | const QString & | name | ) |
Set the name of the node state corresponding to the orientation/rotation of superquadrics. If it does not exist or is not a vector state, no rotation is applied. Otherwise, the vector state is considered to be euler angles as defined by the Mesh::TransformMatrix class.
void setRadiusStateName | ( | const QString & | name | ) |
Set the name of the node state to be used for the radius. If the state does not exist or is not a scalar or vector state, the default radius is used.
void setShapeStateName | ( | const QString & | name | ) |
Set the name of the node state corrresponding to the shape of the superquadric. If it does not exist or is not a scalar or vector, the default shape is used. If the state is a vector, the x-component is used to specify the shape.
void setShapeTolerance | ( | double | tolerance | ) |
Set the shape tolerance to use so that two superquadrics with shape parameters agreeing within the tolerance are considered the same.
void setSubdivisions | ( | int | subdivisions | ) |
subdivisions | Non-negative integer |
Sets the number of subdivisions in each quadrant of the superquadric. The number of elements used in the resulting mesh is 8*(subdivisions+1)^2 and all the elements are quad shells. Elements at the poles will be degenerate with one edge of zero length (ie they will look like tri's).
void setTextureCoordType | ( | SuperquadricMesher::TextureCoords | textureCoords | ) |
|
static |
Minimum shape parameter that this glypher supports. Shapes below this are highly susceptible to numerical errors and can cause problems with multinode normal calculations.
|
static |
Minimum shape tolerance.