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