opensurgsim
PointGenerator.h
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 
58  void seed(unsigned int val) { m_generator.seed(val); }
59 
60 protected:
63  std::mt19937 m_generator;
64 
65  std::uniform_real_distribution<double> m_openOneOneDistribution; // <-- (-1.0, 1.0)
66  std::uniform_real_distribution<double> m_closedOneOneDistribution; // <-- [-1.0, 1.0]
67  std::uniform_real_distribution<double> m_closedZeroOneDistribution; // <-- [0.0, 1.0]
68  std::uniform_real_distribution<double> m_closedZeroOpenOneDistribution; // <-- [0.0, 1.0)
70 };
71 
72 }; // namespace Particles
73 }; // namespace SurgSim
74 
75 #endif // SURGSIM_PARTICLES_POINTGENERATOR_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
void seed(unsigned int val)
Set the seed to the given value.
Definition: PointGenerator.h:58
PointGenerator is used to generate points inside or on the surface of a given shape.
Definition: PointGenerator.h:37
Definitions of small fixed-size vector types.
std::mt19937 m_generator
Definition: PointGenerator.h:63