stator
A math, geometry, and utility library
plane.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 Marcus N Campbell Bannerman <[email protected]>
3 
4  This file is part of stator.
5 
6  stator is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  stator is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with stator. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 // stator
23 #include "stator/constants.hpp"
24 
25 namespace stator {
26  namespace geometry {
40  template<typename Scalar, size_t D>
41  class HalfSpace {
42  public:
44  center_(center), normal_(normal)
45  {}
46 
47  const Vector<Scalar, D>& center() const { return center_; }
48  const Vector<Scalar, D>& normal() const { return normal_; }
49 
50  protected:
53  };
54 
62  template<typename Scalar, size_t D>
63  class Plane {
64  public:
65  Plane(const Vector<Scalar, D>& center, const Vector<Scalar, D>& normal, const Scalar thickness = Scalar(0)):
66  center_(center), normal_(normal), thickness_(thickness)
67  {}
68 
69  const Vector<Scalar, D>& center() const { return center_; }
70  const Vector<Scalar, D>& normal() const { return normal_; }
71  const Vector<Scalar, D>& thickness() const { return thickness_; }
72 
73  protected:
76  Scalar thickness_;
77  };
78 
79 
80  }// namespace geometry
81 }// namespace stator
const Vector< Scalar, D > & center() const
Definition: plane.hpp:47
HalfSpace(const Vector< Scalar, D > &center, const Vector< Scalar, D > &normal)
Definition: plane.hpp:43
A planar half-space (a plane and the volume on one side of the plane).
Definition: plane.hpp:41
Plane(const Vector< Scalar, D > &center, const Vector< Scalar, D > &normal, const Scalar thickness=Scalar(0))
Definition: plane.hpp:65
Vector< Scalar, D > center_
Definition: plane.hpp:51
const Vector< Scalar, D > & center() const
Definition: plane.hpp:69
const Vector< Scalar, D > & thickness() const
Definition: plane.hpp:71
An infinite flat surface of fixed thickness.
Definition: plane.hpp:63
const Vector< Scalar, D > & normal() const
Definition: plane.hpp:70
Vector< Scalar, D > center_
Definition: plane.hpp:74
const Vector< Scalar, D > & normal() const
Definition: plane.hpp:48
The stator library namespace.
Definition: frontpage.dox:243
Vector< Scalar, D > normal_
Definition: plane.hpp:75
Vector< Scalar, D > normal_
Definition: plane.hpp:52
Matrix< Scalar, D, 1 > Vector
A convenience typedef for a non-aligned Eigen Vector.
Definition: config.hpp:58