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

Method Set

Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.cxx:32–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void ImplicitFunctionConverter::Set(vtkImplicitFunction* function)
33{
34 vtkBox* box = nullptr;
35 vtkCylinder* cylinder = nullptr;
36 vtkPlane* plane = nullptr;
37 vtkSphere* sphere = nullptr;
38
39 if (function->GetTransform())
40 {
41 throw viskores::cont::ErrorBadType(
42 "Viskores's implicit functions currently do not support transformations.");
43 }
44
45 if ((box = vtkBox::SafeDownCast(function)))
46 {
47 double xmin[3], xmax[3];
48 box->GetXMin(xmin);
49 box->GetXMax(xmax);
50
51 this->OutFunction = viskores::Box(MakeFVec3(xmin), MakeFVec3(xmax));
52 }
53 else if ((cylinder = vtkCylinder::SafeDownCast(function)))
54 {
55 double center[3], axis[3], radius;
56 cylinder->GetCenter(center);
57 cylinder->GetAxis(axis);
58 radius = cylinder->GetRadius();
59
60 this->OutFunction = viskores::Cylinder(
61 MakeFVec3(center), MakeFVec3(axis), static_cast<viskores::FloatDefault>(radius));
62 }
63 else if ((plane = vtkPlane::SafeDownCast(function)))
64 {
65 double origin[3], normal[3];
66 plane->GetOrigin(origin);
67 plane->GetNormal(normal);
68
69 this->OutFunction = viskores::Plane(MakeFVec3(origin), MakeFVec3(normal));
70 }
71 else if ((sphere = vtkSphere::SafeDownCast(function)))
72 {
73 double center[3], radius;
74 sphere->GetCenter(center);
75 radius = sphere->GetRadius();
76
77 this->OutFunction =
78 viskores::Sphere(MakeFVec3(center), static_cast<viskores::FloatDefault>(radius));
79 }
80 else
81 {
82 std::string message = std::string("The implicit functions ") + function->GetClassName() +
83 std::string(" is not supported by viskores.");
84 throw viskores::cont::ErrorBadType(message);
85 }
86
87 this->MTime = function->GetMTime();
88 this->InFunction = function;
89}

Callers 14

RequestDataObjectMethod · 0.45
RequestDataObjectMethod · 0.45
operator()Method · 0.45
RequestDataMethod · 0.45
RequestDataObjectMethod · 0.45
RequestInformationMethod · 0.45
RequestUpdateExtentMethod · 0.45

Calls 14

BoxFunction · 0.85
PlaneClass · 0.85
SphereClass · 0.85
GetXMinMethod · 0.80
GetXMaxMethod · 0.80
stringClass · 0.50
GetTransformMethod · 0.45
GetCenterMethod · 0.45
GetAxisMethod · 0.45
GetRadiusMethod · 0.45
GetOriginMethod · 0.45
GetNormalMethod · 0.45

Tested by

no test coverage detected