-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathEmbreeShapeModel.h
105 lines (85 loc) · 4.23 KB
/
EmbreeShapeModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef EmbreeShapeModel_h
#define EmbreeShapeModel_h
/** This is free and unencumbered software released into the public domain.
The authors of ISIS do not claim copyright on the contents of this file.
For more details about the LICENSE terms and the AUTHORS, you will
find files of those names at the top level of this repository. **/
/* SPDX-License-Identifier: CC0-1.0 */
#include "ShapeModel.h"
#include <vector>
#include <embree2/rtcore.h>
#include <QMap>
#include <QVector>
#include "Distance.h"
#include "EmbreeTargetShape.h"
#include "EmbreeTargetManager.h"
#include "SurfacePoint.h"
#include "Target.h"
namespace Isis {
class Target;
/**
* @brief General purpose Embree ray tracing model
*
* @author 2017-04-22 Jesse Mapel and Jeannie Backer
*
* @internal
* @history 2017-04-22 Jesse Mapel and Jeannie Backer - Original Version
* @history 2018-05-01 Christopher Combs - Removed emissionAngle function to
* fix issues with using ellipsoids to find normals. Fixes #5387.
*/
class EmbreeShapeModel : public ShapeModel {
public:
// Constructors
EmbreeShapeModel();
EmbreeShapeModel(Target *target, Pvl &pvl,
EmbreeTargetManager *targetManager);
EmbreeShapeModel(Target *target, const QString &shapefile,
EmbreeTargetManager *targetManager);
// Destructor
virtual ~EmbreeShapeModel();
// Intersect the shape model
virtual bool intersectSurface(std::vector<double> observerPos,
std::vector<double> lookDirection);
virtual bool intersectSurface(const Latitude &lat, const Longitude &lon,
const std::vector<double> &observerPos,
const bool &backCheck = true);
virtual bool intersectSurface(const SurfacePoint &surfpt,
const std::vector<double> &observerPos,
const bool &backCheck = true);
virtual void clearSurfacePoint();
virtual bool isDEM() const;
double getTolerance() const;
void setTolerance(const double &tolerance);
// Calculate the default normal of the current intersection point
virtual void calculateDefaultNormal();
// Calculate the surface normal of the current intersection point
virtual void calculateLocalNormal(QVector<double *> cornerNeighborPoints);
virtual void calculateSurfaceNormal();
QVector<double> ellipsoidNormal();
virtual double incidenceAngle(const std::vector<double> &uB);
virtual Distance localRadius(const Latitude &lat, const Longitude &lon);
// Determine if the internal intercept is occluded from the observer/lookdir
virtual bool isVisibleFrom(const std::vector<double> observerPos,
const std::vector<double> lookDirection);
private:
// Disallow copying because ShapeModel is not copyable
Q_DISABLE_COPY(EmbreeShapeModel)
void updateIntersection(const RayHitInformation hitInfo);
RTCMultiHitRay latlonToRay(const Latitude &lat, const Longitude &lon) const;
RTCMultiHitRay pointToRay(const SurfacePoint &point) const;
QVector< RayHitInformation > sortHits(RTCMultiHitRay &ray,
LinearAlgebra::Vector &observer);
EmbreeTargetShape *m_targetShape; /**!< The target body and Embree objects
for intersection. This is owned and
managed by the target manager and
will be deleted by that. */
EmbreeTargetManager *m_targetManager; /**!< This manages EmbreeTargetShapes to
allow for sharing of them between
EmbreeShapeModels and deletes them
when no longer needed. */
double m_tolerance; /**!< Tolerance for checking visibility. */
QString m_shapeFile; /**!< The shapefile used to create the target
shape. */
};
};
#endif