tahoma2d/toonz/sources/common/trop/raster_edge_evaluator.h

52 lines
1.8 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
// #pragma once // could not use by INCLUDE_HPP
2016-03-19 06:57:51 +13:00
#ifndef RASTER_EDGE_EVALUATOR_H
#define RASTER_EDGE_EVALUATOR_H
#include "tcg/tcg_sequence_ops.h"
#include "tcg/tcg_polylineops.h"
//*************************************************************************
// Standard Raster Edge Evaluator
//*************************************************************************
/*!
2016-06-15 18:43:10 +12:00
\brief This class implements an evaluator for tcg's sequential reduction
algorithm
2016-03-19 06:57:51 +13:00
that can be used to simplify the borders extracted from a raster image under
2016-06-15 18:43:10 +12:00
a specified tolerance factor. This is typically used as a step in
polygonal-based
2016-03-19 06:57:51 +13:00
image vectorization processes.
\sa The tcg::sequence_ops::minimalPath() function.
*/
template <typename RanIt>
2016-06-15 18:43:10 +12:00
class RasterEdgeEvaluator
: public tcg::polyline_ops::StandardDeviationEvaluator<RanIt> {
double m_tolerance; //!< Maximal distance of an edge from one of the
//!< points it approximates, in the Manhattan metric
double m_maxLength; //!< Maximal length of an acceptable edge length,
//!< in the standard metric
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
typedef typename tcg::polyline_ops::StandardDeviationEvaluator<
RanIt>::iterator_type iterator_type;
typedef
typename tcg::polyline_ops::StandardDeviationEvaluator<RanIt>::point_type
point_type;
typedef typename tcg::polyline_ops::StandardDeviationEvaluator<
RanIt>::penalty_type penalty_type;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
RasterEdgeEvaluator(const iterator_type &begin, const iterator_type &end,
double tolerance, double maxLength);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
iterator_type furthestFrom(const iterator_type &it);
penalty_type penalty(const iterator_type &a, const iterator_type &b);
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // RASTER_EDGE_EVALUATOR_H
2016-03-19 06:57:51 +13:00
#ifdef INCLUDE_HPP
#include "raster_edge_evaluator.hpp"
#endif