Cleanup: correct arg wrapping from recent cleanup

This commit is contained in:
Campbell Barton
2019-05-01 19:26:47 +10:00
parent 928becec60
commit 1cb091ae7a
3 changed files with 183 additions and 123 deletions

View File

@@ -98,8 +98,8 @@ class AdjacencyIterator : public Iterator {
return _internalIterator.isBegin();
}
/*! Returns true if the current ViewEdge is coming towards the iteration vertex. False otherwise.
*/
/*! Returns true if the current ViewEdge is coming towards the iteration vertex.
* False otherwise. */
bool isIncoming() const;
/*! Returns a *pointer* to the pointed ViewEdge. */
@@ -145,9 +145,9 @@ class AdjacencyIterator : public Iterator {
* It makes the works of chaining rules description easier.
* The two main methods that need to overloaded are traverse() and init().
* traverse() tells which ViewEdge to follow, among the adjacent ones.
* If you specify restriction rules (such as "Chain only ViewEdges of the selection"), they will
* be included in the adjacency iterator. (i.e, the adjacent iterator will only stop on "valid"
* edges).
* If you specify restriction rules (such as "Chain only ViewEdges of the selection"),
* they will be included in the adjacency iterator.
* (i.e, the adjacent iterator will only stop on "valid" edges).
*/
class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
protected:
@@ -161,11 +161,15 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
/*! Builds a Chaining Iterator from the first ViewEdge used for iteration and its orientation.
* \param iRestrictToSelection:
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or
* not. \param iRestrictToUnvisited: Indicates whether a ViewEdge that has already been chained
* must be ignored ot not. \param begin: The ViewEdge from which to start the chain. \param
* orientation: The direction to follow to explore the graph. If true, the direction indicated by
* the first ViewEdge is used.
* Indicates whether to force the chaining to stay within
* the set of selected ViewEdges or not.
* \param iRestrictToUnvisited:
* Indicates whether a ViewEdge that has already been chained must be ignored ot not.
* \param begin:
* The ViewEdge from which to start the chain.
* \param orientation:
* The direction to follow to explore the graph. If true,
* the direction indicated by the first ViewEdge is used.
*/
ChainingIterator(bool iRestrictToSelection = true,
bool iRestrictToUnvisited = true,
@@ -201,11 +205,11 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
virtual int init();
/*! This method iterates over the potential next ViewEdges and returns the one that will be
* followed next. returns the next ViewEdge to follow or 0 when the end of the chain is reached.
* followed next. returns the next ViewEdge to follow or 0 when the end of the chain is reached.
* \param it:
* The iterator over the ViewEdges adjacent to the end vertex of the current ViewEdge.
* The Adjacency iterator reflects the restriction rules by only iterating over the valid
* ViewEdges.
* ViewEdges.
*/
virtual int traverse(const AdjacencyIterator &it);
@@ -254,17 +258,22 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
/*! A ViewEdge Iterator used to follow ViewEdges the most naturally.
* For example, it will follow visible ViewEdges of same nature.
* As soon, as the nature or the visibility changes, the iteration stops (by setting the pointed
* ViewEdge to 0). In the case of an iteration over a set of ViewEdge that are both Silhouette and
* Crease, there will be a precedence of the silhouette over the crease criterion.
* ViewEdge to 0). In the case of an iteration over a set of ViewEdge that are both Silhouette
* and Crease, there will be a precedence of the silhouette over the crease criterion.
*/
class ChainSilhouetteIterator : public ChainingIterator {
public:
/*! Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its
* orientation. \param iRestrictToSelection: Indicates whether to force the chaining to stay
* within the set of selected ViewEdges or not. \param begin: The ViewEdge from where to start
* the iteration. \param orientation: If true, we'll look for the next ViewEdge among the
* ViewEdges that surround the ending ViewVertex of begin. If false, we'll search over the
* ViewEdges surrounding the ending ViewVertex of begin.
* orientation.
* \param iRestrictToSelection:
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or
* not.
* \param begin:
* The ViewEdge from where to start the iteration.
* \param orientation:
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending
* ViewVertex of begin. If false, we'll search over the ViewEdges surrounding the ending
* ViewVertex of begin.
*/
ChainSilhouetteIterator(bool iRestrictToSelection = true,
ViewEdge *begin = NULL,
@@ -285,7 +294,8 @@ class ChainSilhouetteIterator : public ChainingIterator {
}
/*! This method iterates over the potential next ViewEdges and returns the one that will be
* followed next. When reaching the end of a chain, 0 is returned.
* followed next.
* When reaching the end of a chain, 0 is returned.
*/
virtual int traverse(const AdjacencyIterator &it);
@@ -302,12 +312,13 @@ class ChainSilhouetteIterator : public ChainingIterator {
///////////////////////////////////////////////////////////
/*! A "generic" user-controlled ViewEdge iterator. This iterator is in particular built from a
* unary predicate and a binary predicate. First, the unary predicate is evaluated for all
* potential next ViewEdges in order to only keep the ones respecting a certain constraint. Then,
* the binary predicate is evaluated on the current ViewEdge together with each ViewEdge of the
* previous selection. The first ViewEdge respecting both the unary predicate and the binary
* predicate is kept as the next one. If none of the potential next ViewEdge respects these 2
* predicates, 0 is returned.
* unary predicate and a binary predicate.
* First, the unary predicate is evaluated for all potential next ViewEdges in order to only
* keep the ones respecting a certain constraint.
* Then, the binary predicate is evaluated on the current ViewEdge together with each ViewEdge
* of the previous selection. The first ViewEdge respecting both the unary predicate and the
* binary predicate is kept as the next one. If none of the potential next ViewEdge respects
* these 2 predicates, 0 is returned.
*/
class ChainPredicateIterator : public ChainingIterator {
protected:
@@ -318,12 +329,16 @@ class ChainPredicateIterator : public ChainingIterator {
public:
/*! Builds a ChainPredicateIterator from a starting ViewEdge and its orientation.
* \param iRestrictToSelection:
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or
* not. \param iRestrictToUnvisited: Indicates whether a ViewEdge that has already been chained
* must be ignored ot not. \param begin: The ViewEdge from where to start the iteration. \param
* orientation: If true, we'll look for the next ViewEdge among the ViewEdges that surround the
* ending ViewVertex of begin. If false, we'll search over the ViewEdges surrounding the ending
* ViewVertex of begin.
* Indicates whether to force the chaining to stay
* within the set of selected ViewEdges or not.
* \param iRestrictToUnvisited:
* Indicates whether a ViewEdge that has already been chained must be ignored ot not.
* \param begin:
* The ViewEdge from where to start the iteration.
* \param orientation:
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending
* ViewVertex of begin. If false, we'll search over the ViewEdges surrounding the ending
* ViewVertex of begin.
*/
ChainPredicateIterator(bool iRestrictToSelection = true,
bool iRestrictToUnvisited = true,
@@ -336,17 +351,23 @@ class ChainPredicateIterator : public ChainingIterator {
}
/*! Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting
* ViewEdge and its orientation. \param iRestrictToSelection: Indicates whether to force the
* chaining to stay within the set of selected ViewEdges or not. \param iRestrictToUnvisited:
* ViewEdge and its orientation.
* \param iRestrictToSelection:
* Indicates whether to force the chaining to stay
* within the set of selected ViewEdges or not.
* \param iRestrictToUnvisited:
* Indicates whether a ViewEdge that has already been chained must be ignored ot not.
* \param upred:
* The unary predicate that the next ViewEdge must satisfy.
* \param bpred:
* The binary predicate that the next ViewEdge must satisfy together with the actual pointed
* ViewEdge. \param begin: The ViewEdge from where to start the iteration. \param orientation: If
* true, we'll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex
* of begin. If false, we'll search over the ViewEdges surrounding the ending ViewVertex of
* begin.
* ViewEdge.
* \param begin:
* The ViewEdge from where to start the iteration.
* \param orientation:
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending
* ViewVertex of begin. If false, we'll search over the ViewEdges surrounding the ending
* ViewVertex of begin.
*/
ChainPredicateIterator(UnaryPredicate1D &upred,
BinaryPredicate1D &bpred,
@@ -381,7 +402,7 @@ class ChainPredicateIterator : public ChainingIterator {
}
/*! This method iterates over the potential next ViewEdges and returns the one that will be
* followed next. When reaching the end of a chain, 0 is returned.
* followed next. When reaching the end of a chain, 0 is returned.
*/
virtual int traverse(const AdjacencyIterator &it);

View File

@@ -43,9 +43,9 @@
namespace Freestyle {
/*! Class defining the operators used in a style module.
* There are 4 classes of operators: Selection, Chaining, Splitting and Creating. All these
* operators are user controlled in the scripting language through Functors, Predicates and Shaders
* that are taken as arguments.
* There are 4 classes of operators: Selection, Chaining, Splitting and Creating.
* All these operators are user controlled in the scripting language through Functors, Predicates
* and Shaders that are taken as arguments.
*/
class Operators {
@@ -64,13 +64,18 @@ class Operators {
static int select(UnaryPredicate1D &pred);
/*! Builds a set of chains from the current set of ViewEdges.
* Each ViewEdge of the current list starts a new chain. The chaining operator then iterates
* over the ViewEdges of the ViewMap using the user specified iterator. This operator only
* iterates using the increment operator and is therefore unidirectional. \param it: The iterator
* on the ViewEdges of the ViewMap. It contains the chaining rule. \param pred: The predicate on
* the ViewEdge that expresses the stopping condition. \param modifier: A function that takes a
* ViewEdge as argument and that is used to modify the processed ViewEdge state (the timestamp
* incrementation is a typical illustration of such a modifier)
* Each ViewEdge of the current list starts a new chain.
* The chaining operator then iterates over the ViewEdges
* of the ViewMap using the user specified iterator.
* This operator only iterates using the increment operator and is therefore unidirectional.
* \param it:
* The iterator on the ViewEdges of the ViewMap. It contains the chaining rule.
* \param pred:
* The predicate on the ViewEdge that expresses the stopping condition.
* \param modifier:
* A function that takes a ViewEdge as argument and that is used to modify the
* processed ViewEdge state (the timestamp incrementation is a typical illustration of
* such a modifier)
*/
static int chain(ViewEdgeInternal::ViewEdgeIterator &it,
UnaryPredicate1D &pred,
@@ -78,56 +83,66 @@ class Operators {
/*! Builds a set of chains from the current set of ViewEdges.
* Each ViewEdge of the current list starts a new chain. The chaining operator then iterates
* over the ViewEdges of the ViewMap using the user specified iterator. This operator only
* iterates using the increment operator and is therefore unidirectional. This chaining operator
* is different from the previous one because it doesn't take any modifier as argument. Indeed,
* the time stamp (insuring that a ViewEdge is processed one time) is automatically managed in
* this case. \param it: The iterator on the ViewEdges of the ViewMap. It contains the chaining
* rule. \param pred: The predicate on the ViewEdge that expresses the stopping condition.
* over the ViewEdges
* of the ViewMap using the user specified iterator.
* This operator only iterates using the increment operator and is therefore unidirectional.
* This chaining operator is different from the previous one because it doesn't take any
* modifier as argument. Indeed, the time stamp (insuring that a ViewEdge is processed one time)
* is automatically managed in this case.
* \param it:
* The iterator on the ViewEdges of the ViewMap. It contains the chaining rule.
* \param pred:
* The predicate on the ViewEdge that expresses the stopping condition.
*/
static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred);
/*! Builds a set of chains from the current set of ViewEdges.
* Each ViewEdge of the current list potentially starts a new chain. The chaining operator then
* iterates over the ViewEdges of the ViewMap using the user specified iterator. This operator
* iterates both using the increment and decrement operators and is therefore bidirectional. This
* operator works with a ChainingIterator which contains the chaining rules. It is this last one
* which can be told to chain only edges that belong to the selection or not to process twice a
* ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its chaining time
* stamp is incremented. This allows you to keep track of the number of chains to which a
* ViewEdge belongs to. \param it: The ChainingIterator on the ViewEdges of the ViewMap. It
* contains the chaining rule. \param pred: The predicate on the ViewEdge that expresses the
* stopping condition.
* iterates over the ViewEdges of the ViewMap using the user specified iterator.
* This operator iterates both using the increment and decrement operators and is therefore
* bidirectional. This operator works with a ChainingIterator which contains the chaining rules.
* It is this last one which can be told to chain only edges that belong to the selection or not
* to process twice a ViewEdge during the chaining. Each time a ViewEdge is added to a chain,
* its chaining time stamp is incremented. This allows you to keep track of the number of chains
* to which a ViewEdge belongs to.
* \param it:
* The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule.
* \param pred:
* The predicate on the ViewEdge that expresses the stopping condition.
*/
static int bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred);
/*! The only difference with the above bidirectional chaining algorithm is that we don't need to
* pass a stopping criterion. This might be desirable when the stopping criterion is already
* contained in the iterator definition. Builds a set of chains from the current set of
* ViewEdges. Each ViewEdge of the current list potentially starts a new chain. The chaining
* operator then iterates over the ViewEdges of the ViewMap using the user specified iterator.
* pass a stopping criterion. This might be desirable when the stopping criterion is already
* contained in the iterator definition. Builds a set of chains from the current set of
* ViewEdges. Each ViewEdge of the current list potentially starts a new chain. The chaining
* operator then iterates over the ViewEdges of the ViewMap using the user specified iterator.
* This operator iterates both using the increment and decrement operators and is therefore
* bidirectional. This operator works with a ChainingIterator which contains the chaining rules.
* It is this last one which can be told to chain only edges that belong to the selection or not
* to process twice a ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its
* chaining time stamp is incremented. This allows you to keep track of the number of chains to
* which a ViewEdge belongs to. \param it: The ChainingIterator on the ViewEdges of the ViewMap.
* It contains the chaining rule.
* bidirectional. This operator works with a ChainingIterator which contains the chaining rules.
* It is this last one which can be told to chain only edges that belong to the selection or not
* to process twice a ViewEdge during the chaining. Each time a ViewEdge is added to a chain,
* its chaining time stamp is incremented. This allows you to keep track of the number of chains
* to which a ViewEdge belongs to.
* \param it:
* The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule.
*/
static int bidirectionalChain(ChainingIterator &it);
/*! Splits each chain of the current set of chains in a sequential way.
* The points of each chain are processed (with a specified sampling) sequentially.
* Each time a user specified starting condition is verified, a new chain begins and ends as
* soon as a user-defined stopping predicate is verified. This allows chains overlapping rather
* than chains partitioning. The first point of the initial chain is the first point of one of
* the resulting chains. The splitting ends when no more chain can start. \param startingPred:
* soon as a user-defined stopping predicate is verified.
* This allows chains overlapping rather than chains partitioning.
* The first point of the initial chain is the first point of one of the resulting chains.
* The splitting ends when no more chain can start.
* \param startingPred:
* The predicate on a point that expresses the starting condition
* \param stoppingPred:
* The predicate on a point that expresses the stopping condition
* \param sampling:
* The resolution used to sample the chain for the predicates evaluation. (The chain is
* not actually resampled, a virtual point only progresses along the curve using this resolution)
* The resolution used to sample the chain for the predicates evaluation.
* (The chain is not actually resampled, a virtual point only progresses along the
* curve using this resolution)
*/
static int sequentialSplit(UnaryPredicate0D &startingPred,
UnaryPredicate0D &stoppingPred,
@@ -135,25 +150,33 @@ class Operators {
/*! Splits each chain of the current set of chains in a sequential way.
* The points of each chain are processed (with a specified sampling) sequentially and each time
* a user specified condition is verified, the chain is split into two chains. The resulting set
* of chains is a partition of the initial chain \param pred: The predicate on a point that
* expresses the splitting condition \param sampling: The resolution used to sample the chain for
* the predicate evaluation. (The chain is not actually resampled, a virtual point only
* progresses along the curve using this resolution)
* a user specified condition is verified, the chain is split into two chains.
* The resulting set of chains is a partition of the initial chain
* \param pred:
* The predicate on a point that expresses the splitting condition
* \param sampling:
* The resolution used to sample the chain for the predicate evaluation.
* (The chain is not actually resampled, a virtual point only progresses along the
* curve using this resolution)
*/
static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f);
/*! Splits the current set of chains in a recursive way.
* We process the points of each chain (with a specified sampling) to find the point minimizing
* a specified function. The chain is split in two at this point and the two new chains are
* processed in the same way. The recursivity level is controlled through a predicate 1D that
* expresses a stopping condition on the chain that is about to be processed. \param func: The
* Unary Function evaluated at each point of the chain. The splitting point is the point
* minimizing this function \param pred: The Unary Predicate ex pressing the recursivity stopping
* condition. This predicate is evaluated for each curve before it actually gets split. If
* pred(chain) is true, the curve won't be split anymore. \param sampling: The resolution used to
* sample the chain for the predicates evaluation. (The chain is not actually resampled, a
* virtual point only progresses along the curve using this resolution)
* We process the points of each chain (with a specified sampling) to find the point
* minimizing a specified function. The chain is split in two at this point and the two new
* chains are processed in the same way. The recursivity level is controlled through a
* predicate 1D that expresses a stopping condition on the chain that is about to be processed.
* \param func:
* The Unary Function evaluated at each point of the chain.
* The splitting point is the point minimizing this function
* \param pred:
* The Unary Predicate ex pressing the recursivity stopping condition.
* This predicate is evaluated for each curve before it actually gets split.
* If pred(chain) is true, the curve won't be split anymore.
* \param sampling:
* The resolution used to sample the chain for the predicates evaluation. (The chain
* is not actually resampled, a virtual point only progresses along the curve using
* this resolution)
*/
static int recursiveSplit(UnaryFunction0D<double> &func,
UnaryPredicate1D &pred,
@@ -161,30 +184,37 @@ class Operators {
/*! Splits the current set of chains in a recursive way.
* We process the points of each chain (with a specified sampling) to find the point minimizing
* a specified function. The chain is split in two at this point and the two new chains are
* processed in the same way. The user can specify a 0D predicate to make a first selection on
* the points that can potentially be split. A point that doesn't verify the 0D predicate won't
* be candidate in realizing the min. The recursivity level is controlled through a predicate 1D
* that expresses a stopping condition on the chain that is about to be processed. \param func:
* a specified function. The chain is split in two at this point and the two new chains are
* processed in the same way. The user can specify a 0D predicate to make a first selection on
* the points that can potentially be split. A point that doesn't verify the 0D predicate
* won't be candidate in realizing the min. The recursivity level is controlled through a
* predicate 1D that expresses a stopping condition on the chain that is about to be processed.
* \param func:
* The Unary Function evaluated at each point of the chain.
* The splitting point is the point minimizing this function
* \param pred0d:
* The Unary Predicate 0D used to select the candidate points where the split can
* occur. For example, it is very likely that would rather have your chain splitting around its
* middle point than around one of its extremities. A 0D predicate working on the curvilinear
* abscissa allows to add this kind of constraints. \param pred: The Unary Predicate ex pressing
* the recursivity stopping condition. This predicate is evaluated for each curve before it
* actually gets split. If pred(chain) is true, the curve won't be split anymore. \param
* sampling: The resolution used to sample the chain for the predicates evaluation. (The chain is
* not actually resampled, a virtual point only progresses along the curve using this resolution)
* occur. For example, it is very likely that would rather have your chain splitting
* around its middle point than around one of its extremities. A 0D predicate working
* on the curvilinear abscissa allows to add this kind of constraints.
* \param pred:
* The Unary Predicate ex pressing the recursivity stopping condition.
* This predicate is evaluated for each curve before it actually gets split.
* If pred(chain) is true, the curve won't be split anymore.
* \param sampling:
* The resolution used to sample the chain for the predicates evaluation. (The chain
* is not actually resampled, a virtual point only progresses along the curve using
* this resolution)
*/
static int recursiveSplit(UnaryFunction0D<double> &func,
UnaryPredicate0D &pred0d,
UnaryPredicate1D &pred,
float sampling = 0.0f);
/*! Sorts the current set of chains (or viewedges) according to the comparison predicate given as
* argument. \param pred: The binary predicate used for the comparison
/*! Sorts the current set of chains (or viewedges)
* according to the comparison predicate given as argument.
* \param pred:
* The binary predicate used for the comparison
*/
static int sort(BinaryPredicate1D &pred);

View File

@@ -43,8 +43,8 @@ class FEdge;
class ImagePyramid;
class GrayImage;
/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing
* to retrieve this information from the FEdge Id.
/*! This class checks for every FEdge in which steerable it belongs and stores the mapping
* allowing to retrieve this information from the FEdge Id.
*/
class SteerableViewMap {
protected:
@@ -68,7 +68,7 @@ class SteerableViewMap {
/*! Adds a FEdge to steerable VM.
* Returns the nbOrientations weights corresponding to the FEdge contributions to the
* nbOrientations directional maps.
* nbOrientations directional maps.
*/
double *AddFEdge(FEdge *iFEdge);
@@ -88,12 +88,18 @@ class SteerableViewMap {
unsigned getSVMNumber(unsigned id);
/*! Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the
* steerable viewmap. \param steerableBases: The _nbOrientations+1 images constituting the basis
* for the steerable pyramid. \param copy: If false, the data is not duplicated, and Canvas deals
* with the memory management of these _nbOrientations+1 images. If true, data is copied, and
* it's up to the caller to delete the images. \param iNbLevels: The number of levels desired for
* each pyramid. If iNbLevels == 0, the complete pyramid is built. \param iSigma: The sigma that
* will be used for the gaussian blur
* steerable viewmap.
* \param steerableBases:
* The _nbOrientations+1 images constituting the basis for the steerable pyramid.
* \param copy:
* If false, the data is not duplicated, and Canvas deals with the memory management of these
* _nbOrientations+1 images. If true, data is copied, and it's up to the caller to delete
* the images.
* \param iNbLevels:
* The number of levels desired for each pyramid.
* If iNbLevels == 0, the complete pyramid is built.
* \param iSigma:
* The sigma that will be used for the gaussian blur
*/
void buildImagesPyramids(GrayImage **steerableBases,
bool copy = false,
@@ -113,15 +119,18 @@ class SteerableViewMap {
* \param iLevel:
* The level of the pyramid we want to read
* \param x:
* The abscissa of the desired pixel specified in level0 coordinate system. The origin is the
* lower left corner. \param y: The ordinate of the desired pixel specified in level0 coordinate
* system. The origin is the lower left corner.
* The abscissa of the desired pixel specified in level0 coordinate system.
* The origin is the lower left corner.
* \param y:
* The ordinate of the desired pixel specified in level0 coordinate system.
* The origin is the lower left corner.
*/
float readSteerableViewMapPixel(unsigned iOrientation, int iLevel, int x, int y);
/*! Reads a pixel in the one of the level of the pyramid containing the images of the complete
* ViewMap. Returns a value between 0 and 1. Equivalent to :
* readSteerableViewMapPixel(nbOrientations, x, y)
/*! Reads a pixel in the one of the level of the pyramid containing the images
* of the complete ViewMap.
* Returns a value between 0 and 1.
* Equivalent to : readSteerableViewMapPixel(nbOrientations, x, y)
*/
float readCompleteViewMapPixel(int iLevel, int x, int y);