Chemical Data Processing Library C++ API - Version 1.1.1
GaussianShape.hpp
Go to the documentation of this file.
1 /*
2  * GaussianShape.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_SHAPE_GAUSSIANSHAPE_HPP
30 #define CDPL_SHAPE_GAUSSIANSHAPE_HPP
31 
32 #include <cstddef>
33 #include <vector>
34 #include <memory>
35 
36 #include "CDPL/Shape/APIPrefix.hpp"
38 #include "CDPL/Math/Vector.hpp"
39 
40 
41 namespace CDPL
42 {
43 
44  namespace Shape
45  {
46 
51  {
52 
53  public:
54  class Element
55  {
56 
57  public:
58  Element(const Math::Vector3D& pos, double radius, std::size_t color = 0, double hardness = 2.7):
59  position(pos), radius(radius), hardness(hardness), color(color) {}
60 
61  const Math::Vector3D& getPosition() const
62  {
63  return position;
64  }
65 
66  void setPosition(const Math::Vector3D& pos)
67  {
68  position = pos;
69  }
70 
71  double getRadius() const
72  {
73  return radius;
74  }
75 
76  void setRadius(double radius)
77  {
78  this->radius = radius;
79  }
80 
81  std::size_t getColor() const
82  {
83  return color;
84  }
85 
86  void setColor(std::size_t color)
87  {
88  this->color = color;
89  }
90 
91  double getHardness() const
92  {
93  return hardness;
94  }
95 
96  void setHardness(double hardness)
97  {
98  this->hardness = hardness;
99  }
100 
101  private:
102  Math::Vector3D position;
103  double radius;
104  double hardness;
105  std::size_t color;
106  };
107 
108  private:
109  typedef std::vector<Element> ElementList;
110 
111  public:
112  typedef std::shared_ptr<GaussianShape> SharedPointer;
113 
114  typedef ElementList::const_iterator ConstElementIterator;
115  typedef ElementList::iterator ElementIterator;
116 
117  void clear();
118 
119  std::size_t getNumElements() const;
120 
121  void addElement(const Math::Vector3D& pos, double radius, std::size_t color = 0, double hardness = 2.7);
122 
123  void addElement(const Element& elem);
124 
125  void removeElement(std::size_t idx);
126 
127  const Element& getElement(std::size_t idx) const;
128 
129  Element& getElement(std::size_t idx);
130 
132 
134 
136 
138 
140 
142 
144 
146 
147  private:
148  ElementList elements;
149  };
150  } // namespace Shape
151 } // namespace CDPL
152 
153 #endif // CDPL_SHAPE_GAUSSIANSHAPE_HPP
CDPL::Shape::GaussianShape::Element
Definition: GaussianShape.hpp:55
CDPL::Shape::GaussianShape::addElement
void addElement(const Math::Vector3D &pos, double radius, std::size_t color=0, double hardness=2.7)
CDPL::Shape::GaussianShape::getNumElements
std::size_t getNumElements() const
CDPL::Shape::GaussianShape::getElementsEnd
ElementIterator getElementsEnd()
CDPL::Shape::GaussianShape::begin
ConstElementIterator begin() const
CDPL::Shape::GaussianShape::getElement
Element & getElement(std::size_t idx)
CDPL::Math::Vector3D
CVector< double, 3 > Vector3D
A bounded 3 element vector holding floating point values of type double.
Definition: Vector.hpp:1637
CDPL::Shape::GaussianShape::Element::setRadius
void setRadius(double radius)
Definition: GaussianShape.hpp:76
CDPL::Shape::GaussianShape::Element::setColor
void setColor(std::size_t color)
Definition: GaussianShape.hpp:86
CDPL::Shape::GaussianShape::Element::setPosition
void setPosition(const Math::Vector3D &pos)
Definition: GaussianShape.hpp:66
CDPL::Shape::GaussianShape::getElement
const Element & getElement(std::size_t idx) const
CDPL::Shape::GaussianShape::Element::getRadius
double getRadius() const
Definition: GaussianShape.hpp:71
CDPL::Shape::GaussianShape::SharedPointer
std::shared_ptr< GaussianShape > SharedPointer
Definition: GaussianShape.hpp:112
CDPL::Shape::GaussianShape
A data type for the descripton of arbitrary shapes composed of spheres approximated by gaussian funct...
Definition: GaussianShape.hpp:51
CDPL::Shape::GaussianShape::end
ConstElementIterator end() const
CDPL::Shape::GaussianShape::getElementsEnd
ConstElementIterator getElementsEnd() const
CDPL::Shape::GaussianShape::removeElement
void removeElement(std::size_t idx)
CDPL::Shape::GaussianShape::clear
void clear()
CDPL::Shape::GaussianShape::Element::getHardness
double getHardness() const
Definition: GaussianShape.hpp:91
CDPL::Shape::GaussianShape::ElementIterator
ElementList::iterator ElementIterator
Definition: GaussianShape.hpp:115
CDPL::Shape::GaussianShape::begin
ElementIterator begin()
CDPL_SHAPE_API
#define CDPL_SHAPE_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Shape::GaussianShape::addElement
void addElement(const Element &elem)
CDPL::Base::PropertyContainer
A class providing methods for the storage and lookup of object properties.
Definition: PropertyContainer.hpp:75
CDPL
The namespace of the Chemical Data Processing Library.
APIPrefix.hpp
Definition of the preprocessor macro CDPL_SHAPE_API.
CDPL::Shape::GaussianShape::Element::getPosition
const Math::Vector3D & getPosition() const
Definition: GaussianShape.hpp:61
CDPL::Shape::GaussianShape::ConstElementIterator
ElementList::const_iterator ConstElementIterator
Definition: GaussianShape.hpp:114
CDPL::Shape::GaussianShape::end
ElementIterator end()
CDPL::Shape::GaussianShape::Element::getColor
std::size_t getColor() const
Definition: GaussianShape.hpp:81
CDPL::Shape::GaussianShape::Element::Element
Element(const Math::Vector3D &pos, double radius, std::size_t color=0, double hardness=2.7)
Definition: GaussianShape.hpp:58
CDPL::Shape::GaussianShape::Element::setHardness
void setHardness(double hardness)
Definition: GaussianShape.hpp:96
CDPL::Shape::GaussianShape::getElementsBegin
ConstElementIterator getElementsBegin() const
PropertyContainer.hpp
Definition of the class CDPL::Base::PropertyContainer.
CDPL::Shape::GaussianShape::getElementsBegin
ElementIterator getElementsBegin()
Vector.hpp
Definition of vector data types.