![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
/******************************************************************************
* Copyright (c) ATTX INC 2025. All Rights Reserved.
*
* This software and associated documentation (the "Software") are the
* proprietary and confidential information of ATTX INC. The Software is
* furnished under a license agreement between ATTX and the user organization
* and may be used or copied only in accordance with the terms of the agreement.
* Refer to 'license/attx_license.adoc' for standard license terms.
*
* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
* transmitted in any form or by any means, for any purpose, without the express
* written permission of ATTX INC.
******************************************************************************/
/*
Occultation model header file
Author: Alex Jackson
*/
/*
Metadata for MS GUI:
imdata = {"displayname" : "Occultation",
"exclude" : False,
"category" : "Environment"
}
aliases = {"r_s" : "Source Object Radius",
"r_oc" : "Occulting Object Radius",
"pos_ob__f" : "Observer Position",
"pos_oc__f" : "Occulting Object Position",
"pos_s__f" : "Source Position",
"occ_frac" : "Visibility Fraction",
}
*/
#ifndef MODELS_ENVIRONMENT_OCCULTATION_MODEL_H
#define MODELS_ENVIRONMENT_OCCULTATION_MODEL_H
#include "simulation/Model.h"
#include "frames/Frame.h"
#include "frames/Node.h"
#include "frames/frameutils.h"
#include "constants/planetdefaults.h"
namespace warptwin {
/**
* @brief Occultation model using spherical representations of objects
*
* This model calculates the occultation fraction of a source from the
* perspective of an observer using spherical representations of the
* occulting object and source.
*/
MODEL(OccultationModel)
public:
// Model params
// NAME TYPE DEFAULT VALUE
START_PARAMS
/* This is the radius of the source object. If the object is not spherical,
* a representative radius should be used. The default is zero radius (point)
*/
SIGNAL(r_s, double, 0.0)
/* This is the radius of the occulting object. If the object is not spherical,
* a representative radius should be used. The default is zero radius (point)
*/
SIGNAL(r_oc, double, 0.0)
END_PARAMS
// Model inputs
// NAME TYPE DEFAULT VALUE
START_INPUTS
/** The position of the observer in the reference frame f */
SIGNAL(pos_ob__f, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
/** The position of the occulting object in the reference frame f*/
SIGNAL(pos_oc__f, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
/** The position of the source object in the reference frame f*/
SIGNAL(pos_s__f, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
END_INPUTS
// Model outputs
// NAME TYPE DEFAULT VALUE
START_OUTPUTS
/** Fraction of two spherical representations of objects that are visible from the point
* of view of the observer. 0 is fully occulted, 1 is not occulted, 0-1 is
* visible fraction of observed object. */
SIGNAL(occ_frac, double, 1.0)
END_OUTPUTS
protected:
int16 execute() override;
// Temporary vectors and variables to carry out our calculations
double _a_i;
double _d;
double _d_1;
double _d_2;
double _d_e;
double _d_i;
double _d_o;
double _theta;
double _tmp;
double _tmp1;
double _tmp2;
double _tmp3;
double _tmp4;
double _tmp5;
CartesianVector3 _s_ob_vec;
CartesianVector3 _tmpvec;
};
}
#endif