MeshKit
1.0
|
#include <AF2Rule.hpp>
Public Member Functions | |
AF2Rule (std::string const &ruleNameArg, unsigned int maxQuality, std::list< const AF2RuleExistVertex * > const &ruleVertices, const AF2RuleExistEdge *baselineEdge, std::list< const AF2RuleExistEdge * > const &otherRuleEdges, const AF2FreeZoneDef *freeZoneDef, std::list< const AF2RuleNewVertex * > const &ruleNewVertices, std::list< const AF2RuleNewEdge * > const &ruleNewEdges, std::list< const AF2RuleNewFace * > const &ruleNewFaces) | |
Constructor. | |
~AF2Rule () | |
Destructor. | |
AF2Rule (const AF2Rule &toCopy) | |
Copy constructor (throws exception) | |
AF2Rule & | operator= (const AF2Rule &rhs) |
Assignment operator (throws exception) | |
void | applyRule (AF2Neighborhood const &ngbhd, unsigned int matchQuality, AF2RuleAppVisitor &visitor) const |
Attempt to apply this rule to a neighborhood at the specified quality level, passing each successful rule application to the visitor for processing. | |
std::string | getName () const |
Get the name of this rule. | |
Private Member Functions | |
void | applyRuleStageTwo (AF2Neighborhood const &ngbhd, unsigned int matchQuality, AF2RuleAppVisitor &visitor, std::map< const AF2RuleExistVertex *, std::list< const AF2Point2D * > * > *const &matchingVerticesMap, AF2Binding &binding) const |
The second stage of applying a rule. | |
void | applyRuleStageThree (AF2Neighborhood const &ngbhd, unsigned int matchQuality, AF2RuleAppVisitor &visitor, AF2Binding const &binding) const |
The third stage of applying a rule. | |
std::map< const AF2RuleExistEdge *, std::list < const AF2Edge2D * > * > * | findPotentialEdgeMatches (AF2Neighborhood const &ngbhd, unsigned int matchQuality) const |
Find which of the edges in a given neighborhood are potential matches for this rule's existing edges at a specified match quality. | |
std::map< const AF2RuleExistVertex *, std::list< const AF2Point2D * > * > * | findPotentialVertexMatches (AF2Neighborhood const &ngbhd, unsigned int matchQuality) const |
Find which of the vertices in a given neighborhood are potential matches for this rule's existing vertices at a specified match quality. | |
void | checkExEndpointsAndFindIsolatedVertices () |
Check that the endpoints of the rule's existing edges are listed among the rule's existing vertices and find the any of the rule's existing vertices that are not endpoints of the rule's existing edges. | |
bool | isMatchingEdge (AF2Edge2D const &edge, AF2RuleExistEdge const &ruleEdge, unsigned int matchQuality) const |
Check whether a specified AF2Edge2D is a match for a specified AF2RuleExistEdge at a given match quality level. | |
bool | isMatchingVertex (AF2Point2D const &point, AF2RuleExistVertex const &ruleVertex, unsigned int matchQuality) const |
Check whether a specified AF2Point2D is a match for a specified AF2RuleExistVertex at a given match quality level. | |
Private Attributes | |
const std::string | ruleName |
const unsigned int | maxQualityLevel |
const unsigned int | numExVertices |
const unsigned int | numExEdges |
const AF2FreeZoneDef *const | freeZoneDef |
const unsigned int | numNewVertices |
const unsigned int | numNewEdges |
const unsigned int | numNewFaces |
const AF2RuleExistVertex ** | exVertices |
const AF2RuleExistEdge ** | exEdges |
const AF2RuleNewVertex ** | newVertices |
const AF2RuleNewEdge ** | newEdges |
const AF2RuleNewFace ** | newFaces |
unsigned int | numExIsoVertices |
const AF2RuleExistVertex ** | exIsoVertices |
Definition at line 53 of file AF2Rule.hpp.
AF2Rule | ( | std::string const & | ruleNameArg, |
unsigned int | maxQuality, | ||
std::list< const AF2RuleExistVertex * > const & | ruleVertices, | ||
const AF2RuleExistEdge * | baselineEdge, | ||
std::list< const AF2RuleExistEdge * > const & | otherRuleEdges, | ||
const AF2FreeZoneDef * | freeZoneDef, | ||
std::list< const AF2RuleNewVertex * > const & | ruleNewVertices, | ||
std::list< const AF2RuleNewEdge * > const & | ruleNewEdges, | ||
std::list< const AF2RuleNewFace * > const & | ruleNewFaces | ||
) |
Constructor.
This object takes ownership of all of the objects that are passed into the constructor. The objects will be destroyed when this object is destroyed, and the context that constructs this object must not delete the objects that it passes to this constructor.
In addition to a name for the rule and a maximum quality level, the constructor requires a list of the rule's existing vertices, existing edges, free zone definition, new vertices, new edges, and new faces. These objects may reference each other. For example, the existing edges reference existing vertices as their endpoints. (This is one of the reasons that pointers are passed into this method and this object takes ownership of the objects that are passed in without supporting copy construction or assignment.)
The constructor will throw an exception if it detects an inconsistency in the arguments. For instance, each rule must have a baseline existing edge and two existing vertices. All of the endpoints of the rule's existing edges must be listed in the rule's existing vertices. The baseline edge may not be listed among the rule's other existing edges.
ruleNameArg | a string identifier for the rule |
maxQuality | an unsigned int specifying the maximum baseline edge quality for which this rule may be applied, i.e., the smallest quality level number for which this rule may be applied |
ruleVertices | the rule's existing vertices, i.e., the vertices that must match some vertex in the local neighborhood in order for the rule to be applied |
baselineEdge | the baseline edge that must match the baseline edge of the local neighborhood in order for the rule to be applied |
otherRuleEdges | the other existing edges of the rule, i.e., the other edges that must match some edge in the local neighborhood in order for the rule to be applied |
freeZoneDef | a free zone definition that can be used to construct a free zone based on which local neighborhood vertices the rule's existing vertices are bound to. The rule may be applied only if no local neighborhood vertices or edges may intersect the interior of the free zone |
ruleNewVertices | new vertices that will be created if the rule is applied |
ruleNewEdges | new edges that will be created if the rule is applied |
ruleNewFaces | new face elements, such as triangles or quadrilaterals, that will be created if the rule is applied |
Definition at line 52 of file AF2Rule.cpp.
~AF2Rule | ( | ) |
Destructor.
Definition at line 90 of file AF2Rule.cpp.
Copy constructor (throws exception)
This object does not currently support copying, so this method is implemented to throw an exception.
Definition at line 101 of file AF2Rule.cpp.
void applyRule | ( | AF2Neighborhood const & | ngbhd, |
unsigned int | matchQuality, | ||
AF2RuleAppVisitor & | visitor | ||
) | const |
Attempt to apply this rule to a neighborhood at the specified quality level, passing each successful rule application to the visitor for processing.
The quality level is a positive integer. Lower values require higher-quality matching, i.e., the rule's edges and vertices must match items in the neighborhood more precisely when the quality level number is a lower value.
ngbhd | an advancing front neighborhood |
matchQuality | the quality level for matching this rule's existing edges and vertices |
visitor | a visitor that will handle the processing of any possible applications of this rule within the neighborhood that meet the specified level of quality |
Definition at line 267 of file AF2Rule.cpp.
void applyRuleStageThree | ( | AF2Neighborhood const & | ngbhd, |
unsigned int | matchQuality, | ||
AF2RuleAppVisitor & | visitor, | ||
AF2Binding const & | binding | ||
) | const [private] |
The third stage of applying a rule.
This stage checks that the rule's free zone does not contain any of the neighborhood's points or intersect any of the neighborhood's edges except for points and edges that coincide with the boundary of the free zone.
If the free zone is appropriately empty, then this stage also builds the rule application object and passes it to the visitor.
ngbhd | the neighborhood passed to applyRule |
matchQuality | the match quality passed to applyRule |
visitor | the visitor passsed to applyRule |
binding | a binding of this rule's existing edges and vertices to edges and points in the neighborhood, understood to be consistent and completed, i.e., mapping all of this rule's existing edges and vertices to edges and points in the neighborhood |
Definition at line 432 of file AF2Rule.cpp.
void applyRuleStageTwo | ( | AF2Neighborhood const & | ngbhd, |
unsigned int | matchQuality, | ||
AF2RuleAppVisitor & | visitor, | ||
std::map< const AF2RuleExistVertex *, std::list< const AF2Point2D * > * > *const & | matchingVerticesMap, | ||
AF2Binding & | binding | ||
) | const [private] |
The second stage of applying a rule.
This stage matches any of the rule's existing vertices that are not endpoints of edges with points in the neighborhood.
ngbhd | the neighborhood passed to applyRule |
matchQuality | the match quality passed to applyRule |
visitor | the visitor passsed to applyRule |
matchingVerticesMap | a map of the rule's existing vertices that are not endpoints of edges to a list of points in the neighborhood that are potential matches for those vertices |
binding | a binding of this rule's existing edges and vertices to edges and points in the neighborhood, understood to be in progress, containing consistent bindings for all of the rule's existing edges and (implicitly) the endpoints of those edges |
Definition at line 351 of file AF2Rule.cpp.
void checkExEndpointsAndFindIsolatedVertices | ( | ) | [private] |
Check that the endpoints of the rule's existing edges are listed among the rule's existing vertices and find the any of the rule's existing vertices that are not endpoints of the rule's existing edges.
This method is intended to be used by the constructor. It throws an exception if there is an existing edge that has an endpoint that is not listed in the existing vertices, and it fills the data members that store the isolated vertices, i.e., the vertices that are not endpoints of edges.
Definition at line 123 of file AF2Rule.cpp.
std::map< const AF2RuleExistEdge *, std::list< const AF2Edge2D * > * > * findPotentialEdgeMatches | ( | AF2Neighborhood const & | ngbhd, |
unsigned int | matchQuality | ||
) | const [private] |
Find which of the edges in a given neighborhood are potential matches for this rule's existing edges at a specified match quality.
ngbhd | the neighborhood passed to applyRule |
matchQuality | the match quality passed to applyRule |
Definition at line 180 of file AF2Rule.cpp.
std::map< const AF2RuleExistVertex *, std::list< const AF2Point2D * > * > * findPotentialVertexMatches | ( | AF2Neighborhood const & | ngbhd, |
unsigned int | matchQuality | ||
) | const [private] |
Find which of the vertices in a given neighborhood are potential matches for this rule's existing vertices at a specified match quality.
ngbhd | the neighborhood passed to applyRule |
matchQuality | the match quality passed to applyRule |
Definition at line 218 of file AF2Rule.cpp.
std::string getName | ( | ) | const |
bool isMatchingEdge | ( | AF2Edge2D const & | edge, |
AF2RuleExistEdge const & | ruleEdge, | ||
unsigned int | matchQuality | ||
) | const [private] |
Check whether a specified AF2Edge2D is a match for a specified AF2RuleExistEdge at a given match quality level.
All quality levels are specified as strictly positive integers. Lower match quality numbers correspond to higher quality matches.
point | an AF2Point2D point at defined coordinates |
ruleVertex | an AF2RuleExistVertex that is part of the definition of this rule |
matchQuality | an integer measuring how closely the coordinates of the point must match the coordinates of the rule existing vertex in order to be considered a match |
Definition at line 244 of file AF2Rule.cpp.
bool isMatchingVertex | ( | AF2Point2D const & | point, |
AF2RuleExistVertex const & | ruleVertex, | ||
unsigned int | matchQuality | ||
) | const [private] |
Check whether a specified AF2Point2D is a match for a specified AF2RuleExistVertex at a given match quality level.
All quality levels are specified as strictly positive integers. Lower match quality numbers correspond to higher quality matches.
point | an AF2Point2D point at defined coordinates |
ruleVertex | an AF2RuleExistVertex that is part of the definition of this rule |
matchQuality | an integer measuring how closely the coordinates of the point must match the coordinates of the rule existing vertex in order to be considered a match |
Definition at line 259 of file AF2Rule.cpp.
Assignment operator (throws exception)
This object does not currently support assignment, so this method is implemented to throw an exception.
Definition at line 116 of file AF2Rule.cpp.
const AF2RuleExistEdge** exEdges [private] |
Definition at line 63 of file AF2Rule.hpp.
const AF2RuleExistVertex** exIsoVertices [private] |
Definition at line 68 of file AF2Rule.hpp.
const AF2RuleExistVertex** exVertices [private] |
Definition at line 62 of file AF2Rule.hpp.
const AF2FreeZoneDef* const freeZoneDef [private] |
Definition at line 60 of file AF2Rule.hpp.
const unsigned int maxQualityLevel [private] |
Definition at line 58 of file AF2Rule.hpp.
const AF2RuleNewEdge** newEdges [private] |
Definition at line 65 of file AF2Rule.hpp.
const AF2RuleNewFace** newFaces [private] |
Definition at line 66 of file AF2Rule.hpp.
const AF2RuleNewVertex** newVertices [private] |
Definition at line 64 of file AF2Rule.hpp.
const unsigned int numExEdges [private] |
Definition at line 59 of file AF2Rule.hpp.
unsigned int numExIsoVertices [private] |
Definition at line 67 of file AF2Rule.hpp.
const unsigned int numExVertices [private] |
Definition at line 59 of file AF2Rule.hpp.
const unsigned int numNewEdges [private] |
Definition at line 61 of file AF2Rule.hpp.
const unsigned int numNewFaces [private] |
Definition at line 61 of file AF2Rule.hpp.
const unsigned int numNewVertices [private] |
Definition at line 61 of file AF2Rule.hpp.
const std::string ruleName [private] |
Definition at line 57 of file AF2Rule.hpp.