19 : FEATURE_ID_LENGTH(
Superclass::AddFeature(
"Length",
"mm")), m_NumberOfSegments(100)
30 for (
unsigned int i = 0; i < m_NumberOfSegments; ++i)
31 length += static_cast<Point2D>(
m_PolyLines[0][i]).EuclideanDistanceTo(static_cast<Point2D>(
m_PolyLines[0][i + 1]));
38 return m_NumberOfSegments;
43 m_NumberOfSegments =
std::max(1U, numSegments);
58 for (
unsigned int i = 0; i < numHelperPolyLinePoints; ++i)
66 const unsigned int numPolyLinePoints = m_NumberOfSegments + 1;
68 for (
unsigned int i = 0; i < numPolyLinePoints; ++i)
69 this->
AppendPointToPolyLine(0, this->ComputeDeCasteljauPoint(i / static_cast<ScalarType>(m_NumberOfSegments)));
76 if (m_DeCasteljauPoints.size() != n)
77 m_DeCasteljauPoints.resize(n);
79 for (
unsigned int i = 0; i < n; ++i)
87 for (
unsigned int i = 0; i < n; ++i)
89 m_DeCasteljauPoints[i][0] = (1 - t) * m_DeCasteljauPoints[i][0] + t * m_DeCasteljauPoints[i + 1][0];
90 m_DeCasteljauPoints[i][1] = (1 - t) * m_DeCasteljauPoints[i][1] + t * m_DeCasteljauPoints[i + 1][1];
94 return m_DeCasteljauPoints[0];
101 if (indexOfPolylinePoint < 0 || indexOfPolylinePoint > static_cast<int>(polyLine.size()))
104 mitk::PlanarFigure::ControlPointListType::const_iterator elem;
108 mitk::PlanarFigure::PolyLineType::const_iterator polyLineIter;
109 auto polyLineEnd = polyLine.cend();
110 auto polyLineStart = polyLine.cbegin();
111 polyLineStart += indexOfPolylinePoint;
113 for (polyLineIter = polyLineStart; polyLineIter != polyLineEnd; ++polyLineIter)
115 elem = std::find(first, end, *polyLineIter);
118 return std::distance(first, elem);
142 if (otherBezierCurve)
144 if (this->m_NumberOfSegments != otherBezierCurve->m_NumberOfSegments)
146 if (this->m_DeCasteljauPoints != otherBezierCurve->m_DeCasteljauPoints)
148 return Superclass::Equals(other);
void EvaluateFeaturesInternal() override
Calculates quantities of all features of this planar figure. Must be implemented in sub-classes...
void GenerateHelperPolyLine(double, unsigned int) override
Generates the poly-lines that should be drawn the same size regardless of zoom. Must be implemented i...
bool IsHelperToBePainted(unsigned int index) const override
Returns whether a helper polyline should be painted or not.
itk::DataObject Superclass
unsigned int GetMinimumNumberOfControlPoints() const override
Returns the minimum number of control points needed to represent this figure.
unsigned int GetMaximumNumberOfControlPoints() const override
Returns the maximum number of control points allowed for this figure (e.g. 3 for triangles).
const unsigned int FEATURE_ID_LENGTH
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure. Must be implemented in sub-classes...
int GetControlPointForPolylinePoint(int indexOfPolylinePoint, int polyLineIndex) const override
Returns the id of the control-point that corresponds to the given polyline-point. ...
unsigned int GetNumberOfSegments() const
bool Equals(const mitk::PlanarFigure &other) const override
Compare two PlanarFigure objects Note: all subclasses have to implement the method on their own...
void SetNumberOfSegments(unsigned int numSegments)