SurfaceForce.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_SurfaceForce_H
21 #define MIRTK_SurfaceForce_H
22 
23 #include "mirtk/ExternalForce.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Base class for external surface force terms
31  *
32  * Subclasses implement in particular external forces for deformable surface
33  * models such as inflation/balloon forces and intensity edge forces. In case
34  * of a tetrahedral mesh, these forces only apply to the corresponding
35  * triangular surface of the simplicial complex boundary.
36  */
38 {
39  mirtkAbstractMacro(SurfaceForce);
40 
41  // ---------------------------------------------------------------------------
42  // Construction/Destruction
43 protected:
44 
45  /// Constructor
46  SurfaceForce(const char * = "", double = 1.0);
47 
48  /// Copy constructor
49  SurfaceForce(const SurfaceForce &);
50 
51  /// Assignment operator
53 
54  /// Copy attributes of this class from another instance
55  void CopyAttributes(const SurfaceForce &);
56 
57 public:
58 
59  /// Destructor
60  virtual ~SurfaceForce();
61 
62  /// Get distance to closest intersection with specified ray
63  ///
64  /// \param[in] p Ray starting point.
65  /// \param[in] e Ray direction.
66  /// \param[in] l Length of ray. When negative, a ray of length abs(l) is
67  /// cast in the direction opposite to \p e.
68  ///
69  /// \attention This function is not thread-safe because the VTK cell locator
70  /// used by this function is not thread-safe.
71  ///
72  /// \returns Distance to closest intersection with specified ray,
73  /// clamped to maximum distance equal to length of ray \p l.
74  double IntersectWithRay(const double p[3], const double e[3], double l = .0) const;
75 
76  /// Get self-distance value at given world position along specified direction
77  ///
78  /// \param[in] p Node position.
79  /// \param[in] n Node normal.
80  /// \param[in] maxd Maximum distance, length of rays cast in opposite directions.
81  ///
82  /// \attention This function is not thread-safe because the VTK cell locator
83  /// used by this function is not thread-safe.
84  ///
85  /// \returns Distance to closest self-intersection along normal direction
86  /// (two rays cast in opposing directions), clamped to maximum
87  /// distance equal to length of rays \p l.
88  double SelfDistance(const double p[3], const double n[3], double maxd = .0) const;
89 
90 };
91 
92 
93 } // namespace mirtk
94 
95 #endif // MIRTK_SurfaceForce_H
double IntersectWithRay(const double p[3], const double e[3], double l=.0) const
void CopyAttributes(const SurfaceForce &)
Copy attributes of this class from another instance.
double SelfDistance(const double p[3], const double n[3], double maxd=.0) const
SurfaceForce & operator=(const SurfaceForce &)
Assignment operator.
SurfaceForce(const char *="", double=1.0)
Constructor.
Definition: IOConfig.h:41
virtual ~SurfaceForce()
Destructor.