Show habitable zone teff interval in UI

This commit is contained in:
Emma Broman
2021-02-01 11:00:43 +01:00
parent ef091a1044
commit 85d63967c2
2 changed files with 30 additions and 4 deletions
@@ -66,6 +66,15 @@ namespace {
"If true, the habitable zone disc is rendered with the optimistic boundaries "
"rather than the conservative ones."
};
constexpr openspace::properties::Property::PropertyInfo KopparapuTeffIntervalInfo = {
"KopparapuTeffInterval",
"Effective Temperature Interval (Kopparapu's formula)" ,
"The range for which Kopparapu's formula is used for the habitable zone "
"computation. For stars with effective temperatures outside the range, a "
"simpler method by Tom E. Harris is used. This method only uses the star "
"luminosity and does not include computation of the optimistic boundaries."
};
} // namespace
namespace openspace {
@@ -93,6 +102,12 @@ documentation::Documentation RenderableHabitableZone::Documentation() {
new BoolVerifier,
Optional::Yes,
OptimisticInfo.description
},
{
KopparapuTeffIntervalInfo.identifier,
new DoubleVector2Verifier,
Optional::Yes,
KopparapuTeffIntervalInfo.description
}
}
};
@@ -115,6 +130,7 @@ RenderableHabitableZone::RenderableHabitableZone(const ghoul::Dictionary& dictio
, _teff(EffectiveTemperatureInfo, 5780.f, 0.f, 7.5e4f)
, _luminosity(LuminosityInfo, 1.f, 0.f, 1e8f)
, _showOptimistic(OptimisticInfo, false)
, _kopparapuTeffInterval(KopparapuTeffIntervalInfo, glm::vec2(2000.f, 8000.f))
{
documentation::testSpecificationAndThrow(
Documentation(),
@@ -143,6 +159,11 @@ RenderableHabitableZone::RenderableHabitableZone(const ghoul::Dictionary& dictio
}
addProperty(_showOptimistic);
// The user should not be able to change this property. It's just used to communicate
// the different rendering that happens outside of this interval
addProperty(_kopparapuTeffInterval);
_kopparapuTeffInterval.setReadOnly(true);
// Make parent's size related properties read only. We want to set them based on the
// given temperature and luminosity
_size.setReadOnly(true);
@@ -229,9 +250,10 @@ glm::dvec4 RenderableHabitableZone::computeKopparapuZoneBoundaries(float teff,
{
// Kopparapu's formula only considers stars with teff in range [2600, 7200] K.
// However, we want to use the formula for more stars, so add some flexibility to
// the teff boundaries.
// OBS! This also prevents problems with too large values in the distance computation
if (teff > 8000.f || teff < 2000.f) {
// the teff boundaries (see constructor).
// OBS! This also prevents problems with too large teff values in the computation
const glm::vec2 teffBounds = _kopparapuTeffInterval;
if (teff > teffBounds.y || teff < teffBounds.x) {
// For the other stars, use a method by Tom E. Morris:
// https://www.planetarybiology.com/calculating_habitable_zone.html
const double L = static_cast<double>(luminosity);
@@ -26,7 +26,9 @@
#define __OPENSPACE_MODULE_EXOPLANETS___RENDERABLEHABITABLEZONE___H__
#include <modules/base/rendering/renderabledisc.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/vector/vec2property.h>
namespace openspace {
@@ -46,7 +48,7 @@ private:
void computeZone();
/**
* Compute the inner and outer boundary of the habitable zone of a star, accordring to
* Compute the inner and outer boundary of the habitable zone of a star, according to
* formula and coefficients by Kopparapu et al. (2015) https://arxiv.org/abs/1404.5292
*
* \param teff The effective temperature of the star, in Kelvin
@@ -60,6 +62,8 @@ private:
properties::FloatProperty _luminosity;
properties::BoolProperty _showOptimistic;
properties::Vec2Property _kopparapuTeffInterval;
glm::vec2 _conservativeBounds;
UniformCache(modelViewProjection, opacity, width, texture,