[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars
From: Alexey Khudyakov <alexey.skladnoy () gmail ! com>
Date: 2011-03-11 16:55:43
Message-ID: 20110311165543.0BC4DAC8C5 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1224498 by khudyakov:
Add function to convert from sherical coordinates to
cartesian.
Function itself isn't used anywhere yet but this pattern
appears in lot of places in the code.
CCMAIL: kstars-devel@kde.org
M +12 -0 ksutils.h
--- trunk/KDE/kdeedu/kstars/kstars/ksutils.h #1224497:1224498
@@ -30,6 +30,7 @@
#include <Eigen/Core>
USING_PART_OF_NAMESPACE_EIGEN
#include <QPointF>
+#include "dms.h"
class QFile;
class QString;
@@ -73,6 +74,17 @@
return x - delta*floor( (x-min)/delta );
}
+ /** Convert from spherical to cartesian coordiate system.
+ * Resulting vector have unit length
+ */
+ inline Vector3d fromSperical(dms longitude, dms latitude) {
+ double sinL, sinB;
+ double cosL, cosB;
+ longitude.SinCos( sinL, cosL );
+ latitude.SinCos( sinB, cosB );
+ return Vector3d(cosB*cosL, cosB*sinL, sinB);
+ }
+
/** Convert a vector to a point */
inline QPointF vecToPoint(const Vector2f& vec) {
return QPointF( vec[0], vec[1] );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic