Wrap compatibility methods with #ifdef __CELVEC__
parent
85829063e0
commit
8790e84a4c
|
@ -219,11 +219,13 @@ void astro::decimalToHourMinSec(double angle, int& hours, int& minutes, double&
|
|||
|
||||
// Compute the fraction of a sphere which is illuminated and visible
|
||||
// to a viewer. The source of illumination is assumed to be at (0, 0, 0)
|
||||
#ifdef __CELVEC__
|
||||
float astro::sphereIlluminationFraction(Point3d /*spherePos*/,
|
||||
Point3d /*viewerPos*/)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Convert equatorial coordinates to Cartesian celestial (or ecliptical)
|
||||
// coordinates.
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
#ifndef _CELENGINE_ASTRO_H_
|
||||
#define _CELENGINE_ASTRO_H_
|
||||
|
||||
#ifdef __CELVEC__
|
||||
#include <celmath/vecmath.h>
|
||||
#include <celmath/quaternion.h>
|
||||
#endif
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Geometry>
|
||||
#include <iostream>
|
||||
|
@ -209,8 +211,10 @@ namespace astro
|
|||
double degMinSecToDecimal(int degrees, int minutes, double seconds);
|
||||
void decimalToHourMinSec(double angle, int& hours, int& minutes, double& seconds);
|
||||
|
||||
#ifdef __CELVEC__
|
||||
float sphereIlluminationFraction(Point3d spherePos,
|
||||
Point3d viewerPos);
|
||||
#endif
|
||||
|
||||
Eigen::Vector3f equatorialToCelestialCart(float ra, float dec, float distance);
|
||||
Eigen::Vector3d equatorialToCelestialCart(double ra, double dec, double distance);
|
||||
|
|
|
@ -393,6 +393,7 @@ bool AssociativeArray::getBoolean(const string& key, bool& val) const
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef __CELVEC__
|
||||
bool AssociativeArray::getVector(const string& key, Vec3d& val) const
|
||||
{
|
||||
Value* v = getValue(key);
|
||||
|
@ -415,6 +416,7 @@ bool AssociativeArray::getVector(const string& key, Vec3d& val) const
|
|||
val = Vec3d(x->getNumber(), y->getNumber(), z->getNumber());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AssociativeArray::getVector(const string& key, Vector3d& val) const
|
||||
{
|
||||
|
@ -439,6 +441,7 @@ bool AssociativeArray::getVector(const string& key, Vector3d& val) const
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef __CELVEC__
|
||||
bool AssociativeArray::getVector(const string& key, Vec3f& val) const
|
||||
{
|
||||
Vec3d vecVal;
|
||||
|
@ -449,6 +452,7 @@ bool AssociativeArray::getVector(const string& key, Vec3f& val) const
|
|||
val = Vec3f((float) vecVal.x, (float) vecVal.y, (float) vecVal.z);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool AssociativeArray::getVector(const string& key, Vector3f& val) const
|
||||
|
@ -463,6 +467,7 @@ bool AssociativeArray::getVector(const string& key, Vector3f& val) const
|
|||
}
|
||||
|
||||
|
||||
#ifdef __CELVEC__
|
||||
/** @copydoc AssociativeArray::getRotation() */
|
||||
bool AssociativeArray::getRotation(const string& key, Quatf& val) const
|
||||
{
|
||||
|
@ -499,6 +504,7 @@ bool AssociativeArray::getRotation(const string& key, Quatf& val) const
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,8 +13,11 @@
|
|||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <celmath/mathlib.h>
|
||||
#ifdef __CELVEC__
|
||||
#include <celmath/vecmath.h>
|
||||
#include <celmath/quaternion.h>
|
||||
#endif
|
||||
#include <celutil/color.h>
|
||||
#include <celengine/tokenizer.h>
|
||||
#include <Eigen/Core>
|
||||
|
@ -41,9 +44,11 @@ class AssociativeArray
|
|||
bool getBoolean(const std::string&, bool&) const;
|
||||
bool getVector(const std::string&, Eigen::Vector3d&) const;
|
||||
bool getVector(const std::string&, Eigen::Vector3f&) const;
|
||||
#ifdef __CELVEC__
|
||||
bool getVector(const std::string&, Vec3d&) const;
|
||||
bool getVector(const std::string&, Vec3f&) const;
|
||||
bool getRotation(const std::string&, Quatf&) const;
|
||||
#endif
|
||||
bool getRotation(const std::string&, Eigen::Quaternionf&) const;
|
||||
bool getColor(const std::string&, Color&) const;
|
||||
bool getAngle(const std::string&, double&, double = 1.0, double = 0.0) const;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "astro.h"
|
||||
#include <Eigen/Core>
|
||||
|
||||
#define DEPRECATED_UNIVCOORD_METHODS 1
|
||||
#define DEPRECATED_UNIVCOORD_METHODS 0
|
||||
|
||||
#if DEPRECATED_UNIVCOORD_METHODS
|
||||
#include <celmath/vecmath.h>
|
||||
|
|
|
@ -13,13 +13,16 @@
|
|||
#ifndef _CELENGINE_VECGL_H_
|
||||
#define _CELENGINE_VECGL_H_
|
||||
|
||||
#ifdef __CELVEC__
|
||||
#include <celmath/vecmath.h>
|
||||
#include <celmath/quaternion.h>
|
||||
#endif
|
||||
#include <celutil/color.h>
|
||||
#include <GL/glew.h>
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Geometry>
|
||||
|
||||
#ifdef __CELVEC__
|
||||
inline void glVertex(const Point3f& p)
|
||||
{
|
||||
glVertex3fv(&p.x);
|
||||
|
@ -39,6 +42,8 @@ inline void glTexCoord(const Point2f& p)
|
|||
{
|
||||
glTexCoord2fv(&p.x);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
inline void glColor(const Color& c)
|
||||
{
|
||||
|
@ -51,6 +56,7 @@ inline void glColor(const Color& c, float a)
|
|||
}
|
||||
|
||||
|
||||
#ifdef __CELVEC__
|
||||
inline void glMatrix(const Mat4f& m)
|
||||
{
|
||||
Mat4f trans = m.transpose();
|
||||
|
@ -89,6 +95,7 @@ inline void glScale(const Vec3f& v)
|
|||
{
|
||||
glScalef(v.x, v.y, v.z);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
inline void glLightDirection(GLenum light, const Vec3f& dir)
|
||||
|
|
|
@ -108,9 +108,13 @@ public:
|
|||
void setTable(const char* field, const char* value);
|
||||
|
||||
void newFrame(const ObserverFrame& f);
|
||||
#ifdef __CELVEC__
|
||||
void newVector(const Vec3d& v);
|
||||
#endif
|
||||
void newVector(const Eigen::Vector3d& v);
|
||||
#ifdef __CELVEC__
|
||||
void newRotation(const Quatd& q);
|
||||
#endif
|
||||
void newRotation(const Eigen::Quaterniond& q);
|
||||
void newPosition(const UniversalCoord& uc);
|
||||
void newObject(const Selection& sel);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <Eigen/Core>
|
||||
|
||||
|
||||
#ifdef __CELVEC__
|
||||
template<class T> T distance(const Point3<T>& p, const Sphere<T>& s)
|
||||
{
|
||||
return abs(s.center.distanceTo(p) - s.radius);
|
||||
|
@ -38,6 +39,7 @@ template<class T> T distance(const Point3<T>& p, const Ray3<T>& r)
|
|||
else
|
||||
return (p2 - r.point(t)).norm();
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T> T distance(const Eigen::Matrix<T, 3, 1>& p, const Ray3<T>& r)
|
||||
{
|
||||
|
@ -48,6 +50,7 @@ template<class T> T distance(const Eigen::Matrix<T, 3, 1>& p, const Ray3<T>& r)
|
|||
return (p - r.point(t)).norm();
|
||||
}
|
||||
|
||||
#ifdef __CELVEC__
|
||||
// Distance between a point and a segment defined by orig+dir*t, 0 <= t <= 1
|
||||
template<class T> T distanceToSegment(const Point3<T>& p,
|
||||
const Point3<T>& origin,
|
||||
|
@ -61,6 +64,7 @@ template<class T> T distanceToSegment(const Point3<T>& p,
|
|||
else
|
||||
return p.distanceTo(origin + direction * t);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _CELMATH_DISTANCE_H_
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#ifndef _CELMATH_ELLIPSOID_H_
|
||||
#define _CELMATH_ELLIPSOID_H_
|
||||
|
||||
#ifdef __CELVEC__
|
||||
#include "vecmath.h"
|
||||
#endif
|
||||
#include <Eigen/Core>
|
||||
|
||||
template<class T> class Ellipsoid
|
||||
|
@ -55,6 +57,7 @@ template<class T> class Ellipsoid
|
|||
}
|
||||
|
||||
|
||||
#ifdef __CELVEC__
|
||||
/**** Compatibility with old Celestia vectors ****/
|
||||
|
||||
/*! Created an ellipsoid with the specified semiaxes, centered
|
||||
|
@ -83,6 +86,7 @@ template<class T> class Ellipsoid
|
|||
v = Vector3<T>(v.x / axes.x, v.y / axes.y, v.z / axes.z);
|
||||
return v * v <= (T) 1.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
Eigen::Matrix<T, 3, 1> center;
|
||||
|
|
|
@ -106,6 +106,7 @@ Frustum::testSphere(const Eigen::Vector3d& center, double radius) const
|
|||
}
|
||||
|
||||
|
||||
#ifdef __CELVEC__
|
||||
Frustum::Aspect Frustum::test(const Point3f& p) const
|
||||
{
|
||||
return testSphere(Eigen::Vector3f(p.x, p.y, p.z), 0.0f);
|
||||
|
@ -122,6 +123,7 @@ Frustum::Aspect Frustum::testSphere(const Point3d& center, double radius) const
|
|||
{
|
||||
return testSphere(Eigen::Vector3d(center.x, center.y, center.z), radius);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Frustum::Aspect Frustum::testCapsule(const Capsulef& capsule) const
|
||||
|
@ -204,6 +206,7 @@ Frustum::transform(const Matrix4f& m)
|
|||
}
|
||||
|
||||
|
||||
#ifdef __CELVEC__
|
||||
void
|
||||
Frustum::transform(const Mat3f& m)
|
||||
{
|
||||
|
@ -218,3 +221,4 @@ Frustum::transform(const Mat4f& m)
|
|||
Matrix4f m2 = Map<Matrix4f>(&m[0][0]);
|
||||
transform(m2);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
#include <Eigen/Geometry>
|
||||
|
||||
// Compatibility
|
||||
#ifdef __CELVEC__
|
||||
#include <celmath/plane.h>
|
||||
#endif
|
||||
|
||||
#include <celmath/capsule.h>
|
||||
|
||||
|
@ -57,6 +59,7 @@ class Frustum
|
|||
Aspect testSphere(const Eigen::Vector3d& center, double radius) const;
|
||||
Aspect testCapsule(const Capsulef&) const;
|
||||
|
||||
#ifdef __CELVEC__
|
||||
// Compatibility
|
||||
inline Planef getPlane(unsigned int which) const
|
||||
{
|
||||
|
@ -68,6 +71,7 @@ class Frustum
|
|||
Aspect test(const Point3f&) const;
|
||||
Aspect testSphere(const Point3f& center, float radius) const;
|
||||
Aspect testSphere(const Point3d& center, double radius) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
void init(float, float, float, float);
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#ifndef _CELMATH_RAY_H_
|
||||
#define _CELMATH_RAY_H_
|
||||
|
||||
#ifdef __CELVEC__
|
||||
#include "vecmath.h"
|
||||
#endif
|
||||
#include <Eigen/Core>
|
||||
|
||||
template<class T> class Ray3
|
||||
|
@ -20,8 +22,10 @@ template<class T> class Ray3
|
|||
|
||||
Ray3();
|
||||
Ray3(const Eigen::Matrix<T, 3, 1>& origin, const Eigen::Matrix<T, 3, 1>& direction);
|
||||
#ifdef __CELVEC__
|
||||
// Compatibility
|
||||
Ray3(const Point3<T>&, const Vector3<T>&);
|
||||
#endif
|
||||
|
||||
Eigen::Matrix<T, 3, 1> point(T) const;
|
||||
|
||||
|
@ -50,6 +54,7 @@ template<class T> Ray3<T>::Ray3(const Eigen::Matrix<T, 3, 1>& _origin,
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef __CELVEC__
|
||||
// Compatibility
|
||||
template<class T> Ray3<T>::Ray3(const Point3<T>& _origin,
|
||||
const Vector3<T>& _direction) :
|
||||
|
@ -57,12 +62,14 @@ template<class T> Ray3<T>::Ray3(const Point3<T>& _origin,
|
|||
direction(_direction.x, _direction.y, _direction.z)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T> Eigen::Matrix<T, 3, 1> Ray3<T>::point(T t) const
|
||||
{
|
||||
return origin + direction * t;
|
||||
}
|
||||
|
||||
#ifdef __CELVEC__
|
||||
// Compatibility
|
||||
template<class T> Ray3<T> operator*(const Ray3<T>& r, const Matrix3<T>& m)
|
||||
{
|
||||
|
@ -76,6 +83,7 @@ template<class T> Ray3<T> operator*(const Ray3<T>& r, const Matrix4<T>& m)
|
|||
Eigen::Map<Eigen::Matrix<T, 4, 4> > m2(&m[0][0]);
|
||||
return Ray3<T>(m2 * r.origin, m2 * r.direction);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CELMATH_RAY_H_
|
||||
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#ifndef _CELMATH_SPHERE_H_
|
||||
#define _CELMATH_SPHERE_H_
|
||||
|
||||
#ifdef __CELVEC__
|
||||
#include "vecmath.h"
|
||||
#endif
|
||||
#include <Eigen/Core>
|
||||
|
||||
template<class T> class Sphere
|
||||
|
@ -36,12 +38,14 @@ template<class T> class Sphere
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef __CELVEC__
|
||||
// Compatibility
|
||||
Sphere(const Point3<T>& _center, T _radius) :
|
||||
center(_center.x, _center.y, _center.z),
|
||||
radius(_radius)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
Eigen::Matrix<T, 3, 1> center;
|
||||
|
|
Loading…
Reference in New Issue