blob: 391c5a50285dada8202ca4ca7ad73c5f1753d359 (
plain)
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
|
// Copyright 2008 Nanorex, Inc. See LICENSE file for details.
#ifndef NX_NAMEDVIEW_H
#define NX_NAMEDVIEW_H
#include <Nanorex/Utility/NXVector.h>
#include <Nanorex/Utility/NXQuaternion.h>
#include <iostream>
#include <string>
namespace Nanorex {
/* CLASS: NXNamedView */
class NXNamedView {
public:
NXNamedView() {}
NXNamedView(std::string const& theName,
NXQuaternion<double> const& theRotationQuat,
double const& theScale,
NXVector3d const& thePOV,
double const& theZoomFactor)
: name(theName), rotationQuat(theRotationQuat), scale(theScale),
POV(thePOV), zoomFactor(theZoomFactor), vdist(6.0*scale)
{
}
~NXNamedView() {}
std::string const& getName(void) const { return name; }
void setName(std::string const& theName) { name = theName; }
NXQuaternion<double> const& getQuat(void) const { return rotationQuat; }
NXQuaternion<double>& getQuat(void) { return rotationQuat; }
void setQuat(NXQuaternion<double> const& quat) { rotationQuat = quat; }
double const& getScale(void) const { return scale; }
void setScale(double const& theScale) { scale = theScale; vdist = 6.0*scale; }
NXVectorRef3d getPOV(void) { return NXVectorRef3d(POV); }
void setPOV(NXVector3d const& thePOV) { POV = thePOV; }
double const& getZoomFactor(void) const { return zoomFactor; }
void setZoomFactor(double const& theZoomFactor) {zoomFactor = theZoomFactor;}
static double GetNear(void) { return 0.25; }
static double GetFar(void) { return 12.0; }
double const& getPOVDistanceFromEye(void) const { return vdist; }
double getNearPlaneDistanceFromEye(void) const { return GetNear() * vdist; }
double getFarPlaneDistanceFromEye(void) const { return GetFar() * vdist; }
private:
std::string name;
NXQuaternion<double> rotationQuat;
double scale;
NXVector3d POV;
double zoomFactor;
double vdist;
};
inline
std::ostream& operator << (std::ostream& o, Nanorex::NXNamedView& view)
{
o << "csys (" << view.getName() << ") " << view.getQuat()
<< " (" << view.getScale() << ") " << view.getPOV()
<< " (" << view.getZoomFactor() << ')';
return o;
}
} // namespace Nanorex
#endif // NX_NAMEDVIEW_H
|