ParticlesShape.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_MATH_PARTICLESSHAPE_H
17 #define SURGSIM_MATH_PARTICLESSHAPE_H
18 
19 #include <memory>
20 
24 #include "SurgSim/Math/Matrix.h"
25 #include "SurgSim/Math/Shape.h"
26 #include "SurgSim/Math/Vector.h"
27 
28 namespace SurgSim
29 {
30 namespace DataStructures
31 {
32 class AabbTree;
33 };
34 
35 namespace Math
36 {
37 
38 SURGSIM_STATIC_REGISTRATION(ParticlesShape);
39 
41 class ParticlesShape : public Shape, public SurgSim::DataStructures::Vertices<DataStructures::EmptyData>
42 {
43 public:
46  explicit ParticlesShape(double radius = 0.0);
47 
50  explicit ParticlesShape(const ParticlesShape& other);
51 
55  template <class V>
57 
61  template <class V>
62  ParticlesShape& operator=(const Vertices<V>& other);
63 
65 
68  const std::shared_ptr<const SurgSim::DataStructures::AabbTree> getAabbTree() const;
69 
72  void setRadius(double radius);
73 
76  double getRadius() const;
77 
78  int getType() const override;
79 
80  double getVolume() const override;
81 
82  Vector3d getCenter() const override;
83 
84  Matrix33d getSecondMomentOfVolume() const override;
85 
86  std::shared_ptr<Shape> getTransformed(const RigidTransform3d& pose) const override;
87 
88  bool isValid() const override;
89 
90  bool isTransformable() const override;
91 
92  const Math::Aabbd& getBoundingBox() const override;
93 
94 private:
95  bool doUpdate() override;
96 
98  std::shared_ptr<SurgSim::DataStructures::AabbTree> m_aabbTree;
99 
101  double m_radius;
102 
105 
107  double m_volume;
108 
111 };
112 
113 };
114 };
115 
117 
118 #endif // SURGSIM_MATH_PARTICLESSHAPE_H
double m_radius
Particles&#39; radius.
Definition: ParticlesShape.h:101
Definition: CompoundShapeToGraphics.cpp:29
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:68
double m_volume
Total volume of particles.
Definition: ParticlesShape.h:107
Matrix33d m_secondMomentOfVolume
Second moment of volume.
Definition: ParticlesShape.h:110
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
bool isValid(float value)
Check if a float value is valid.
Definition: Valid-inl.h:98
Eigen::AlignedBox< double, 3 > Aabbd
Wrapper around the Eigen type.
Definition: Aabb.h:30
Definitions of small fixed-size square matrix types.
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Definitions of small fixed-size vector types.
Vector3d m_center
Volumetric center of particles.
Definition: ParticlesShape.h:104
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:69
std::shared_ptr< SurgSim::DataStructures::AabbTree > m_aabbTree
The aabb tree of the ParticlesShape.
Definition: ParticlesShape.h:98
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:51
Particles Shape: A shape consisting of a group of particles of equal radius.
Definition: ParticlesShape.h:41
Generic rigid shape class defining a shape.
Definition: Shape.h:65