1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
/***********************************************/
/**
* @file borderCap.h
*
* @brief Spherical cap.
* @see Border
*
* @author Annette Eicker
* @date 2004-10-28
*
*/
/***********************************************/
#ifndef __GROOPS_BORDERCAP__
#define __GROOPS_BORDERCAP__
// Latex documentation
#ifdef DOCSTRING_Border
static const char *docstringBorderCap = R"(
\subsection{Cap}
The region is defined by a spherical cap with the center given in geographical coordinates
longitude (\config{lambdaCenter}) and latitude (\config{phiCenter}).
The radius of the cap is given as aperture angle \config{psi}.
\fig{!hb}{0.4}{borderCap}{fig:borderCap}{spherical cap}
)";
#endif
/***********************************************/
#include "config/config.h"
#include "classes/border/border.h"
/***** CLASS ***********************************/
/** @brief Spherical cap.
* @ingroup borderGroup
* @see Border */
class BorderCap : public BorderBase
{
Double cosPsi;
Vector3d center;
Bool exclude;
public:
BorderCap(Config &config);
Bool isInnerPoint(Angle lambda, Angle phi) const;
Bool isExclude() const {return exclude;}
};
/***********************************************/
inline BorderCap::BorderCap(Config &config)
{
Angle psi;
Angle lambdaCenter, phiCenter;
readConfig(config, "lambdaCenter", lambdaCenter, Config::MUSTSET, "", "longitude of the center of the cap");
readConfig(config, "phiCenter", phiCenter, Config::MUSTSET, "", "latitude of the center of the cap");
readConfig(config, "psi", psi, Config::MUSTSET, "", "aperture angle (radius)");
readConfig(config, "exclude", exclude, Config::DEFAULT, "0", "dismiss points inside");
if(isCreateSchema(config)) return;
cosPsi = cos(psi);
center = polar(lambdaCenter, phiCenter, 1.0);
}
/***********************************************/
inline Bool BorderCap::isInnerPoint(Angle lambda, Angle phi) const
{
Vector3d pkt = polar(lambda, phi, 1.0);
return cosPsi<=inner(pkt,center);
}
/***********************************************/
#endif /* __GROOPS_BORDER__ */
|