Helios++
Helios software for LiDAR simulations
PyPrimitiveWrapper.h
1 #pragma once
2 
3 #ifdef PYTHON_BINDING
4 
5 #include <PyScenePartWrapper.h>
6 #include <PyAABBWrapper.h>
7 #include <PythonDVec3.h>
8 #include <PyDoubleVector.h>
9 #include <PyVertexWrapper.h>
10 
19 public:
20  // *** ATTRIBUTE *** //
21  // ******************* //
22  Primitive *prim = nullptr;
23 
24  // *** CONSTRUCTION / DESTRUCTION *** //
25  // ************************************ //
26  PyPrimitiveWrapper(Primitive *prim) : prim(prim) {}
27  virtual ~PyPrimitiveWrapper() = default;
28 
29  // *** GETTERS and SETTERS *** //
30  // ***************************** //
31  PyScenePartWrapper * getScenePart()
32  {return new PyScenePartWrapper(*prim->part);}
33  Material & getMaterial()
34  {return *prim->material;}
35  PyAABBWrapper * getAABB() {return new PyAABBWrapper(prim->getAABB());}
36  PythonDVec3 * getCentroid() {return new PythonDVec3(prim->getCentroid());}
37  double getIncidenceAngle(
38  double ox, double oy, double oz,
39  double dx, double dy, double dz,
40  double px, double py, double pz
41  ){
42  glm::dvec3 origin(ox, oy, oz);
43  glm::dvec3 direction(dx, dy, dz);
44  glm::dvec3 intersectionPoint(px, py, pz);
45  return prim->getIncidenceAngle_rad(
46  origin,
47  direction,
48  intersectionPoint
49  );
50  }
51  PyDoubleVector * getRayIntersection(
52  double ox, double oy, double oz,
53  double dx, double dy, double dz
54  ){
55  glm::dvec3 origin(ox, oy, oz);
56  glm::dvec3 direction(dx, dy, dz);
57  return new PyDoubleVector(prim->getRayIntersection(origin, direction));
58  }
59  double getRayIntersectionDistance(
60  double ox, double oy, double oz,
61  double dx, double dy, double dz
62  ){
63  glm::dvec3 origin(ox, oy, oz);
64  glm::dvec3 direction(dx, dy, dz);
65  return prim->getRayIntersectionDistance(origin, direction);
66  }
67  size_t getNumVertices(){return prim->getNumVertices();}
68  PyVertexWrapper * getVertex(size_t index)
69  {return new PyVertexWrapper(prim->getVertices()+index);}
70  void update(){prim->update();}
71 
72 
73 };
74 
75 #endif
Wrapper for Vertex class.
Definition: PyVertexWrapper.h:15
Wrapper for AABB class.
Definition: PyAABBWrapper.h:14
virtual AABB * getAABB()=0
Obtain the axis aligned bounding box containing the primitive.
Wrapper for ScenePart class.
Definition: PyScenePartWrapper.h:14
std::shared_ptr< Material > material
Shared pointer to the material defining certain properties such as reflectance, specularity, ...
Definition: Primitive.h:43
virtual glm::dvec3 getCentroid()=0
Obtain the primitive centroid.
virtual void update()=0
Necessary primitive updates after modification.
virtual size_t getNumVertices()
Obtain the number of vertices returned by the getVertices function.
Definition: Primitive.h:111
virtual std::vector< double > getRayIntersection(const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir)=0
Obtain the intersection point between primitive and given ray.
Wrapper for std::vector<double> class.
Definition: PyDoubleVector.h:15
Class representing a material specification.
Definition: Material.h:11
virtual Vertex * getVertices()=0
Obtain basic vertices for the primitive.
std::shared_ptr< ScenePart > part
Shared pointer to the scene part the primitive belongs to.
Definition: Primitive.h:37
Wrapper for Primitive class.
Definition: PyPrimitiveWrapper.h:18
Abstract class defining the common behavior for all primitives.
Definition: Primitive.h:20
Wrapper to communicate glm::dvec3 with python.
Definition: PythonDVec3.h:14
virtual double getIncidenceAngle_rad(const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir, const glm::dvec3 &intersectionPoint)=0
Obtain the incidence angle in radians.
virtual double getRayIntersectionDistance(const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir)=0
Obtain the intersection distance between primitive and given ray.