21 #ifndef otbSimplifyPathFunctor_h
22 #define otbSimplifyPathFunctor_h
53 template <
class TInput,
class TOutput>
83 newPath->Initialize();
86 if (vertexList->Size() > 0)
92 newPath->AddVertex(beginIt.Value());
94 while (beginIt != beforeTheEndIt)
103 newPath->AddVertex(endIt.Value());
108 newPath->SetMetaDataDictionary(input->GetMetaDataDictionary());
120 while (segmentIt != end)
122 double crossProduct = (end.Value()[0] - begin.Value()[0]) * (segmentIt.Value()[1] - begin.Value()[1]) -
123 (end.Value()[1] - begin.Value()[1]) * (segmentIt.Value()[0] - begin.Value()[0]);
125 (end.Value()[0] - begin.Value()[0]) * (end.Value()[0] - begin.Value()[0]) + (end.Value()[1] - begin.Value()[1]) * (end.Value()[1] - begin.Value()[1]);
128 double distsq = crossProduct * crossProduct / lengthSeg;
This filter performs a simplification of the input path.
bool TestPathConsistency(VertexListConstIteratorType begin, VertexListConstIteratorType end) const
OutputPathType::Pointer OutputPathPointerType
void SetTolerance(double Tolerance)
TInput::VertexListType::ConstPointer VertexListConstPointerType
TInput::VertexListType::ConstIterator VertexListConstIteratorType
OutputPathPointerType operator()(const TInput *input)
double GetTolerance(void) const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.