MCPcopy Create free account
hub / github.com/Kitware/VTK / BuildRing

Method BuildRing

Interaction/Widgets/vtkCompassRepresentation.cxx:173–222  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

171
172//------------------------------------------------------------------------------
173void vtkCompassRepresentation::BuildRing()
174{
175 // create the polydata
176 this->Ring = vtkPolyData::New();
177 this->Ring->SetPoints(this->Points);
178
179 // build the cells
180 vtkCellArray* ringCells = vtkCellArray::New();
181 for (int i = 0; i < 4; ++i)
182 {
183 ringCells->InsertNextCell(17);
184 for (int j = 0; j < 8; ++j)
185 {
186 ringCells->InsertCellPoint(i * 9 + j);
187 }
188 for (int j = 0; j < 8; ++j)
189 {
190 ringCells->InsertCellPoint(i * 9 + 35 + 7 - j);
191 }
192 ringCells->InsertCellPoint(i * 9);
193 }
194 this->Ring->SetLines(ringCells);
195 ringCells->Delete();
196
197 // add some polys
198 vtkCellArray* markCells = vtkCellArray::New();
199 for (int i = 1; i < 4; ++i)
200 {
201 markCells->InsertNextCell(3);
202 markCells->InsertCellPoint(i + 69);
203 markCells->InsertCellPoint(i * 9 + 35);
204 markCells->InsertCellPoint(i * 9 + 33);
205 }
206 this->Ring->SetPolys(markCells);
207 markCells->Delete();
208
209 // build the points
210 for (int i = 0; i < 35; ++i)
211 {
212 this->Points->SetPoint(i, this->OuterRadius * cos(vtkMath::RadiansFromDegrees(10. * (i + 10))),
213 this->OuterRadius * sin(vtkMath::RadiansFromDegrees(10. * (i + 10))), 0.0);
214 this->Points->SetPoint(i + 35,
215 this->InnerRadius * cos(vtkMath::RadiansFromDegrees(10. * (i + 10))),
216 this->InnerRadius * sin(vtkMath::RadiansFromDegrees(10. * (i + 10))), 0.0);
217 }
218 // add the WSE points
219 this->Points->SetPoint(70, -this->OuterRadius - 0.1, 0.0, 0.0);
220 this->Points->SetPoint(71, 0.0, -this->OuterRadius - 0.1, 0.0);
221 this->Points->SetPoint(72, this->OuterRadius + 0.1, 0.0, 0.0);
222}
223
224//------------------------------------------------------------------------------
225vtkCompassRepresentation::~vtkCompassRepresentation()

Callers 1

Calls 10

InsertCellPointMethod · 0.80
SetLinesMethod · 0.80
SetPolysMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
cosFunction · 0.50
sinFunction · 0.50
SetPointsMethod · 0.45
InsertNextCellMethod · 0.45
SetPointMethod · 0.45

Tested by

no test coverage detected