mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 22:39:09 -05:00
Document code and start debugging Ellipsoid.
This commit is contained in:
@@ -47,8 +47,7 @@ namespace openspace {
|
||||
Vec3( // _radiiToTheFourth
|
||||
_cachedValues._radiiSquared.x * _cachedValues._radiiSquared.x,
|
||||
_cachedValues._radiiSquared.y * _cachedValues._radiiSquared.y,
|
||||
_cachedValues._radiiSquared.z * _cachedValues._radiiSquared.z),
|
||||
})
|
||||
_cachedValues._radiiSquared.z * _cachedValues._radiiSquared.z),})
|
||||
{
|
||||
|
||||
}
|
||||
@@ -107,6 +106,7 @@ namespace openspace {
|
||||
Vec3 Ellipsoid::geodeticSurfaceNormal(Geodetic2 geodetic2) const
|
||||
{
|
||||
Scalar cosLat = glm::cos(geodetic2.lat);
|
||||
//geodetic2.lon = geodetic2.lon > M_PI ? geodetic2.lon - M_PI * 2 : geodetic2.lon;
|
||||
return Vec3(
|
||||
cosLat * cos(geodetic2.lon),
|
||||
cosLat * sin(geodetic2.lon),
|
||||
@@ -117,8 +117,8 @@ namespace openspace {
|
||||
{
|
||||
Vec3 normal = geodeticSurfaceNormal(p);
|
||||
return Geodetic2(
|
||||
atan2(normal.y, normal.x),
|
||||
asin(normal.z / length(normal)));
|
||||
asin(normal.z / length(normal)), // Latitude
|
||||
atan2(normal.y, normal.x)); // Longitude
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::geodetic2ToCartesian(const Geodetic2& geodetic2) const
|
||||
|
||||
@@ -32,7 +32,10 @@ namespace openspace {
|
||||
/**
|
||||
This class is based largely on the Ellipsoid class defined in the book
|
||||
"3D Engine Design for Virtual Globes". Most planets or planetary objects are better
|
||||
described using ellipsoids than spheres.
|
||||
described using ellipsoids than spheres. All inputs and outputs to this class is
|
||||
in the WGS84 standard coordinate system where the x-axis points towards geographic
|
||||
(lat = 0, lon = 0), the y-axis points towards (lat = 0, lon = 90deg) and the
|
||||
z-axis points towards the north pole.
|
||||
*/
|
||||
class Ellipsoid {
|
||||
public:
|
||||
|
||||
@@ -168,7 +168,7 @@ void TriangleSoup::drawUsingActiveProgram() {
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _elementBufferID);
|
||||
//glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_CULL_FACE);
|
||||
//glCullFace(GL_FRONT);
|
||||
glDrawElements(GL_TRIANGLES, _elementData.size(), GL_UNSIGNED_INT, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
+4
-3
@@ -34,15 +34,16 @@
|
||||
//#include <test_spicemanager.inl>
|
||||
//#include <test_scenegraphloader.inl>
|
||||
//#include <test_chunknode.inl>
|
||||
#include <test_lrucache.inl>
|
||||
#include <test_twmstileprovider.inl>
|
||||
//#include <test_lrucache.inl>
|
||||
//#include <test_twmstileprovider.inl>
|
||||
#include <test_ellipsoid.inl>
|
||||
|
||||
//#include <test_luaconversions.inl>
|
||||
//#include <test_powerscalecoordinates.inl>
|
||||
//#include <test_angle.inl>
|
||||
//#include <test_latlonpatch.inl>
|
||||
//#include <test_texturetileset.inl>
|
||||
#include <test_gdalwms.inl>
|
||||
//#include <test_gdalwms.inl>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <modules/globebrowsing/geodetics/ellipsoid.h>
|
||||
#include <thread>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class EllipsoidTest : public testing::Test {};
|
||||
|
||||
using namespace openspace;
|
||||
|
||||
TEST_F(EllipsoidTest, GeodeticSurfaceNormal) {
|
||||
Ellipsoid ellipsoid(Vec3(1, 1, 1));
|
||||
|
||||
ellipsoid.geodeticSurfaceNormal(Vec3(0, 0, 1));
|
||||
}
|
||||
Reference in New Issue
Block a user