VTK-m  2.0
ImplicitFunction.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_ImplicitFunction_h
11 #define vtk_m_ImplicitFunction_h
12 
13 #include <vtkm/Bounds.h>
14 #include <vtkm/Math.h>
15 #include <vtkm/VectorAnalysis.h>
16 
17 #include <vtkm/exec/Variant.h>
18 
19 // For interface class only.
21 
22 namespace vtkm
23 {
24 
25 //============================================================================
26 namespace internal
27 {
28 
38 template <typename Derived>
39 class ImplicitFunctionBase : public vtkm::cont::ExecutionAndControlObjectBase
40 {
41 public:
42  using Scalar = vtkm::FloatDefault;
43  using Vector = vtkm::Vec<Scalar, 3>;
44 
45  VTKM_EXEC_CONT Scalar Value(Scalar x, Scalar y, Scalar z) const
46  {
47  return reinterpret_cast<const Derived*>(this)->Value(Vector(x, y, z));
48  }
49 
50  VTKM_EXEC_CONT Vector Gradient(Scalar x, Scalar y, Scalar z) const
51  {
52  return reinterpret_cast<const Derived*>(this)->Gradient(Vector(x, y, z));
53  }
54 
55  VTKM_CONT Derived PrepareForExecution(vtkm::cont::DeviceAdapterId, vtkm::cont::Token&) const
56  {
57  return *reinterpret_cast<const Derived*>(this);
58  }
59 
60  VTKM_CONT Derived PrepareForControl() const { return *reinterpret_cast<const Derived*>(this); }
61 };
62 
63 } // namespace vtkm::internal
64 
65 //============================================================================
70 template <typename FunctionType>
72 {
73 public:
74  using Scalar = typename FunctionType::Scalar;
75  using Vector = typename FunctionType::Vector;
76 
77  ImplicitFunctionValueFunctor() = default;
78 
80  const vtkm::internal::ImplicitFunctionBase<FunctionType>& function)
81  : Function(reinterpret_cast<const FunctionType&>(function))
82  {
83  }
84 
85  VTKM_EXEC_CONT ImplicitFunctionValueFunctor(const FunctionType& function)
86  : Function(function)
87  {
88  }
89 
90  VTKM_EXEC_CONT Scalar operator()(const Vector& point) const
91  {
92  return this->Function.Value(point);
93  }
94 
95 private:
96  FunctionType Function;
97 };
98 
103 template <typename FunctionType>
105 {
106 public:
107  using Scalar = typename FunctionType::Scalar;
108  using Vector = typename FunctionType::Vector;
109 
111 
113  const vtkm::internal::ImplicitFunctionBase<FunctionType>& function)
114  : Function(reinterpret_cast<const FunctionType&>(function))
115  {
116  }
117 
118  VTKM_EXEC_CONT ImplicitFunctionGradientFunctor(const FunctionType& function)
119  : Function(function)
120  {
121  }
122 
124  {
125  return this->Function->Gradient(point);
126  }
127 
128 private:
129  FunctionType Function;
130 };
131 
132 //============================================================================
139 
140 class VTKM_ALWAYS_EXPORT Box : public internal::ImplicitFunctionBase<Box>
141 {
142 public:
145  : MinPoint(Vector(Scalar(-0.5)))
146  , MaxPoint(Vector(Scalar(0.5)))
147  {
148  }
149 
150  VTKM_EXEC_CONT Box(const Vector& minPoint, const Vector& maxPoint)
151  : MinPoint(minPoint)
152  , MaxPoint(maxPoint)
153  {
154  }
155 
156  VTKM_EXEC_CONT Box(Scalar xmin, Scalar xmax, Scalar ymin, Scalar ymax, Scalar zmin, Scalar zmax)
157  : MinPoint(xmin, ymin, zmin)
158  , MaxPoint(xmax, ymax, zmax)
159  {
160  }
161 
162  VTKM_CONT Box(const vtkm::Bounds& bounds) { this->SetBounds(bounds); }
163 
164  VTKM_CONT void SetMinPoint(const Vector& point) { this->MinPoint = point; }
165 
166  VTKM_CONT void SetMaxPoint(const Vector& point) { this->MaxPoint = point; }
167 
168  VTKM_EXEC_CONT const Vector& GetMinPoint() const { return this->MinPoint; }
169 
170  VTKM_EXEC_CONT const Vector& GetMaxPoint() const { return this->MaxPoint; }
171 
172  VTKM_CONT void SetBounds(const vtkm::Bounds& bounds)
173  {
174  this->SetMinPoint({ Scalar(bounds.X.Min), Scalar(bounds.Y.Min), Scalar(bounds.Z.Min) });
175  this->SetMaxPoint({ Scalar(bounds.X.Max), Scalar(bounds.Y.Max), Scalar(bounds.Z.Max) });
176  }
177 
179  {
180  return vtkm::Bounds(vtkm::Range(this->MinPoint[0], this->MaxPoint[0]),
181  vtkm::Range(this->MinPoint[1], this->MaxPoint[1]),
182  vtkm::Range(this->MinPoint[2], this->MaxPoint[2]));
183  }
184 
185  VTKM_EXEC_CONT Scalar Value(const Vector& point) const
186  {
187  Scalar minDistance = vtkm::NegativeInfinity32();
188  Scalar diff, t, dist;
189  Scalar distance = Scalar(0.0);
190  vtkm::IdComponent inside = 1;
191 
192  for (vtkm::IdComponent d = 0; d < 3; d++)
193  {
194  diff = this->MaxPoint[d] - this->MinPoint[d];
195  if (diff != Scalar(0.0))
196  {
197  t = (point[d] - this->MinPoint[d]) / diff;
198  // Outside before the box
199  if (t < Scalar(0.0))
200  {
201  inside = 0;
202  dist = this->MinPoint[d] - point[d];
203  }
204  // Outside after the box
205  else if (t > Scalar(1.0))
206  {
207  inside = 0;
208  dist = point[d] - this->MaxPoint[d];
209  }
210  else
211  {
212  // Inside the box in lower half
213  if (t <= Scalar(0.5))
214  {
215  dist = MinPoint[d] - point[d];
216  }
217  // Inside the box in upper half
218  else
219  {
220  dist = point[d] - MaxPoint[d];
221  }
222  if (dist > minDistance)
223  {
224  minDistance = dist;
225  }
226  }
227  }
228  else
229  {
230  dist = vtkm::Abs(point[d] - MinPoint[d]);
231  if (dist > Scalar(0.0))
232  {
233  inside = 0;
234  }
235  }
236  if (dist > Scalar(0.0))
237  {
238  distance += dist * dist;
239  }
240  }
241 
242  distance = vtkm::Sqrt(distance);
243  if (inside)
244  {
245  return minDistance;
246  }
247  else
248  {
249  return distance;
250  }
251  }
252 
253  VTKM_EXEC_CONT Vector Gradient(const Vector& point) const
254  {
255  vtkm::IdComponent minAxis = 0;
256  Scalar dist = 0.0;
257  Scalar minDist = vtkm::Infinity32();
258  vtkm::IdComponent3 location;
259  Vector normal(Scalar(0));
260  Vector inside(Scalar(0));
261  Vector outside(Scalar(0));
262  Vector center((this->MaxPoint + this->MinPoint) * Scalar(0.5));
263 
264  // Compute the location of the point with respect to the box
265  // Point will lie in one of 27 separate regions around or within the box
266  // Gradient vector is computed differently in each of the regions.
267  for (vtkm::IdComponent d = 0; d < 3; d++)
268  {
269  if (point[d] < this->MinPoint[d])
270  {
271  // Outside the box low end
272  location[d] = 0;
273  outside[d] = -1.0;
274  }
275  else if (point[d] > this->MaxPoint[d])
276  {
277  // Outside the box high end
278  location[d] = 2;
279  outside[d] = 1.0;
280  }
281  else
282  {
283  location[d] = 1;
284  if (point[d] <= center[d])
285  {
286  // Inside the box low end
287  dist = point[d] - this->MinPoint[d];
288  inside[d] = -1.0;
289  }
290  else
291  {
292  // Inside the box high end
293  dist = this->MaxPoint[d] - point[d];
294  inside[d] = 1.0;
295  }
296  if (dist < minDist) // dist is negative
297  {
298  minDist = dist;
299  minAxis = d;
300  }
301  }
302  }
303 
304  vtkm::Id indx = location[0] + 3 * location[1] + 9 * location[2];
305  switch (indx)
306  {
307  // verts - gradient points away from center point
308  case 0:
309  case 2:
310  case 6:
311  case 8:
312  case 18:
313  case 20:
314  case 24:
315  case 26:
316  for (vtkm::IdComponent d = 0; d < 3; d++)
317  {
318  normal[d] = point[d] - center[d];
319  }
320  vtkm::Normalize(normal);
321  break;
322 
323  // edges - gradient points out from axis of cube
324  case 1:
325  case 3:
326  case 5:
327  case 7:
328  case 9:
329  case 11:
330  case 15:
331  case 17:
332  case 19:
333  case 21:
334  case 23:
335  case 25:
336  for (vtkm::IdComponent d = 0; d < 3; d++)
337  {
338  if (outside[d] != 0.0)
339  {
340  normal[d] = point[d] - center[d];
341  }
342  else
343  {
344  normal[d] = 0.0;
345  }
346  }
347  vtkm::Normalize(normal);
348  break;
349 
350  // faces - gradient points perpendicular to face
351  case 4:
352  case 10:
353  case 12:
354  case 14:
355  case 16:
356  case 22:
357  for (vtkm::IdComponent d = 0; d < 3; d++)
358  {
359  normal[d] = outside[d];
360  }
361  break;
362 
363  // interior - gradient is perpendicular to closest face
364  case 13:
365  normal[0] = normal[1] = normal[2] = 0.0;
366  normal[minAxis] = inside[minAxis];
367  break;
368  default:
369  VTKM_ASSERT(false);
370  break;
371  }
372  return normal;
373  }
374 
375 private:
376  Vector MinPoint;
377  Vector MaxPoint;
378 };
379 
380 //============================================================================
391 class VTKM_ALWAYS_EXPORT Cylinder : public vtkm::internal::ImplicitFunctionBase<Cylinder>
392 {
393 public:
397  : Center(Scalar(0))
398  , Axis(Scalar(0), Scalar(1), Scalar(0))
399  , Radius(Scalar(0.5))
400  {
401  }
402 
403  VTKM_EXEC_CONT Cylinder(const Vector& axis, Scalar radius)
404  : Center(Scalar(0))
405  , Axis(axis)
406  , Radius(radius)
407  {
408  }
409 
410  VTKM_EXEC_CONT Cylinder(const Vector& center, const Vector& axis, Scalar radius)
411  : Center(center)
412  , Axis(vtkm::Normal(axis))
413  , Radius(radius)
414  {
415  }
416 
417  VTKM_CONT void SetCenter(const Vector& center) { this->Center = center; }
418 
419  VTKM_CONT void SetAxis(const Vector& axis) { this->Axis = vtkm::Normal(axis); }
420 
421  VTKM_CONT void SetRadius(Scalar radius) { this->Radius = radius; }
422 
423  VTKM_EXEC_CONT Scalar Value(const Vector& point) const
424  {
425  Vector x2c = point - this->Center;
426  FloatDefault proj = vtkm::Dot(this->Axis, x2c);
427  return vtkm::Dot(x2c, x2c) - (proj * proj) - (this->Radius * this->Radius);
428  }
429 
430  VTKM_EXEC_CONT Vector Gradient(const Vector& point) const
431  {
432  Vector x2c = point - this->Center;
433  FloatDefault t = this->Axis[0] * x2c[0] + this->Axis[1] * x2c[1] + this->Axis[2] * x2c[2];
434  vtkm::Vec<FloatDefault, 3> closestPoint = this->Center + (this->Axis * t);
435  return (point - closestPoint) * FloatDefault(2);
436  }
437 
438 private:
439  Vector Center;
440  Vector Axis;
441  Scalar Radius;
442 };
443 
444 //============================================================================
446 class VTKM_ALWAYS_EXPORT Frustum : public vtkm::internal::ImplicitFunctionBase<Frustum>
447 {
448 public:
450  Frustum() = default;
451 
452  VTKM_EXEC_CONT Frustum(const Vector points[6], const Vector normals[6])
453  {
454  this->SetPlanes(points, normals);
455  }
456 
457  VTKM_EXEC_CONT explicit Frustum(const Vector points[8]) { this->CreateFromPoints(points); }
458 
459  VTKM_EXEC void SetPlanes(const Vector points[6], const Vector normals[6])
460  {
461  for (vtkm::Id index : { 0, 1, 2, 3, 4, 5 })
462  {
463  this->Points[index] = points[index];
464  }
465  for (vtkm::Id index : { 0, 1, 2, 3, 4, 5 })
466  {
467  this->Normals[index] = normals[index];
468  }
469  }
470 
471  VTKM_EXEC void SetPlane(int idx, const Vector& point, const Vector& normal)
472  {
473  VTKM_ASSERT((idx >= 0) && (idx < 6));
474  this->Points[idx] = point;
475  this->Normals[idx] = normal;
476  }
477 
478  VTKM_EXEC_CONT void GetPlanes(Vector points[6], Vector normals[6]) const
479  {
480  for (vtkm::Id index : { 0, 1, 2, 3, 4, 5 })
481  {
482  points[index] = this->Points[index];
483  }
484  for (vtkm::Id index : { 0, 1, 2, 3, 4, 5 })
485  {
486  normals[index] = this->Normals[index];
487  }
488  }
489 
490  VTKM_EXEC_CONT const Vector* GetPoints() const { return this->Points; }
491 
492  VTKM_EXEC_CONT const Vector* GetNormals() const { return this->Normals; }
493 
494  // The points should be specified in the order of hex-cell vertices
495  VTKM_EXEC_CONT void CreateFromPoints(const Vector points[8])
496  {
497  // XXX(clang-format-3.9): 3.8 is silly. 3.9 makes it look like this.
498  // clang-format off
499  int planes[6][3] = {
500  { 3, 2, 0 }, { 4, 5, 7 }, { 0, 1, 4 }, { 1, 2, 5 }, { 2, 3, 6 }, { 3, 0, 7 }
501  };
502  // clang-format on
503 
504  for (int i = 0; i < 6; ++i)
505  {
506  const Vector& v0 = points[planes[i][0]];
507  const Vector& v1 = points[planes[i][1]];
508  const Vector& v2 = points[planes[i][2]];
509 
510  this->Points[i] = v0;
511  this->Normals[i] = vtkm::Normal(vtkm::TriangleNormal(v0, v1, v2));
512  }
513  }
514 
515  VTKM_EXEC_CONT Scalar Value(const Vector& point) const
516  {
517  Scalar maxVal = vtkm::NegativeInfinity<Scalar>();
518  for (vtkm::Id index : { 0, 1, 2, 3, 4, 5 })
519  {
520  const Vector& p = this->Points[index];
521  const Vector& n = this->Normals[index];
522  const Scalar val = vtkm::Dot(point - p, n);
523  maxVal = vtkm::Max(maxVal, val);
524  }
525  return maxVal;
526  }
527 
528  VTKM_EXEC_CONT Vector Gradient(const Vector& point) const
529  {
530  Scalar maxVal = vtkm::NegativeInfinity<Scalar>();
531  vtkm::Id maxValIdx = 0;
532  for (vtkm::Id index : { 0, 1, 2, 3, 4, 5 })
533  {
534  const Vector& p = this->Points[index];
535  const Vector& n = this->Normals[index];
536  Scalar val = vtkm::Dot(point - p, n);
537  if (val > maxVal)
538  {
539  maxVal = val;
540  maxValIdx = index;
541  }
542  }
543  return this->Normals[maxValIdx];
544  }
545 
546 private:
547  Vector Points[6] = { { -0.5f, 0.0f, 0.0f }, { 0.5f, 0.0f, 0.0f }, { 0.0f, -0.5f, 0.0f },
548  { 0.0f, 0.5f, 0.0f }, { 0.0f, 0.0f, -0.5f }, { 0.0f, 0.0f, 0.5f } };
549  Vector Normals[6] = { { -1.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 0.0f, -1.0f, 0.0f },
550  { 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, -1.0f }, { 0.0f, 0.0f, 1.0f } };
551 };
552 
553 //============================================================================
560 class VTKM_ALWAYS_EXPORT Plane : public vtkm::internal::ImplicitFunctionBase<Plane>
561 {
562 public:
565  : Origin(Scalar(0))
566  , Normal(Scalar(0), Scalar(0), Scalar(1))
567  {
568  }
569 
571  VTKM_EXEC_CONT explicit Plane(const Vector& normal)
572  : Origin(Scalar(0))
573  , Normal(normal)
574  {
575  }
576 
578  VTKM_EXEC_CONT Plane(const Vector& origin, const Vector& normal)
579  : Origin(origin)
580  , Normal(normal)
581  {
582  }
583 
584  VTKM_CONT void SetOrigin(const Vector& origin) { this->Origin = origin; }
585 
586  VTKM_CONT void SetNormal(const Vector& normal) { this->Normal = normal; }
587 
588  VTKM_EXEC_CONT const Vector& GetOrigin() const { return this->Origin; }
589  VTKM_EXEC_CONT const Vector& GetNormal() const { return this->Normal; }
590 
591  VTKM_EXEC_CONT Scalar Value(const Vector& point) const
592  {
593  return vtkm::Dot(point - this->Origin, this->Normal);
594  }
595 
596  VTKM_EXEC_CONT Vector Gradient(const Vector&) const { return this->Normal; }
597 
598 private:
599  Vector Origin;
600  Vector Normal;
601 };
602 
603 //============================================================================
611 class VTKM_ALWAYS_EXPORT Sphere : public vtkm::internal::ImplicitFunctionBase<Sphere>
612 {
613 public:
616  : Radius(Scalar(0.5))
617  , Center(Scalar(0))
618  {
619  }
620 
622  VTKM_EXEC_CONT explicit Sphere(Scalar radius)
623  : Radius(radius)
624  , Center(Scalar(0))
625  {
626  }
627 
628  VTKM_EXEC_CONT Sphere(Vector center, Scalar radius)
629  : Radius(radius)
630  , Center(center)
631  {
632  }
633 
634  VTKM_CONT void SetRadius(Scalar radius) { this->Radius = radius; }
635 
636  VTKM_CONT void SetCenter(const Vector& center) { this->Center = center; }
637 
638  VTKM_EXEC_CONT Scalar GetRadius() const { return this->Radius; }
639 
640  VTKM_EXEC_CONT const Vector& GetCenter() const { return this->Center; }
641 
642  VTKM_EXEC_CONT Scalar Value(const Vector& point) const
643  {
644  return vtkm::MagnitudeSquared(point - this->Center) - (this->Radius * this->Radius);
645  }
646 
647  VTKM_EXEC_CONT Vector Gradient(const Vector& point) const
648  {
649  return Scalar(2) * (point - this->Center);
650  }
651 
652 private:
653  Scalar Radius;
654  Vector Center;
655 };
656 
657 namespace detail
658 {
659 
661 {
662  template <typename ImplicitFunctionType>
663  VTKM_EXEC_CONT typename ImplicitFunctionType::Scalar operator()(
664  const ImplicitFunctionType& function,
665  const typename ImplicitFunctionType::Vector& point) const
666  {
667  return function.Value(point);
668  }
669 };
670 
671 struct ImplicitFunctionGradientFunctor
672 {
673  template <typename ImplicitFunctionType>
674  VTKM_EXEC_CONT typename ImplicitFunctionType::Vector operator()(
675  const ImplicitFunctionType& function,
676  const typename ImplicitFunctionType::Vector& point) const
677  {
678  return function.Gradient(point);
679  }
680 };
681 
682 } // namespace detail
683 
684 //============================================================================
701 template <typename... ImplicitFunctionTypes>
703  : public vtkm::internal::ImplicitFunctionBase<
704  ImplicitFunctionMultiplexer<ImplicitFunctionTypes...>>
705 {
706  vtkm::exec::Variant<ImplicitFunctionTypes...> Variant;
707 
708  using Superclass =
709  vtkm::internal::ImplicitFunctionBase<ImplicitFunctionMultiplexer<ImplicitFunctionTypes...>>;
710 
711 public:
712  using Scalar = typename Superclass::Scalar;
713  using Vector = typename Superclass::Vector;
714 
715  ImplicitFunctionMultiplexer() = default;
716 
717  template <typename FunctionType>
719  const vtkm::internal::ImplicitFunctionBase<FunctionType>& function)
720  : Variant(reinterpret_cast<const FunctionType&>(function))
721  {
722  }
723 
724  VTKM_EXEC_CONT Scalar Value(const Vector& point) const
725  {
726  return this->Variant.CastAndCall(detail::ImplicitFunctionValueFunctor{}, point);
727  }
728 
729  VTKM_EXEC_CONT Vector Gradient(const Vector& point) const
730  {
731  return this->Variant.CastAndCall(detail::ImplicitFunctionGradientFunctor{}, point);
732  }
733 };
734 
735 //============================================================================
750  : public vtkm::ImplicitFunctionMultiplexer<vtkm::Box,
751  vtkm::Cylinder,
752  vtkm::Frustum,
753  vtkm::Plane,
754  vtkm::Sphere>
755 {
759  vtkm::Plane,
761 
762 public:
764 };
765 
766 } // namespace vtkm
767 
768 #endif //vtk_m_ImplicitFunction_h
vtkm::Sphere::GetCenter
const VTKM_EXEC_CONT Vector & GetCenter() const
Definition: ImplicitFunction.h:640
vtkm::Cylinder::SetAxis
VTKM_CONT void SetAxis(const Vector &axis)
Definition: ImplicitFunction.h:419
vtkm::Sphere::Sphere
VTKM_EXEC_CONT Sphere()
Construct sphere with center at (0,0,0) and radius = 0.5.
Definition: ImplicitFunction.h:615
vtkm::Sqrt
VTKM_EXEC_CONT vtkm::Float32 Sqrt(vtkm::Float32 x)
Compute the square root of x.
Definition: Math.h:958
vtkm::Cylinder::Cylinder
VTKM_EXEC_CONT Cylinder()
Construct cylinder radius of 0.5; centered at origin with axis along y coordinate axis.
Definition: ImplicitFunction.h:396
vtkm::ImplicitFunctionValueFunctor::Vector
typename FunctionType::Vector Vector
Definition: ImplicitFunction.h:75
vtkm::ImplicitFunctionMultiplexer::Value
VTKM_EXEC_CONT Scalar Value(const Vector &point) const
Definition: ImplicitFunction.h:724
vtkm::Sphere::Sphere
VTKM_EXEC_CONT Sphere(Scalar radius)
Construct a sphere with center at (0,0,0) and the given radius.
Definition: ImplicitFunction.h:622
vtkm::ImplicitFunctionGradientFunctor::ImplicitFunctionGradientFunctor
ImplicitFunctionGradientFunctor()=default
vtkm::MagnitudeSquared
VTKM_EXEC_CONT detail::FloatingPointReturnType< T >::Type MagnitudeSquared(const T &x)
Returns the square of the magnitude of a vector.
Definition: VectorAnalysis.h:64
vtkm::Frustum
Implicit function for a frustum.
Definition: ImplicitFunction.h:446
vtkm::ImplicitFunctionGeneral
Implicit function that can switch among known implicit function types.
Definition: ImplicitFunction.h:749
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
vtkm::Cylinder::Center
Vector Center
Definition: ImplicitFunction.h:439
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::ImplicitFunctionValueFunctor::ImplicitFunctionValueFunctor
ImplicitFunctionValueFunctor()=default
vtkm::ImplicitFunctionGradientFunctor::ImplicitFunctionGradientFunctor
VTKM_EXEC_CONT ImplicitFunctionGradientFunctor(const vtkm::internal::ImplicitFunctionBase< FunctionType > &function)
Definition: ImplicitFunction.h:112
vtkm::Normalize
VTKM_EXEC_CONT void Normalize(T &x)
Changes a vector to be normal.
Definition: VectorAnalysis.h:168
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::ImplicitFunctionMultiplexer
Implicit function that can switch among different types.
Definition: ImplicitFunction.h:702
vtkm::ImplicitFunctionGradientFunctor::Scalar
typename FunctionType::Scalar Scalar
Definition: ImplicitFunction.h:107
vtkm::Box::Box
VTKM_EXEC_CONT Box(const Vector &minPoint, const Vector &maxPoint)
Definition: ImplicitFunction.h:150
vtkm::Sphere::Radius
Scalar Radius
Definition: ImplicitFunction.h:653
vtkm::Cylinder::Axis
Vector Axis
Definition: ImplicitFunction.h:440
Variant.h
vtkm::ImplicitFunctionValueFunctor::ImplicitFunctionValueFunctor
VTKM_EXEC_CONT ImplicitFunctionValueFunctor(const FunctionType &function)
Definition: ImplicitFunction.h:85
vtkm::Box::GetMinPoint
const VTKM_EXEC_CONT Vector & GetMinPoint() const
Definition: ImplicitFunction.h:168
vtkm::ImplicitFunctionMultiplexer::Variant
vtkm::exec::Variant< ImplicitFunctionTypes... > Variant
Definition: ImplicitFunction.h:706
vtkm::Frustum::Value
VTKM_EXEC_CONT Scalar Value(const Vector &point) const
Definition: ImplicitFunction.h:515
vtkm::ImplicitFunctionGradientFunctor
A helpful functor that calls the gradient method of a given ImplicitFunction.
Definition: ImplicitFunction.h:104
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::Box::SetMinPoint
VTKM_CONT void SetMinPoint(const Vector &point)
Definition: ImplicitFunction.h:164
vtkm::ImplicitFunctionGradientFunctor::operator()
VTKM_EXEC_CONT Vector operator()(const Vector &point) const
Definition: ImplicitFunction.h:123
vtkm::cont::ExecutionAndControlObjectBase
Base ExecutionAndControlObjectBase class.
Definition: ExecutionAndControlObjectBase.h:28
vtkm::Normal
VTKM_EXEC_CONT T Normal(const T &x)
Returns a normalized version of the given vector.
Definition: VectorAnalysis.h:157
vtkm::Sphere::Value
VTKM_EXEC_CONT Scalar Value(const Vector &point) const
Definition: ImplicitFunction.h:642
VectorAnalysis.h
vtkm::Cylinder::SetCenter
VTKM_CONT void SetCenter(const Vector &center)
Definition: ImplicitFunction.h:417
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::Frustum::CreateFromPoints
VTKM_EXEC_CONT void CreateFromPoints(const Vector points[8])
Definition: ImplicitFunction.h:495
vtkm::ImplicitFunctionValueFunctor::operator()
VTKM_EXEC_CONT Scalar operator()(const Vector &point) const
Definition: ImplicitFunction.h:90
vtkm::Frustum::SetPlanes
VTKM_EXEC void SetPlanes(const Vector points[6], const Vector normals[6])
Definition: ImplicitFunction.h:459
vtkm::ImplicitFunctionMultiplexer< vtkm::Box, vtkm::Cylinder, vtkm::Frustum, vtkm::Plane, vtkm::Sphere >::Vector
typename Superclass::Vector Vector
Definition: ImplicitFunction.h:713
vtkm::Plane::Plane
VTKM_EXEC_CONT Plane(const Vector &normal)
Construct a plane through the origin with the given normal.
Definition: ImplicitFunction.h:571
Bounds.h
vtkm::ImplicitFunctionGradientFunctor::Function
FunctionType Function
Definition: ImplicitFunction.h:129
Math.h
vtkm::Sphere::Gradient
VTKM_EXEC_CONT Vector Gradient(const Vector &point) const
Definition: ImplicitFunction.h:647
vtkm::Frustum::GetNormals
const VTKM_EXEC_CONT Vector * GetNormals() const
Definition: ImplicitFunction.h:492
vtkm::Frustum::Frustum
VTKM_EXEC_CONT Frustum(const Vector points[8])
Definition: ImplicitFunction.h:457
vtkm::Plane::Plane
VTKM_EXEC_CONT Plane()
Construct plane passing through origin and normal to z-axis.
Definition: ImplicitFunction.h:564
vtkm::Box::Gradient
VTKM_EXEC_CONT Vector Gradient(const Vector &point) const
Definition: ImplicitFunction.h:253
vtkm::Cylinder::Cylinder
VTKM_EXEC_CONT Cylinder(const Vector &axis, Scalar radius)
Definition: ImplicitFunction.h:403
vtkm::Cylinder::Radius
Scalar Radius
Definition: ImplicitFunction.h:441
vtkm::Cylinder::SetRadius
VTKM_CONT void SetRadius(Scalar radius)
Definition: ImplicitFunction.h:421
ExecutionAndControlObjectBase.h
vtkm::ImplicitFunctionMultiplexer< vtkm::Box, vtkm::Cylinder, vtkm::Frustum, vtkm::Plane, vtkm::Sphere >::Scalar
typename Superclass::Scalar Scalar
Definition: ImplicitFunction.h:712
vtkm::Box::MinPoint
Vector MinPoint
Definition: ImplicitFunction.h:376
vtkm::Plane::Plane
VTKM_EXEC_CONT Plane(const Vector &origin, const Vector &normal)
Construct a plane through the given point with the given normal.
Definition: ImplicitFunction.h:578
vtkm::Cylinder::Gradient
VTKM_EXEC_CONT Vector Gradient(const Vector &point) const
Definition: ImplicitFunction.h:430
vtkm::Bounds::Z
vtkm::Range Z
Definition: Bounds.h:33
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Sphere::GetRadius
VTKM_EXEC_CONT Scalar GetRadius() const
Definition: ImplicitFunction.h:638
vtkm::Box::GetMaxPoint
const VTKM_EXEC_CONT Vector & GetMaxPoint() const
Definition: ImplicitFunction.h:170
vtkm::ImplicitFunctionMultiplexer< vtkm::Box, vtkm::Cylinder, vtkm::Frustum, vtkm::Plane, vtkm::Sphere >::Superclass
vtkm::internal::ImplicitFunctionBase< ImplicitFunctionMultiplexer< ImplicitFunctionTypes... > > Superclass
Definition: ImplicitFunction.h:709
vtkm::ImplicitFunctionValueFunctor::ImplicitFunctionValueFunctor
VTKM_EXEC_CONT ImplicitFunctionValueFunctor(const vtkm::internal::ImplicitFunctionBase< FunctionType > &function)
Definition: ImplicitFunction.h:79
vtkm::Bounds
Represent an axis-aligned 3D bounds in space.
Definition: Bounds.h:29
vtkm::Frustum::GetPoints
const VTKM_EXEC_CONT Vector * GetPoints() const
Definition: ImplicitFunction.h:490
vtkm::TriangleNormal
VTKM_EXEC_CONT vtkm::Vec< typename detail::FloatingPointReturnType< T >::Type, 3 > TriangleNormal(const vtkm::Vec< T, 3 > &a, const vtkm::Vec< T, 3 > &b, const vtkm::Vec< T, 3 > &c)
Find the normal of a triangle.
Definition: VectorAnalysis.h:200
vtkm::Frustum::Frustum
VTKM_EXEC_CONT Frustum(const Vector points[6], const Vector normals[6])
Definition: ImplicitFunction.h:452
vtkm::Box::Box
VTKM_EXEC_CONT Box(Scalar xmin, Scalar xmax, Scalar ymin, Scalar ymax, Scalar zmin, Scalar zmax)
Definition: ImplicitFunction.h:156
vtkm::Frustum::Gradient
VTKM_EXEC_CONT Vector Gradient(const Vector &point) const
Definition: ImplicitFunction.h:528
vtkm::cont::DeviceAdapterId
Definition: DeviceAdapterTag.h:52
vtkm::Box::GetBounds
VTKM_EXEC_CONT vtkm::Bounds GetBounds() const
Definition: ImplicitFunction.h:178
vtkm::Sphere
Represent a sphere of the given Dimension.
Definition: Geometry.h:27
vtkm::Vec
A short fixed-length array.
Definition: Types.h:767
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::Frustum::SetPlane
VTKM_EXEC void SetPlane(int idx, const Vector &point, const Vector &normal)
Definition: ImplicitFunction.h:471
vtkm::ImplicitFunctionMultiplexer::Gradient
VTKM_EXEC_CONT Vector Gradient(const Vector &point) const
Definition: ImplicitFunction.h:729
vtkm::Cylinder::Value
VTKM_EXEC_CONT Scalar Value(const Vector &point) const
Definition: ImplicitFunction.h:423
vtkm::Range::Min
vtkm::Float64 Min
Definition: Range.h:33
vtkm::Box::SetBounds
VTKM_CONT void SetBounds(const vtkm::Bounds &bounds)
Definition: ImplicitFunction.h:172
vtkm::Cylinder::Cylinder
VTKM_EXEC_CONT Cylinder(const Vector &center, const Vector &axis, Scalar radius)
Definition: ImplicitFunction.h:410
vtkm::Plane::GetOrigin
const VTKM_EXEC_CONT Vector & GetOrigin() const
Definition: ImplicitFunction.h:588
vtkm::ImplicitFunctionValueFunctor
A helpful functor that calls the value method of a given ImplicitFunction.
Definition: ImplicitFunction.h:71
vtkm::Plane::GetNormal
const VTKM_EXEC_CONT Vector & GetNormal() const
Definition: ImplicitFunction.h:589
vtkm::Box
Implicit function for a box.
Definition: ImplicitFunction.h:140
vtkm::ImplicitFunctionMultiplexer::ImplicitFunctionMultiplexer
ImplicitFunctionMultiplexer()=default
vtkm::ImplicitFunctionValueFunctor::Scalar
typename FunctionType::Scalar Scalar
Definition: ImplicitFunction.h:74
vtkm::Bounds::X
vtkm::Range X
Definition: Bounds.h:31
vtkm::Box::Box
VTKM_EXEC_CONT Box()
Construct box with center at (0,0,0) and each side of length 1.0.
Definition: ImplicitFunction.h:144
vtkm::Bounds::Y
vtkm::Range Y
Definition: Bounds.h:32
vtkm::Plane::Gradient
VTKM_EXEC_CONT Vector Gradient(const Vector &) const
Definition: ImplicitFunction.h:596
vtkm::Range::Max
vtkm::Float64 Max
Definition: Range.h:34
vtkm::Box::MaxPoint
Vector MaxPoint
Definition: ImplicitFunction.h:377
vtkm::Box::Value
VTKM_EXEC_CONT Scalar Value(const Vector &point) const
Definition: ImplicitFunction.h:185
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:92
vtkm::ImplicitFunctionGradientFunctor::Vector
typename FunctionType::Vector Vector
Definition: ImplicitFunction.h:108
vtkm::Box::Box
VTKM_CONT Box(const vtkm::Bounds &bounds)
Definition: ImplicitFunction.h:162
vtkm::Plane
Represent a plane with a base point (origin) and normal vector.
Definition: Geometry.h:25
vtkm::Box::SetMaxPoint
VTKM_CONT void SetMaxPoint(const Vector &point)
Definition: ImplicitFunction.h:166
vtkm::Plane::SetOrigin
VTKM_CONT void SetOrigin(const Vector &origin)
Definition: ImplicitFunction.h:584
vtkm::Sphere::Sphere
VTKM_EXEC_CONT Sphere(Vector center, Scalar radius)
Definition: ImplicitFunction.h:628
vtkm::Sphere::SetRadius
VTKM_CONT void SetRadius(Scalar radius)
Definition: ImplicitFunction.h:634
vtkm::ImplicitFunctionValueFunctor::Function
FunctionType Function
Definition: ImplicitFunction.h:96
vtkm::Plane::Value
VTKM_EXEC_CONT Scalar Value(const Vector &point) const
Definition: ImplicitFunction.h:591
vtkm::Frustum::GetPlanes
VTKM_EXEC_CONT void GetPlanes(Vector points[6], Vector normals[6]) const
Definition: ImplicitFunction.h:478
vtkm::ImplicitFunctionMultiplexer::ImplicitFunctionMultiplexer
VTKM_EXEC_CONT ImplicitFunctionMultiplexer(const vtkm::internal::ImplicitFunctionBase< FunctionType > &function)
Definition: ImplicitFunction.h:718
vtkm::Sphere::SetCenter
VTKM_CONT void SetCenter(const Vector &center)
Definition: ImplicitFunction.h:636
vtkm::Plane::SetNormal
VTKM_CONT void SetNormal(const Vector &normal)
Definition: ImplicitFunction.h:586
vtkm::ImplicitFunctionGradientFunctor::ImplicitFunctionGradientFunctor
VTKM_EXEC_CONT ImplicitFunctionGradientFunctor(const FunctionType &function)
Definition: ImplicitFunction.h:118
vtkm::Cylinder
Implicit function for a cylinder.
Definition: ImplicitFunction.h:391
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31