Remove PowerScaledCoordinates and rename PowerScaledSphere to Sphere (closes #4)

This commit is contained in:
Alexander Bock
2019-12-27 23:29:28 +01:00
parent a51cee1f36
commit 207db3c824
23 changed files with 56 additions and 569 deletions
+1 -3
View File
@@ -395,9 +395,7 @@ public:
/**
* Default view options that can be used in the Property::setViewOption method. The
* values are: Property::ViewOptions::Color = \c color,
* Property::ViewOptions::LightPosition = \c lightPosition,
* Property::ViewOptions::PowerScaledScalar = \c powerScaledScalar, and
* Property::ViewOptions::PowerScaledCoordinate = \c powerScaledCoordinate.
* Property::ViewOptions::LightPosition = \c lightPosition
*/
struct ViewOptions {
static const char* Color;
-2
View File
@@ -25,7 +25,6 @@
#ifndef __OPENSPACE_CORE___CAMERA___H__
#define __OPENSPACE_CORE___CAMERA___H__
#include <openspace/util/powerscaledcoordinate.h>
#include <openspace/util/syncdata.h>
#include <ghoul/glm.h>
#include <mutex>
@@ -36,7 +35,6 @@ class SceneGraphNode;
/**
* This class still needs some more love. Suggested improvements:
* - Remove psc from the camera class interface.
* - Accessors should return constant references to double precision class members.
* - Remove the scaling variable (What is it used for?)
* - Remove the maxFov and sinMaxfov variables. Redundant since the fov is embedded
@@ -1,114 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* *
* 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. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__
#define __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__
#include <ghoul/glm.h>
namespace openspace {
class PowerScaledScalar;
class PowerScaledCoordinate {
public:
// constructors
PowerScaledCoordinate() = default;
PowerScaledCoordinate(PowerScaledCoordinate&& rhs);
PowerScaledCoordinate(const PowerScaledCoordinate& rhs);
// Sets the power scaled coordinates directly
PowerScaledCoordinate(glm::vec4 v);
PowerScaledCoordinate(float f1, float f2, float f3, float f4);
// Sets the power scaled coordinates with w = 0
PowerScaledCoordinate(glm::vec3 v);
static PowerScaledCoordinate CreatePowerScaledCoordinate(double d1, double d2,
double d3);
// get functions
// return the full, unmodified PSC
const glm::vec4& vec4() const;
// returns the rescaled, "normal" coordinates
glm::vec3 vec3() const;
// return the full psc as dvec4()
glm::dvec4 dvec4() const;
// rescaled return as dvec3
glm::dvec3 dvec3() const;
// length of the vector as a pss
float length() const;
glm::vec3 direction() const;
// operator overloading
PowerScaledCoordinate& operator=(const PowerScaledCoordinate& rhs);
PowerScaledCoordinate& operator=(PowerScaledCoordinate&& rhs);
PowerScaledCoordinate& operator+=(const PowerScaledCoordinate& rhs);
PowerScaledCoordinate operator+(const PowerScaledCoordinate& rhs) const;
PowerScaledCoordinate& operator-=(const PowerScaledCoordinate& rhs);
PowerScaledCoordinate operator-(const PowerScaledCoordinate& rhs) const;
float& operator[](unsigned int idx);
float operator[](unsigned int idx) const;
double dot(const PowerScaledCoordinate& rhs) const;
double angle(const PowerScaledCoordinate& rhs) const;
// scalar operators
PowerScaledCoordinate operator*(const double& rhs) const;
PowerScaledCoordinate operator*(const float& rhs) const;
PowerScaledCoordinate operator*(const glm::mat4& matrix) const;
// comparison
bool operator==(const PowerScaledCoordinate& other) const;
bool operator!=(const PowerScaledCoordinate& other) const;
bool operator<(const PowerScaledCoordinate& other) const;
bool operator>(const PowerScaledCoordinate& other) const;
bool operator<=(const PowerScaledCoordinate& other) const;
bool operator>=(const PowerScaledCoordinate& other) const;
// glm integration
PowerScaledCoordinate& operator=(const glm::dvec4& rhs);
PowerScaledCoordinate& operator=(const glm::vec4& rhs);
PowerScaledCoordinate& operator=(const glm::dvec3& rhs);
PowerScaledCoordinate& operator=(const glm::vec3& rhs);
friend std::ostream& operator<<(std::ostream& os, const PowerScaledCoordinate& rhs);
// allow the power scaled scalars to access private members
friend class PowerScaledScalar;
private:
// internal glm vector
glm::vec4 _vec = glm::vec4(0.f);
};
typedef PowerScaledCoordinate psc;
} // namespace openspace
#endif // __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__
@@ -22,22 +22,20 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___POWERSCALEDSPHERE___H__
#define __OPENSPACE_CORE___POWERSCALEDSPHERE___H__
#ifndef __OPENSPACE_CORE___SPHERE___H__
#define __OPENSPACE_CORE___SPHERE___H__
#include <ghoul/glm.h>
#include <ghoul/opengl/ghoul_gl.h>
namespace openspace {
class PowerScaledSphere;
class PowerScaledSphere {
class Sphere {
public:
PowerScaledSphere(float radius, int segments = 8);
PowerScaledSphere(glm::vec3 radius, int segments);
PowerScaledSphere(const PowerScaledSphere& cpy);
~PowerScaledSphere();
Sphere(float radius, int segments = 8);
Sphere(glm::vec3 radius, int segments);
Sphere(const Sphere& cpy);
~Sphere();
bool initialize();
@@ -62,4 +60,4 @@ public:
} // namespace openspace
#endif // __OPENSPACE_CORE___POWERSCALEDSPHERE___H__
#endif // __OPENSPACE_CORE___SPHERE___H__
@@ -26,7 +26,6 @@
#define __OPENSPACE_CORE___UPDATESTRUCTURES___H__
#include <openspace/util/camera.h>
#include <openspace/util/powerscaledcoordinate.h>
#include <openspace/util/time.h>
namespace openspace {