SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
DistanceTo.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_DistanceTo_h
12 #define smtk_geometry_DistanceTo_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 #include <utility>
22 
23 namespace smtk
24 {
25 namespace geometry
26 {
27 
34 struct SMTKCORE_EXPORT DistanceTo
35  : public smtk::resource::query::DerivedFrom<DistanceTo, smtk::resource::query::Query>
36 {
37  virtual std::pair<double, std::array<double, 3>> operator()(
38  const smtk::resource::Component::Ptr&,
39  const std::array<double, 3>&) const = 0;
40 };
41 
42 inline std::pair<double, std::array<double, 3>> DistanceTo::operator()(
43  const smtk::resource::Component::Ptr&,
44  const std::array<double, 3>&) const
45 {
46  static constexpr const double nan = std::numeric_limits<double>::quiet_NaN();
47  return std::make_pair(nan, std::array<double, 3>({ nan, nan, nan }));
48 }
49 } // namespace geometry
50 } // namespace smtk
51 
52 #endif
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::geometry::DistanceTo
An API for computing the shortest distance between an input point and a geometric resource component.
Definition: DistanceTo.h:34
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