Free Electron
PointPlaneNearest.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __geometry_PointPlaneNearest_h__
8 #define __geometry_PointPlaneNearest_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Find point nearest to a circular solid
17 
18  @ingroup solve
19 *//***************************************************************************/
20 template <typename T>
22 {
23  public:
24 static T solve(const Vector<3,T>& center,const Vector<3,T>& facing,
25  const T radius,const Vector<3,T>& origin,
26  Vector<3,T>& direction);
27 };
28 
29 template <typename T>
30 inline T PointPlaneNearest<T>::solve(const Vector<3,T>& center,
31  const Vector<3,T>& facing,T radius,
32  const Vector<3,T>& origin,Vector<3,T>& direction)
33 {
34  const Vector<3,T> to_origin=origin-center;
35  const T displacement=dot(facing,to_origin);
36  direction= -facing;
37  return displacement;
38 }
39 
40 } /* namespace ext */
41 } /* namespace fe */
42 
43 #endif /* __geometry_PointPlaneNearest_h__ */
44 
45 
46 
kernel
Definition: namespace.dox:3
Find point nearest to a circular solid.
Definition: PointPlaneNearest.h:21