MCPcopy Create free account
hub / github.com/MITK/MITK / GeneratePolyLine

Method GeneratePolyLine

Modules/PlanarFigure/src/DataManagement/mitkPlanarCircle.cpp:145–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void mitk::PlanarCircle::GeneratePolyLine()
146{
147 // TODO: start circle at specified boundary point...
148
149 // clear the PolyLine-Contrainer, it will be reconstructed soon enough...
150 this->ClearPolyLines();
151
152 const Point2D &centerPoint = GetControlPoint(0);
153
154 double radius = m_MinRadius;
155
156 if (!m_RadiusFixed)
157 {
158 const Point2D &boundaryPoint = GetControlPoint(1);
159 radius = centerPoint.EuclideanDistanceTo(boundaryPoint);
160 }
161
162 // Generate poly-line with 64 segments
163 for (int t = 0; t < 64; ++t)
164 {
165 const double alpha = (double)t * vnl_math::pi / 32.0;
166
167 // construct the new polyline point ...
168 Point2D polyLinePoint;
169 polyLinePoint[0] = centerPoint[0] + radius * cos(alpha);
170 polyLinePoint[1] = centerPoint[1] + radius * sin(alpha);
171
172 // ... and append it to the PolyLine.
173 // No extending supported here, so we can set the index of the PolyLineElement to '0'
174 this->AppendPointToPolyLine(0, polyLinePoint);
175 }
176}
177
178void mitk::PlanarCircle::GenerateHelperPolyLine(double /*mmPerDisplayUnit*/, unsigned int /*displayHeight*/)
179{

Callers

nothing calls this directly

Calls 2

ClearPolyLinesMethod · 0.80
AppendPointToPolyLineMethod · 0.80

Tested by

no test coverage detected