SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
RandomPoint.h
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 
11 #ifndef smtk_geometry_RandomPoint_h
12 #define smtk_geometry_RandomPoint_h
13 
14 #include "smtk/CoreExports.h"
15 
16 #include "smtk/resource/Component.h"
17 #include "smtk/resource/query/DerivedFrom.h"
18 #include "smtk/resource/query/Query.h"
19 
20 #include <array>
21 
22 namespace smtk
23 {
24 namespace geometry
25 {
26 
29 struct SMTKCORE_EXPORT RandomPoint
30  : public smtk::resource::query::DerivedFrom<RandomPoint, smtk::resource::query::Query>
31 {
32  virtual std::array<double, 3> operator()(const smtk::resource::Component::Ptr&) const = 0;
33 
34  virtual void seed(std::size_t) {}
35 };
36 
37 inline std::array<double, 3> RandomPoint::operator()(const smtk::resource::Component::Ptr&) const
38 {
39  static constexpr const double nan = std::numeric_limits<double>::quiet_NaN();
40  return { { nan, nan, nan } };
41 }
42 } // namespace geometry
43 } // namespace smtk
44 
45 #endif
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::geometry::RandomPoint
An API for computing a random point on a geometric resource component.
Definition: RandomPoint.h:29
smtk::resource::query::DerivedFrom
Query functors can be registered to Resources as the implementation of a base (and often abstract) Qu...
Definition: DerivedFrom.h:34