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

Method SetAxes

Common/DataModel/vtkSphericalPointIterator.cxx:346–467  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

344
345//------------------------------------------------------------------------------
346void vtkSphericalPointIterator::SetAxes(int axesType, int resolution)
347{
348 vtkNew<vtkDoubleArray> axes;
349 axes->SetNumberOfComponents(3);
350 int res = (resolution < 1 ? 1 : resolution);
351
352 if (axesType == XY_CW_AXES)
353 {
354 axes->SetNumberOfTuples(res);
355 for (auto i = res; i > 0; --i)
356 {
357 double theta = ((static_cast<double>(i) / res) * 2.0 * vtkMath::Pi());
358 axes->SetTuple3(res - i, cos(theta), sin(theta), 0);
359 }
360 }
361
362 else if (axesType == XY_CCW_AXES)
363 {
364 axes->SetNumberOfTuples(res);
365 for (auto i = 0; i < res; ++i)
366 {
367 double theta = ((static_cast<double>(i) / res) * 2.0 * vtkMath::Pi());
368 axes->SetTuple3(i, cos(theta), sin(theta), 0);
369 }
370 }
371
372 else if (axesType == XY_SQUARE_AXES)
373 {
374 axes->SetNumberOfTuples(4);
375 axes->SetTuple3(0, -1, 0, 0);
376 axes->SetTuple3(1, 1, 0, 0);
377 axes->SetTuple3(2, 0, -1, 0);
378 axes->SetTuple3(3, 0, 1, 0);
379 }
380
381 else if (axesType == CUBE_AXES)
382 {
383 axes->SetNumberOfTuples(6);
384 axes->SetTuple3(0, -1, 0, 0);
385 axes->SetTuple3(1, 1, 0, 0);
386 axes->SetTuple3(2, 0, -1, 0);
387 axes->SetTuple3(3, 0, 1, 0);
388 axes->SetTuple3(4, 0, 0, -1);
389 axes->SetTuple3(5, 0, 0, 1);
390 }
391
392 else if (axesType == OCTAHEDRON_AXES)
393 {
394 axes->SetNumberOfTuples(8);
395 axes->SetTuple3(0, 0, -0.47140451272, -0.33333333333);
396 axes->SetTuple3(1, 0.47140451272, 0, -0.33333333333);
397 axes->SetTuple3(2, 0, 0.47140451272, -0.33333333333);
398 axes->SetTuple3(3, -0.47140451272, 0, -0.33333333333);
399 axes->SetTuple3(4, 0, -0.47140451272, 0.33333333333);
400 axes->SetTuple3(5, 0.47140451272, 0, 0.33333333333);
401 axes->SetTuple3(6, 0, 0.47140451272, 0.33333333333);
402 axes->SetTuple3(7, -0.47140451272, 0, 0.33333333333);
403 }

Calls 6

PiFunction · 0.85
SetTuple3Method · 0.80
cosFunction · 0.50
sinFunction · 0.50
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected