C++ main module for gpm Package
1.0
|
This class describes a 3D Snow graph. More...
#include <GPM_3DSnowGraph.h>
Public Member Functions | |
tBoolean | createPatternFunctions (SV::GPM_PatternFunction &patternFunctions) const |
create the date for rewriting graph More... | |
virtual void | patternsMappingSignalEmit (const SVC::GPM_PatternFunction patternFunction, const vector< vector< vector< tVertexIID > > > &fmappings) const |
signal emmiting when the matching of patterns is done More... | |
SP::GPM_PortGraph | createPatternGraph (const int &eps, int idv[4], int idp[3][3]) const |
create a pattern graph More... | |
SP::GPM_PortGraph | createTransformerGraph (int idcp[3][2]) const |
create a transformer graph More... | |
void | createGraph (const int &index) |
create an initial graph More... | |
SP::GPM_Snow3DFunction | createPatternFunction (SP::GPM_PortGraph pattern, SP::GPM_PortGraph transformer, const int pattern_idv[3], const int pattern_idp[3][3], const int transformer_idcp[3][2]) const |
create pattern function More... | |
Static Public Member Functions | |
static SP::GPM_3DSnowGraph | New () |
create a test class More... | |
Protected Member Functions | |
GPM_3DSnowGraph (void) | |
create More... | |
virtual | ~GPM_3DSnowGraph (void) |
destroy More... | |
This class describes a 3D Snow graph.
A snow flake 3D example consists in replacing a triangle by a tetrahedron thanks to 2 rules described as folow (the state of ports is undefined by default. It may be either + or -):
The coordinates of the new nodes U,V,W,X are described as follow:
The rules are as follow:
The large graph is a tetrahedron with contains :
The results obtain after 5 iterations is given as follow:
To simulate this example, 2 classes have to been created:
The GPM_3DSnowGraph::createPatternFunctions create the 2 functions with 2 differents patterns and with the same transformer graph with the same rules.
The rules consist in
To update the coordinates of the copied transformer graph is done by specializing the method GPM_PatternFunction::updateTransformerStates
To update the pattern node state, do it with trigger action:
tBoolean GPM_Snow3DFunction::updatePatternGraphStates(GPM_Graph& largeGraph, const vector<tVertexIID>& mappingP2L,CORE_Out& io) { tBoolean succeeds=true; GPM_Node cnode=null; cnode=dynamic_cast<GPM_Node>(largeGraph.getVertex(mappingP2L[0]).get()); if (cnode==null) return false; succeeds= succeeds && cnode->setTriggerAction(cnode->SET,"state",1);
cnode=dynamic_cast<GPM_Node*>(largeGraph.getVertex(mappingP2L[1]).get()); if (cnode==null) return false; succeeds = succeeds && cnode->setTriggerAction(cnode->SET,"state",1);
cnode=dynamic_cast<GPM_Node*>(largeGraph.getVertex(mappingP2L[2]).get()); if (cnode==null) return false; succeeds = succeeds && cnode->setTriggerAction(cnode->SET,"state",1); return succeeds;
} Creating pattern graph (or similarly transformer graph) is as follow:
|
protected |
|
protectedvirtual |
destroy
void GPM_3DSnowGraph::createGraph | ( | const int & | index | ) |
create an initial graph
SP::GPM_Snow3DFunction GPM_3DSnowGraph::createPatternFunction | ( | SP::GPM_PortGraph | pattern, |
SP::GPM_PortGraph | transformer, | ||
const int | pattern_idv[3], | ||
const int | pattern_idp[3][3], | ||
const int | transformer_idcp[3][2] | ||
) | const |
create pattern function
References GPM_Snow3DFunction::New().
Referenced by createPatternFunctions().
tBoolean GPM_3DSnowGraph::createPatternFunctions | ( | SV::GPM_PatternFunction & | patternFunctions | ) | const |
create the date for rewriting graph
References createPatternFunction(), createPatternGraph(), createTransformerGraph(), and tBoolean.
SP::GPM_PortGraph GPM_3DSnowGraph::createPatternGraph | ( | const int & | eps, |
int | idv[4], | ||
int | idp[3][3] | ||
) | const |
create a pattern graph
References GPM_PortGraph::New().
Referenced by createPatternFunctions().
SP::GPM_PortGraph GPM_3DSnowGraph::createTransformerGraph | ( | int | idcp[3][2] | ) | const |
create a transformer graph
References GPM_PortGraph::New().
Referenced by createPatternFunctions().
|
inlinestatic |
|
virtual |
signal emmiting when the matching of patterns is done
References null.