34 subdivisionPoints.clear();
42 unsigned int index, indexPrev, indexNext, indexNextNext;
44 const unsigned int numberOfPoints = subdivisionPoints.size();
49 for (index = 0; index < numberOfPoints; ++index)
53 indexPrev = (numberOfPoints + index - 1) % numberOfPoints;
54 indexNext = (index + 1) % numberOfPoints;
55 indexNextNext = (index + 2) % numberOfPoints;
58 (0.5 +
GetTensionParameter()) * (
double)(subdivisionPoints[index][0] + subdivisionPoints[indexNext][0]) -
59 GetTensionParameter() * (double)(subdivisionPoints[indexPrev][0] + subdivisionPoints[indexNextNext][0]);
61 (0.5 +
GetTensionParameter()) * (
double)(subdivisionPoints[index][1] + subdivisionPoints[indexNext][1]) -
62 GetTensionParameter() * (double)(subdivisionPoints[indexPrev][1] + subdivisionPoints[indexNextNext][1]);
64 newSubdivisionPoints.push_back(newPoint);
68 ControlPointListType::const_iterator it, itNew;
70 for (it = subdivisionPoints.cbegin(), itNew = newSubdivisionPoints.cbegin(); it != subdivisionPoints.cend();
73 mergedSubdivisionPoints.push_back(*it);
74 mergedSubdivisionPoints.push_back(*itNew);
77 subdivisionPoints = mergedSubdivisionPoints;
79 newSubdivisionPoints.clear();
83 const bool isInitiallyPlaced = this->
GetProperty(
"initiallyplaced");
86 ControlPointListType::const_iterator it;
87 for (it = subdivisionPoints.cbegin(), i = 0; it != subdivisionPoints.cend(); ++it, ++i)
92 unsigned int nextIndex;
114 subdivisionPoints.clear();
126 return Superclass::Equals(other);
138 if (indexOfPolylinePoint < 0 || indexOfPolylinePoint > static_cast<int>(polyLine.size()))
141 mitk::PlanarFigure::ControlPointListType::const_iterator elem;
145 mitk::PlanarFigure::PolyLineType::const_iterator polyLineIter;
146 auto polyLineEnd = polyLine.cend();
147 auto polyLineStart = polyLine.cbegin();
148 polyLineStart += indexOfPolylinePoint;
150 for (polyLineIter = polyLineStart; polyLineIter != polyLineEnd; ++polyLineIter)
152 elem = std::find(first, end, *polyLineIter);
155 return std::distance(first, elem);
bool Equals(const mitk::PlanarFigure &other) const override
Compare two PlanarFigure objects Note: all subclasses have to implement the method on their own...
unsigned int GetSubdivisionRounds() const
How many times should we generate a round of subdivisions?
unsigned int GetMinimumNumberOfControlPoints() const override
Subdivision Polygon has 3 control points per definition.
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
Implementation of PlanarFigure representing a polygon with two or more control points.
int GetControlPointForPolylinePoint(int indexOfPolylinePoint, int polyLineIndex) const override
Returns the id of the control-point that corresponds to the given polyline-point. ...
PlanarSubdivisionPolygon()
float GetTensionParameter() const
Parameter w_tension defines the tension. the higher w_tension, the lower the "tension" on points...
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;.
MITKCORE_EXPORT const ScalarType eps