VTK-m  2.0
ShapeIntersector.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_rendering_raytracing_Shape_Intersector_h
11 #define vtk_m_rendering_raytracing_Shape_Intersector_h
12 
16 
17 namespace vtkm
18 {
19 namespace rendering
20 {
21 namespace raytracing
22 {
23 
24 class VTKM_RENDERING_EXPORT ShapeIntersector
25 {
26 protected:
30  void SetAABBs(AABBs& aabbs);
31 
32 public:
34  virtual ~ShapeIntersector();
35 
36  //
37  // Intersect Rays finds the nearest intersection shape contained in the derived
38  // class in between min and max distances. HitIdx will be set to the local
39  // primitive id unless returnCellIndex is set to true. Cells are often
40  // decomposed into triangles and setting returnCellIndex to true will set
41  // HitIdx to the id of the cell.
42  //
43  virtual void IntersectRays(Ray<vtkm::Float32>& rays, bool returnCellIndex = false) = 0;
44 
45 
46  virtual void IntersectRays(Ray<vtkm::Float64>& rays, bool returnCellIndex = false) = 0;
47 
48  //
49  // Calling intersection data directly after IntersectRays popoulates
50  // ray data: intersection point, surface normal, and interpolated scalar
51  // value at the intersection location. Additionally, distance to intersection
52  // becomes the new max distance.
53  //
54  virtual void IntersectionData(Ray<vtkm::Float32>& rays,
55  const vtkm::cont::Field scalarField,
56  const vtkm::Range& scalarRange = vtkm::Range()) = 0;
57 
58  virtual void IntersectionData(Ray<vtkm::Float64>& rays,
59  const vtkm::cont::Field scalarField,
60  const vtkm::Range& scalarRange = vtkm::Range()) = 0;
61 
62 
63  template <typename Precision>
64  void IntersectionPointImp(Ray<Precision>& rays);
65  void IntersectionPoint(Ray<vtkm::Float32>& rays);
66  void IntersectionPoint(Ray<vtkm::Float64>& rays);
67 
68  vtkm::Bounds GetShapeBounds() const;
69  virtual vtkm::Id GetNumberOfShapes() const = 0;
70 }; // class ShapeIntersector
71 }
72 }
73 } //namespace vtkm::rendering::raytracing
74 #endif //vtk_m_rendering_raytracing_Shape_Intersector_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::rendering::raytracing::ShapeIntersector::CoordsHandle
vtkm::cont::CoordinateSystem CoordsHandle
Definition: ShapeIntersector.h:28
vtkm::rendering::raytracing::AABBs
Definition: BoundingVolumeHierarchy.h:24
CoordinateSystem.h
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::cont::CoordinateSystem
Definition: CoordinateSystem.h:25
vtkm::rendering::raytracing::Ray
Definition: Ray.h:37
vtkm::rendering::raytracing::ShapeIntersector::ShapeBounds
vtkm::Bounds ShapeBounds
Definition: ShapeIntersector.h:29
vtkm::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: cont/Field.h:31
vtkm::Bounds
Represent an axis-aligned 3D bounds in space.
Definition: Bounds.h:29
vtkm::rendering::raytracing::ShapeIntersector::BVH
LinearBVH BVH
Definition: ShapeIntersector.h:27
vtkm::rendering::raytracing::ShapeIntersector
Definition: ShapeIntersector.h:24
Ray.h
vtkm::rendering::raytracing::LinearBVH
Definition: BoundingVolumeHierarchy.h:37
BoundingVolumeHierarchy.h
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31