StelProjectorClasses.hpp   StelProjectorClasses.hpp 
skipping to change at line 29 skipping to change at line 29
#ifndef _STELPROJECTIONS_HPP_ #ifndef _STELPROJECTIONS_HPP_
#define _STELPROJECTIONS_HPP_ #define _STELPROJECTIONS_HPP_
#include <limits> #include <limits>
#include "StelProjector.hpp" #include "StelProjector.hpp"
class StelProjectorPerspective : public StelProjector class StelProjectorPerspective : public StelProjector
{ {
public: public:
StelProjectorPerspective(const Mat4d& modelViewMat) : StelProjector( modelViewMat) {;} StelProjectorPerspective(ModelViewTranformP func) : StelProjector(fu nc) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 120.f;} virtual float getMaxFov() const {return 120.f;}
bool forward(Vec3f &v) const bool forward(Vec3f &v) const
{ {
const float r = std::sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) ; const float r = std::sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) ;
if (v[2] < 0) { if (v[2] < 0) {
v[0] /= (-v[2]); v[0] /= (-v[2]);
v[1] /= (-v[2]); v[1] /= (-v[2]);
v[2] = r; v[2] = r;
skipping to change at line 66 skipping to change at line 66
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return false;} virtual bool hasDiscontinuity() const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;}
}; };
class StelProjectorEqualArea : public StelProjector class StelProjectorEqualArea : public StelProjector
{ {
public: public:
StelProjectorEqualArea(const Mat4d& modelViewMat) : StelProjector(mo delViewMat) {;} StelProjectorEqualArea(ModelViewTranformP func) : StelProjector(func ) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 360.f;} virtual float getMaxFov() const {return 360.f;}
bool forward(Vec3f &v) const bool forward(Vec3f &v) const
{ {
const float r = std::sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) ; const float r = std::sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) ;
const float f = std::sqrt(2.f/(r*(r-v[2]))); const float f = std::sqrt(2.f/(r*(r-v[2])));
v[0] *= f; v[0] *= f;
v[1] *= f; v[1] *= f;
v[2] = r; v[2] = r;
skipping to change at line 92 skipping to change at line 92
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return false;} virtual bool hasDiscontinuity() const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;}
}; };
class StelProjectorStereographic : public StelProjector class StelProjectorStereographic : public StelProjector
{ {
public: public:
StelProjectorStereographic(const Mat4d& modelViewMat) : StelProjecto r(modelViewMat) {;} StelProjectorStereographic(ModelViewTranformP func) : StelProjector( func) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 235.f;} virtual float getMaxFov() const {return 235.f;}
bool forward(Vec3f &v) const bool forward(Vec3f &v) const
{ {
const float r = std::sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) ; const float r = std::sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]) ;
const float h = 0.5f*(r-v[2]); const float h = 0.5f*(r-v[2]);
if (h <= 0.f) { if (h <= 0.f) {
v[0] = std::numeric_limits<float>::max(); v[0] = std::numeric_limits<float>::max();
v[1] = std::numeric_limits<float>::max(); v[1] = std::numeric_limits<float>::max();
skipping to change at line 119 skipping to change at line 119
v[2] = r; v[2] = r;
return true; return true;
} }
virtual void project(int n, const Vec3d* in, Vec3f* out) virtual void project(int n, const Vec3d* in, Vec3f* out)
{ {
Vec3d v; Vec3d v;
for (int i = 0; i < n; ++i, ++out) for (int i = 0; i < n; ++i, ++out)
{ {
v = in[i]; v = in[i];
v.transfo4d(modelViewMatrix); modelViewTransform->forward(v);
out->set(v[0], v[1], v[2]); out->set(v[0], v[1], v[2]);
StelProjectorStereographic::forward(*out); StelProjectorStereographic::forward(*out);
out->set(viewportCenter[0] + flipHorz * pixelPerRad * (*out)[0], out->set(viewportCenter[0] + flipHorz * pixelPerRad * (*out)[0],
viewportCenter[1] + flipVert * pixelPerRad * (*out)[1], viewportCenter[1] + flipVert * pixelPerRad * (*out)[1],
((*out)[2] - zNear) * oneOverZNearMinusZFar) ; ((*out)[2] - zNear) * oneOverZNearMinusZFar) ;
} }
} }
bool backward(Vec3d &v) const; bool backward(Vec3d &v) const;
float fovToViewScalingFactor(float fov) const; float fovToViewScalingFactor(float fov) const;
skipping to change at line 141 skipping to change at line 141
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return false;} virtual bool hasDiscontinuity() const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;}
}; };
class StelProjectorFisheye : public StelProjector class StelProjectorFisheye : public StelProjector
{ {
public: public:
StelProjectorFisheye(const Mat4d& modelViewMat) : StelProjector(mode lViewMat) {;} StelProjectorFisheye(ModelViewTranformP func) : StelProjector(func) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 180.00001f;} virtual float getMaxFov() const {return 180.00001f;}
bool forward(Vec3f &v) const bool forward(Vec3f &v) const
{ {
const float rq1 = v[0]*v[0] + v[1]*v[1]; const float rq1 = v[0]*v[0] + v[1]*v[1];
if (rq1 > 0.f) { if (rq1 > 0.f) {
const float h = std::sqrt(rq1); const float h = std::sqrt(rq1);
const float f = std::atan2(h,-v[2]) / h; const float f = std::atan2(h,-v[2]) / h;
v[0] *= f; v[0] *= f;
skipping to change at line 180 skipping to change at line 180
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return false;} virtual bool hasDiscontinuity() const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;}
}; };
class StelProjectorHammer : public StelProjector class StelProjectorHammer : public StelProjector
{ {
public: public:
StelProjectorHammer(const Mat4d& modelViewMat) : StelProjector(model ViewMat) {;} StelProjectorHammer(ModelViewTranformP func) : StelProjector(func) { ;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 360.f;} virtual float getMaxFov() const {return 360.f;}
virtual void project(int n, const Vec3d* in, Vec3f* out) virtual void project(int n, const Vec3d* in, Vec3f* out)
{ {
Vec3d v; Vec3d v;
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
{ {
v = in[i]; v = in[i];
v.transfo4d(modelViewMatrix); modelViewTransform->forward(v);
out[i].set(v[0], v[1], v[2]); out[i].set(v[0], v[1], v[2]);
StelProjectorHammer::forward(out[i]); StelProjectorHammer::forward(out[i]);
out[i][0] = viewportCenter[0] + flipHorz * pixelPerR ad * out[i][0]; out[i][0] = viewportCenter[0] + flipHorz * pixelPerR ad * out[i][0];
out[i][1] = viewportCenter[1] + flipVert * pixelPerR ad * out[i][1]; out[i][1] = viewportCenter[1] + flipVert * pixelPerR ad * out[i][1];
out[i][2] = (out[i][2] - zNear) * oneOverZNearMinusZ Far; out[i][2] = (out[i][2] - zNear) * oneOverZNearMinusZ Far;
} }
} }
bool forward(Vec3f &v) const bool forward(Vec3f &v) const
{ {
// Hammer Aitoff // Hammer Aitoff
skipping to change at line 230 skipping to change at line 230
static const SphericalCap cap2(-1,0,0); static const SphericalCap cap2(-1,0,0);
static const SphericalCap cap3(0,0,-1); static const SphericalCap cap3(0,0,-1);
SphericalCap cap(capN, capD); SphericalCap cap(capN, capD);
return cap.intersects(cap1) && cap.intersects(cap2) && cap.i ntersects(cap2); return cap.intersects(cap1) && cap.intersects(cap2) && cap.i ntersects(cap2);
} }
}; };
class StelProjectorCylinder : public StelProjector class StelProjectorCylinder : public StelProjector
{ {
public: public:
StelProjectorCylinder(const Mat4d& modelViewMat) : StelProjector(mod elViewMat) {;} StelProjectorCylinder(ModelViewTranformP func) : StelProjector(func) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 175.f * 4.f/3.f;} // assume aspect ration of 4/3 for getting a full 360 degree horizon virtual float getMaxFov() const {return 175.f * 4.f/3.f;} // assume aspect ration of 4/3 for getting a full 360 degree horizon
bool forward(Vec3f &win) const; bool forward(Vec3f &win) const;
bool backward(Vec3d &v) const; bool backward(Vec3d &v) const;
float fovToViewScalingFactor(float fov) const; float fovToViewScalingFactor(float fov) const;
float viewScalingFactorToFov(float vsf) const; float viewScalingFactorToFov(float vsf) const;
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return true;} virtual bool hasDiscontinuity() const {return true;}
skipping to change at line 258 skipping to change at line 258
static const SphericalCap cap2(-1,0,0); static const SphericalCap cap2(-1,0,0);
static const SphericalCap cap3(0,0,-1); static const SphericalCap cap3(0,0,-1);
SphericalCap cap(capN, capD); SphericalCap cap(capN, capD);
return cap.intersects(cap1) && cap.intersects(cap2) && cap.i ntersects(cap2); return cap.intersects(cap1) && cap.intersects(cap2) && cap.i ntersects(cap2);
} }
}; };
class StelProjectorMercator : public StelProjector class StelProjectorMercator : public StelProjector
{ {
public: public:
StelProjectorMercator(const Mat4d& modelViewMat) : StelProjector(mod elViewMat) {;} StelProjectorMercator(ModelViewTranformP func) : StelProjector(func) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 175.f * 4.f/3.f;} // assume aspect ration of 4/3 for getting a full 360 degree horizon virtual float getMaxFov() const {return 175.f * 4.f/3.f;} // assume aspect ration of 4/3 for getting a full 360 degree horizon
bool forward(Vec3f &win) const; bool forward(Vec3f &win) const;
bool backward(Vec3d &v) const; bool backward(Vec3d &v) const;
float fovToViewScalingFactor(float fov) const; float fovToViewScalingFactor(float fov) const;
float viewScalingFactorToFov(float vsf) const; float viewScalingFactorToFov(float vsf) const;
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return true;} virtual bool hasDiscontinuity() const {return true;}
skipping to change at line 286 skipping to change at line 286
static const SphericalCap cap2(-1,0,0); static const SphericalCap cap2(-1,0,0);
static const SphericalCap cap3(0,0,-1); static const SphericalCap cap3(0,0,-1);
SphericalCap cap(capN, capD); SphericalCap cap(capN, capD);
return cap.intersects(cap1) && cap.intersects(cap2) && cap.i ntersects(cap2); return cap.intersects(cap1) && cap.intersects(cap2) && cap.i ntersects(cap2);
} }
}; };
class StelProjectorOrthographic : public StelProjector class StelProjectorOrthographic : public StelProjector
{ {
public: public:
StelProjectorOrthographic(const Mat4d& modelViewMat) : StelProjector (modelViewMat) {;} StelProjectorOrthographic(ModelViewTranformP func) : StelProjector(f unc) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 179.9999f;} virtual float getMaxFov() const {return 179.9999f;}
bool forward(Vec3f &win) const; bool forward(Vec3f &win) const;
bool backward(Vec3d &v) const; bool backward(Vec3d &v) const;
float fovToViewScalingFactor(float fov) const; float fovToViewScalingFactor(float fov) const;
float viewScalingFactorToFov(float vsf) const; float viewScalingFactorToFov(float vsf) const;
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return false;} virtual bool hasDiscontinuity() const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, co nst Vec3d&) const {return false;}
virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;} virtual bool intersectViewportDiscontinuityInternal(const Vec3d&, do uble) const {return false;}
}; };
class StelProjector2d : public StelProjector class StelProjector2d : public StelProjector
{ {
public: public:
StelProjector2d() : StelProjector(Mat4d::identity()) {;} StelProjector2d() : StelProjector(ModelViewTranformP(new StelProject or::Mat4dTransform(Mat4d::identity()))) {;}
virtual QString getNameI18() const; virtual QString getNameI18() const;
virtual QString getDescriptionI18() const; virtual QString getDescriptionI18() const;
virtual float getMaxFov() const {return 360.f;} virtual float getMaxFov() const {return 360.f;}
bool forward(Vec3f &win) const; bool forward(Vec3f &win) const;
bool backward(Vec3d &v) const; bool backward(Vec3d &v) const;
float fovToViewScalingFactor(float fov) const; float fovToViewScalingFactor(float fov) const;
float viewScalingFactorToFov(float vsf) const; float viewScalingFactorToFov(float vsf) const;
float deltaZoom(float fov) const; float deltaZoom(float fov) const;
protected: protected:
virtual bool hasDiscontinuity() const {return false;} virtual bool hasDiscontinuity() const {return false;}
 End of changes. 11 change blocks. 
11 lines changed or deleted 11 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/