PointGenerator.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_PARTICLES_POINTGENERATOR_H
17 #define SURGSIM_PARTICLES_POINTGENERATOR_H
18 
19 #include <memory>
20 #include <random>
21 
22 #include "SurgSim/Math/Vector.h"
23 
24 namespace SurgSim
25 {
26 
27 namespace Math
28 {
29 class Shape;
30 }
31 
32 namespace Particles
33 {
34 
38 {
39 public:
42 
44  virtual ~PointGenerator();
45 
49  virtual SurgSim::Math::Vector3d pointInShape(std::shared_ptr<SurgSim::Math::Shape> shape) = 0;
50 
54  virtual SurgSim::Math::Vector3d pointOnShape(std::shared_ptr<SurgSim::Math::Shape> shape) = 0;
55 
56 protected:
59  std::mt19937 m_generator;
60 
61  std::uniform_real_distribution<double> m_openOneOneDistribution; // <-- (-1.0, 1.0)
62  std::uniform_real_distribution<double> m_closedOneOneDistribution; // <-- [-1.0, 1.0]
63  std::uniform_real_distribution<double> m_closedZeroOneDistribution; // <-- [0.0, 1.0]
64  std::uniform_real_distribution<double> m_closedZeroOpenOneDistribution; // <-- [0.0, 1.0)
66 };
67 
68 }; // namespace Particles
69 }; // namespace SurgSim
70 
71 #endif // SURGSIM_PARTICLES_POINTGENERATOR_H
SurgSim::Particles::PointGenerator::pointInShape
virtual SurgSim::Math::Vector3d pointInShape(std::shared_ptr< SurgSim::Math::Shape > shape)=0
Generates one point inside the given shape.
Vector.h
Definitions of small fixed-size vector types.
SurgSim::Particles::PointGenerator::m_closedZeroOneDistribution
std::uniform_real_distribution< double > m_closedZeroOneDistribution
Definition: PointGenerator.h:63
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Particles::PointGenerator::~PointGenerator
virtual ~PointGenerator()
Destructor.
Definition: PointGenerator.cpp:35
SurgSim::Particles::PointGenerator::m_closedZeroOpenOneDistribution
std::uniform_real_distribution< double > m_closedZeroOpenOneDistribution
Definition: PointGenerator.h:64
SurgSim::Particles::PointGenerator::m_openOneOneDistribution
std::uniform_real_distribution< double > m_openOneOneDistribution
Definition: PointGenerator.h:61
SurgSim::Particles::PointGenerator::m_generator
std::mt19937 m_generator
Definition: PointGenerator.h:59
SurgSim::Particles::PointGenerator::m_closedOneOneDistribution
std::uniform_real_distribution< double > m_closedOneOneDistribution
Definition: PointGenerator.h:62
SurgSim::Particles::PointGenerator
PointGenerator is used to generate points inside or on the surface of a given shape.
Definition: PointGenerator.h:38
SurgSim::Particles::PointGenerator::pointOnShape
virtual SurgSim::Math::Vector3d pointOnShape(std::shared_ptr< SurgSim::Math::Shape > shape)=0
Generates one point on the surface of the given shape.
SurgSim::Particles::PointGenerator::PointGenerator
PointGenerator()
Constructor.
Definition: PointGenerator.cpp:25
SurgSim::Particles::Particles
DataStructures::Vertices< ParticleData > Particles
Definition: Particles.h:53