lsst.astshim
14.0-10-ga7aaa25+3
|
#include <Frame.h>
Public Member Functions | |
Frame (int naxes, std::string const &options="") | |
Frame (Frame const &)=delete | |
Frame (Frame &&)=default | |
Frame & | operator= (Frame const &)=delete |
Frame & | operator= (Frame &&)=default |
std::shared_ptr< Frame > | copy () const |
Return a deep copy of this object. | |
double | angle (PointD const &a, PointD const &b, PointD const &c) const |
double | axAngle (PointD const &a, PointD const &b, int axis) const |
double | axDistance (int axis, double v1, double v2) const |
double | axOffset (int axis, double v1, double dist) const |
std::shared_ptr< FrameSet > | convert (Frame const &to, std::string const &domainlist="") |
double | distance (PointD const &point1, PointD const &point2) const |
std::shared_ptr< FrameSet > | findFrame (Frame const &tmplt, std::string const &domainlist="") |
std::string | format (int axis, double value) const |
bool | getActiveUnit () const |
std::string | getAlignSystem () const |
double | getBottom (int axis) const |
int | getDigits () const |
int | getDigits (int axis) const |
bool | getDirection (int axis) const |
std::string | getDomain () const |
double | getDut1 () const |
double | getEpoch () const |
std::string | getFormat (int axis) const |
std::string | getInternalUnit (int axis) const |
std::string | getLabel (int axis) const |
bool | getMatchEnd () const |
int | getMaxAxes () const |
int | getMinAxes () const |
int | getNAxes () const |
std::string | getNormUnit (int axis) const |
double | getObsAlt () const |
std::string | getObsLat () const |
std::string | getObsLon () const |
bool | getPermute () const |
bool | getPreserveAxes () const |
std::string | getSymbol (int axis) const |
std::string | getSystem () const |
std::string | getTitle () const |
double | getTop (int axis) const |
std::string | getUnit (int axis) const |
std::vector< double > | intersect (std::vector< double > const &a1, std::vector< double > const &a2, std::vector< double > const &b1, std::vector< double > const &b2) const |
std::vector< int > | matchAxes (Frame const &other) const |
CmpFrame | under (Frame const &next) const |
PointD | norm (PointD value) const |
PointD | offset (PointD point1, PointD point2, double offset) const |
DirectionPoint | offset2 (PointD const &point1, double angle, double offset) const |
void | permAxes (std::vector< int > perm) |
FrameMapping | pickAxes (std::vector< int > const &axes) const |
ResolvedPoint | resolve (std::vector< double > const &point1, std::vector< double > const &point2, std::vector< double > const &point3) const |
void | setAlignSystem (std::string const &system) |
void | setBottom (int axis, double bottom) |
void | setDigits (int digits) |
void | setDigits (int axis, int digits) |
void | setDirection (bool direction, int axis) |
virtual void | setDomain (std::string const &domain) |
void | setDut1 (double dut1) |
void | setEpoch (double epoch) |
void | setEpoch (std::string const &epoch) |
void | setFormat (int axis, std::string const &format) |
void | setLabel (int axis, std::string const &label) |
void | setMatchEnd (bool match) |
void | setMaxAxes (int maxAxes) |
void | setMinAxes (int minAxes) |
void | setObsAlt (double alt) |
void | setObsLat (std::string const &lat) |
void | setObsLon (std::string const &lon) |
void | setActiveUnit (bool enable) |
void | setPermute (bool permute) |
void | setPreserveAxes (bool preserve) |
void | setSymbol (int axis, std::string const &symbol) |
void | setSystem (std::string const &system) |
void | setTitle (std::string const &title) |
void | setTop (int axis, double top) |
void | setUnit (int axis, std::string const &unit) |
NReadValue | unformat (int axis, std::string const &str) const |
![]() | |
Mapping (Mapping const &)=delete | |
Mapping (Mapping &&)=default | |
Mapping & | operator= (Mapping const &)=delete |
Mapping & | operator= (Mapping &&)=default |
std::shared_ptr< Mapping > | copy () const |
Return a deep copy of this object. | |
int | getNIn () const |
int | getNOut () const |
bool | getIsSimple () const |
bool | isInverted () const |
bool | getIsLinear () const |
bool | getReport () const |
bool | hasForward () const |
bool | hasInverse () const |
std::shared_ptr< Mapping > | getInverse () const |
Array2D | linearApprox (PointD const &lbnd, PointD const &ubnd, double tol) const |
SeriesMap | then (Mapping const &next) const |
ParallelMap | under (Mapping const &next) const |
double | rate (PointD const &at, int ax1, int ax2) const |
void | setReport (bool report) |
std::shared_ptr< Mapping > | simplify () const |
void | applyForward (ConstArray2D const &from, Array2D const &to) const |
Array2D | applyForward (ConstArray2D const &from) const |
std::vector< double > | applyForward (std::vector< double > const &from) const |
void | applyInverse (ConstArray2D const &from, Array2D const &to) const |
Array2D | applyInverse (ConstArray2D const &from) const |
std::vector< double > | applyInverse (std::vector< double > const &from) const |
void | tranGridForward (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const |
Array2D | tranGridForward (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const |
void | tranGridInverse (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const |
Array2D | tranGridInverse (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const |
![]() | |
Object (Object const &)=delete | |
Object (Object &&)=default | |
Object & | operator= (Object const &)=delete |
Object & | operator= (Object &&)=default |
bool | operator== (Object const &rhs) const |
bool | operator!= (Object const &rhs) const |
std::shared_ptr< Object > | copy () const |
Return a deep copy of this object. | |
void | clear (std::string const &attrib) |
bool | hasAttribute (std::string const &attrib) const |
std::string | getClassName () const |
std::string | getID () const |
Get ID: object identification string that is not copied. | |
std::string | getIdent () const |
Get Ident: object identification string that is copied. | |
int | getNObject () const |
int | getObjSize () const |
Get ObjSize: the in-memory size of the AST object in bytes. | |
int | getRefCount () const |
bool | getUseDefs () const |
Get UseDefs: allow use of default values for Object attributes? | |
void | lock (bool wait) |
bool | same (Object const &other) const |
void | setID (std::string const &id) |
Set ID: object identification string that is not copied. | |
void | setIdent (std::string const &ident) |
Set Ident: object identification string that is copied. | |
void | setUseDefs (bool usedefs) |
Set UseDefs: allow use of default values for Object attributes? | |
void | show (std::ostream &os, bool showComments=true) const |
std::string | show (bool showComments=true) const |
bool | test (std::string const &attrib) const |
void | unlock (bool report=false) |
AstObject const * | getRawPtr () const |
AstObject * | getRawPtr () |
Protected Member Functions | |
Frame (AstFrame *rawPtr) | |
virtual std::shared_ptr< Object > | copyPolymorphic () const override |
![]() | |
Mapping (AstMapping *rawMap) | |
template<typename Class > | |
std::shared_ptr< Class > | decompose (int i, bool copy) const |
![]() | |
Object (AstObject *object) | |
template<typename T , typename AstT > | |
std::shared_ptr< T > | copyImpl () const |
bool | getB (std::string const &attrib) const |
std::string const | getC (std::string const &attrib) const |
double | getD (std::string const &attrib) const |
float | getF (std::string const &attrib) const |
int | getI (std::string const &attrib) const |
long int | getL (std::string const &attrib) const |
void | set (std::string const &setting) |
void | setB (std::string const &attrib, bool value) |
void | setC (std::string const &attrib, std::string const &value) |
void | setD (std::string const &attrib, double value) |
void | setF (std::string const &attrib, float value) |
void | setI (std::string const &attrib, int value) |
void | setL (std::string const &attrib, long int value) |
Friends | |
class | Object |
Additional Inherited Members | |
![]() | |
using | ObjectPtr = std::unique_ptr< AstObject, Deleter > |
unique pointer holding an AST raw pointer | |
![]() | |
static std::shared_ptr< Object > | fromString (std::string const &str) |
template<typename Class > | |
static std::shared_ptr< Class > | fromAstObject (AstObject *rawObj, bool copy) |
![]() | |
template<typename ShimT , typename AstT > | |
static std::shared_ptr< ShimT > | makeShim (AstObject *p) |
Frame is used to represent a coordinate system.
It does this in rather the same way that a frame around a graph describes the coordinate space in which data are plotted. Consequently, a Frame has a Title (string) attribute, which describes the coordinate space, and contains axes which in turn hold information such as Label and Units strings which are used for labelling (e.g.) graphical output. In general, however, the number of axes is not restricted to two.
Functions are available for converting Frame coordinate values into a form suitable for display, and also for calculating distances and offsets between positions within the Frame.
Frames may also contain knowledge of how to transform to and from related coordinate systems.
In addition to those provided by Mapping and Object, Frame provides the following attributes, where axis
is an axis number, starting from 1 and (axis)
may be omitted if the Frame has only one axis:
|
inlineexplicit |
|
inlineexplicitprotected |
Construct a Frame from a pointer to a raw AstFrame.
This method is public so subclasses can call it.
std::invalid_argument | if rawPtr is not an AstFrame |
TODO make protected and use friend class
Find the angle at point B between the line joining points A and B, and the line joining points C and B.
These lines will in fact be geodesic curves appropriate to the Frame in use. For instance, in SkyFrame, they will be great circles.
[in] | a | the coordinates of the first point |
[in] | b | the coordinates of the first second |
[in] | c | the coordinates of the first third |
std::invalid_argument | if a , b or c have the wrong length |
Find the angle, as seen from point A, between the positive direction of a specified axis, and the geodesic curve joining point A to point B.
[in] | a | the coordinates of the first point |
[in] | b | the coordinates of the second point |
[in] | axis | the index of the axis from which the angle is to be measured, where 1 is the first axis |
std::invalid_argument | if a or b have the wrong length |
distance
method.
|
inline |
Return a signed value representing the axis increment from axis value v1 to axis value v2.
For a simple Frame, this is a trivial operation returning the difference between the two axis values. But for other derived classes of Frame (such as a SkyFrame) this is not the case.
[in] | axis | The index of the axis to which the supplied values refer. The first axis has index 1. |
[in] | v1 | The first axis value. |
[in] | v2 | The second axis value. |
|
inline |
Return an axis value formed by adding a signed axis increment onto a supplied axis value.
For a simple Frame, this is a trivial operation returning the sum of the two supplied values. But for other derived classes of Frame (such as a SkyFrame) this is not the case.
[in] | axis | The index of the axis to which the supplied values refer. The first axis has index 1. |
[in] | v1 | The original axis value. |
[in] | dist | The axis increment to add to the original axis value. |
std::shared_ptr< FrameSet > ast::Frame::convert | ( | Frame const & | to, |
std::string const & | domainlist = "" |
||
) |
Compute a frameset that describes the conversion between this frame and another frame.
If conversion is possible, it returns a shared pointer to a FrameSet which describes the conversion and which may be used (as a Mapping) to transform coordinate values in either direction. Otherwise it returns an empty shared pointer.
The same function may also be used to determine how to convert between two FrameSets (or between a Frame and a FrameSet, or vice versa). This mode is intended for use when (for example) two images have been calibrated by attaching a FrameSet to each. convert
might then be used to search for a celestial coordinate system that both images have in common, and the result could then be used to convert between the pixel coordinates of both images – having effectively used their celestial coordinate systems to align them.
When using FrameSets, there may be more than one possible intermediate coordinate system in which to perform the conversion (for instance, two FrameSets might both have celestial coordinates, detector coordinates, pixel coordinates, etc.). A comma-separated list of coordinate system domains may therefore be given which defines a priority order to use when selecting the intermediate coordinate system. The path used for conversion must go via an intermediate coordinate system whose Domain attribute matches one of the domains given. If conversion cannot be achieved using the first domain, the next one is considered, and so on, until success is achieved.
If the AlignSideBand attribute is non-zero, alignment occurs in the upper sideband expressed within the spectral system and standard of rest given by attributes AlignSystem and AlignStdOfRest
. If AlignSideBand
is zero, the two DSBSpecFrames are aligned as if they were simple SpecFrames (i.e. the SideBand is ignored).
This function applies to all Frames. Alignment occurs within the coordinate system given by attribute AlignSystem.
If either this object or to
is a FrameSet, then this method will attempt to convert from the coordinate system described by the current Frame of the "from" FrameSet to that described by the current Frame of the "to" FrameSet.
To achieve this, it will consider all of the Frames within each FrameSet as a possible way of reaching an intermediate coordinate system that can be used for the conversion. There is then the possibility that more than one conversion path may exist and, unless the choice is sufficiently restricted by the "domainlist" string, the sequence in which the Frames are considered can be important. In this case, the search for a conversion path proceeds as follows:
If conversion is possible, the Base attributes of the two FrameSets will be modified on exit to identify the Frames used to access the intermediate coordinate system which was finally accepted.
Note that it is possible to force a particular Frame within a FrameSet to be used as the basis for the intermediate coordinate system, if it is suitable, by (a) focussing attention on it by specifying its domain in the "domainlist" string, or (b) making it the base Frame, since this is always considered first.
Alignment occurs within the spectral system and standard of rest given by attributes AlignSystem and AlignStdOfRest
.
Alignment occurs within the time system and time scale given by attributes AlignSystem and AlignTimeScale
.
auto cvt = a.convert(b)
Obtain a FrameSet that converts between the coordinate systems represented by "a" and "b" (assumed to be Frames).
auto cvt = SkyFrame().convert(SkyFrame("Equinox=2005"))
Create a FrameSet which describes precession in the default FK5 celestial coordinate system between equinoxes J2000 (also the default) and J2005. The returned "cvt" FrameSet may be used to apply this precession correction to any number of coordinate values given in radians.
Note that the returned FrameSet also contains information about how to format coordinate values. This means that setting its Report attribute to 1 is a simple way to obtain printed output (formatted in sexagesimal notation) to show the coordinate values before and after conversion.
auto cvt = a.convert(b, "sky,detector,")
Create a FrameSet that converts between the coordinate systems represented by the current Frames of "a" and "b" (now assumed to be FrameSets), via the intermediate "SKY" coordinate system. This, by default, is the Domain associated with a celestial coordinate system represented by a SkyFrame.
If this fails (for example, because either FrameSet lacks celestial coordinate information), then the user-defined "DETECTOR" coordinate system is used instead. If this also fails, then all other possible ways of achieving conversion are considered before giving up.
The returned "cvt" FrameSet describes the conversion.
The Base attributes of the two FrameSet will be set by `ref convert to indicate which of their Frames was used for the intermediate coordinate system. This means that you can subsequently determine which coordinate system was used by enquiring the Domain attribute of either base Frame.
[in,out] | to | A Frame which represents the "destination" coordinate system. This is the coordinate system into which you wish to convert your coordinates. If a FrameSet is given, its current Frame (as determined by its Current attribute) is taken to describe the destination coordinate system. Note that the Base attribute of this FrameSet may be modified by this function to indicate which intermediate coordinate system was used. |
[in] | domainlist | A string containing a comma-separated list of Frame domains. This may be used to define a priority order for the different intermediate coordinate systems that might be used to perform the conversion. The function will first try to obtain a conversion by making use only of an intermediate coordinate system whose Domain attribute matches the first domain in this list. If this fails, the second domain in the list will be used, and so on, until conversion is achieved. A blank domain (e.g. two consecutive commas) indicates that all coordinate systems should be considered, regardless of their domains. |
|
inlineoverrideprotectedvirtual |
Return a deep copy of this object. This is called by copy.
Each subclass must override this method. The standard implementation is:
for example Frame implements this as:
Reimplemented from ast::Mapping.
Reimplemented in ast::FrameSet, ast::SpecFrame, ast::FrameDict, ast::SkyFrame, ast::TimeFrame, and ast::CmpFrame.
Find the distance between two points whose Frame coordinates are given.
The distance calculated is that along the geodesic curve that joins the two points. For example, in a basic Frame, the distance calculated will be the Cartesian distance along the straight line joining the two points. For a more specialised Frame describing a sky coordinate system, however, it would be the distance along the great circle passing through two sky positions.
[in] | point1 | The coordinates of the first point. |
[in] | point2 | The coordinates of the second point. |
std::shared_ptr< FrameSet > ast::Frame::findFrame | ( | Frame const & | tmplt, |
std::string const & | domainlist = "" |
||
) |
Find a coordinate system with specified characteristics.
Use a "template" Frame to search another Frame (or FrameSet) to identify a coordinate system which has a specified set of characteristics. If a suitable coordinate system can be found, the function returns a pointer to a FrameSet which describes the required coordinate system and how to convert coordinates to and from it.
This function is provided to help answer general questions about coordinate systems, such as typically arise when coordinate information is imported into a program as part of an initially unknown dataset. For example:
You can also use this function as a means of reconciling a user's preference for a particular coordinate system (for example, what type of axes to draw) with what is actually possible given the coordinate information available.
To perform a search, you supply a "target" Frame (or FrameSet) which represents the set of coordinate systems to be searched. If a basic Frame is given as the target, this set of coordinate systems consists of the one described by this Frame, plus all other "virtual" coordinate systems which can potentially be reached from it by applying built-in conversions (for example, any of the celestial coordinate conversions known to the AST library would constitute a "built-in" conversion). If a FrameSet is given as the target, the set of coordinate systems to be searched consists of the union of those represented by all the individual Frames within it.
To select from this large set of possible coordinate systems, you supply a "template" Frame which is an instance of the type of Frame you are looking for. Effectively, you then ask the function to "find a coordinate system that looks like this".
You can make your request more or less specific by setting attribute values for the template Frame. If a particular attribute is set in the template, then the function will only find coordinate systems which have exactly the same value for that attribute. If you leave a template attribute un-set, however, then the function has discretion about the value the attribute should have in any coordinate system it finds. The attribute will then take its value from one of the actual (rather than virtual) coordinate systems in the target. If the target is a FrameSet, its Current attribute will be modified to indicate which of its Frames was used for this purpose.
The result of this process is a coordinate system represented by a hybrid Frame which acquires some attributes from the template (but only if they were set) and the remainder from the target. This represents the "best compromise" between what you asked for and what was available. A Mapping is then generated which converts from the target coordinate system to this hybrid one, and the returned FrameSet encapsulates all of this information.
If the target is a FrameSet, the possibility exists that several of the Frames within it might be matched by the template. Unless the choice is sufficiently restricted by the "domainlist" string, the sequence in which Frames are searched can then become important. In this case, the search proceeds as follows:
If a suitable coordinate system is found, then the FrameSet's Current attribute will be modified to indicate which Frame was used to obtain attribute values which were not specified by the template. This Frame will, in some sense, represent the "closest" non-virtual coordinate system to the one you requested.
auto result = target.findFrame(ast::Frame(3))
Search for a 3-dimensional coordinate system in the target Frame (or FrameSet). No attributes have been set in the template Frame (created by ast::Frame), so no restriction has been placed on the required coordinate system, other than that it should have 3 dimensions. The first suitable Frame found will be returned as part of the "result" FrameSet.
auto result = target.findFrame(astSkyFrame())
Search for a celestial coordinate system in the target Frame (or FrameSet). The type of celestial coordinate system is unspecified, so astFindFrame will return the first one found as part of the "result" FrameSet. If the target is a FrameSet, then its Current attribute will be updated to identify the Frame that was used.
auto result = target.findFrame(astSkyFrame("MaxAxes=100"))
This is like the last example, except that in the event of the target being a CmpFrame, the component Frames encapsulated by the CmpFrame will be searched for a SkyFrame. If found, the returned Mapping will included a PermMap which selects the required axes from the target CmpFrame.
This is acomplished by setting the MaxAxes attribute of the template SkyFrame to a large number (larger than or equal to the number of axes in the target CmpFrame). This allows the SkyFrame to be used as a match for Frames containing from 2 to 100 axes.
auto result = target.findFrame(astSkyFrame("System=FK5"))
Search for an equatorial (FK5) coordinate system in the target. The Equinox
value for the coordinate system has not been specified, so will be obtained from the target. If the target is a FrameSet, its Current
attribute will be updated to indicate which SkyFrame was used to obtain this value.
auto result = target.findFrame(astFrame(2), "sky,pixel,")
Search for a 2-dimensional coordinate system in the target. Initially, a search is made for a suitable coordinate system whose Domain attribute has the value "SKY". If this search fails, a search is then made for one with the domain "PIXEL". If this also fails, then any 2-dimensional coordinate system is returned as part of the "result" FrameSet.
Only if no 2-dimensional coordinate systems can be reached by applying built-in conversions to any of the Frames in the target will the search fail.
auto result = target.findFrame(astFrame(1, "Domain=WAVELENGTH"))
Searches for any 1-dimensional coordinate system in the target which has the domain "WAVELENGTH".
auto result = target.findFrame(astFrame(1), "wavelength")
This example has exactly the same effect as that above. It illustrates the equivalence of the template's Domain attribute and the fields in the "domainlist" string.
auto result = target.findFrame(Frame(1, "MaxAxes=3"))
This is a more advanced example which will search for any coordinate system in the target having 1, 2 or 3 dimensions. The Frame returned (as part of the "result" FrameSet) will always be 1-dimensional, but will be related to the coordinate system that was found by a suitable Mapping (e.g. a PermMap) which simply extracts the first axis.
If we had wanted a Frame representing the actual (1, 2 or 3-dimensional) coordinate system found, we could set the PreserveAxes attribute to a non-zero value in the template.
auto result = target.findFrame(SkyFrame("Permute=0"))
Search for any celestial coordinate system in the target, but only finds one if its axes are in the conventional (longitude,latitude) order and have not been permuted (e.g. with astPermAxes).
A Frame (describing a coordinate system) will be found by this function if (a) it is "matched" by the template you supply, and (b) the value of its Domain attribute appears in the "domainlist" string (except that a blank field in this string permits any domain). A successful match by the template depends on a number of criteria, as outlined below:
[in,out] | tmplt | Template Frame, which should be an instance of the type of Frame you wish to find. If you wanted to find a Frame describing a celestial coordinate system, for example, then you might use a SkyFrame here. See the "Examples" section for more ideas. |
[in] | domainlist | String containing a comma-separated list of Frame domains. This may be used to establish a priority order for the different types of coordinate system that might be found. The function will first try to find a suitable coordinate system whose Domain attribute equals the first domain in this list. If this fails, the second domain in the list will be used, and so on, until a result is obtained. A blank domain (e.g. two consecutive commas) indicates that any coordinate system is acceptable (subject to the template) regardless of its domain. This list is case-insensitive and all white space is ignored. If you do not wish to restrict the domain in this way, you should supply an empty string. |
This FrameSet will contain two Frames. Frame number 1 (its base Frame) represents the target coordinate system and will be the same as the (base Frame of the) target. Frame number 2 (its current Frame) will be a Frame representing the coordinate system which the function found. The Mapping which inter-relates these two Frames will describe how to convert between their respective coordinate systems. Note that a FrameSet may be used both as a Mapping and as a Frame. If the result is used as a Mapping, then it provides a means of converting coordinates from the target coordinate system into the new coordinate system that was found (and vice versa if its inverse transformation is selected). If it is used as a Frame, its attributes will describe the new coordinate system.
tmpl
argument is not const because if it is a FrameSet then the BASE frame of the template may be changed. No other kind of frame will be altered.Domain
attribute of the template and then using a "domainlist" string which does not include the template's domain (or a blank field). If you do so, no coordinate system will be found.
|
inline |
Return a string containing the formatted (character) version of a coordinate value for a Frame axis.
The formatting applied is determined by the Frame's attributes and, in particular, by any Format attribute string that has been set for the axis. A suitable default format (based on the Digits attribute value) will be applied if necessary.
[in] | axis | The number of the Frame axis for which formatting is to be performed (axis numbering starts at 1 for the first axis). |
[in] | value | The coordinate value to be formatted. |
|
inline |
Get ActiveUnit: pay attention to units when one Frame is used to match another?
|
inline |
Get AlignSystem: the coordinate system used by convert and findFrame to align Frames
|
inline |
Get Bottom for one axis: the lowest axis value to display
|
inline |
Get Digits: the default used if no specific value specified for an axis
|
inline |
Get Digits for one axis
|
inline |
Get Direction for one axis: display axis in conventional direction?
|
inline |
Get Domain: coordinate system domain
|
inline |
Get Dut1: difference between the UT1 and UTC timescale (sec)
|
inline |
Get Epoch: Epoch of observation
|
inline |
Get Format for one axis: format specification for axis values.
|
inline |
Get InternalUnit(axis) read-only attribute for one axis: physical units for unformated axis values.
|
inline |
Get Label(axis) for one axis: axis label.
|
inline |
Get MatchEnd: match trailing axes?
|
inline |
|
inline |
|
inline |
|
inline |
Get NormUnit(axis) read-only attribute for one frame: normalised physical units for formatted axis values
|
inline |
Get ObsAlt: Geodetic altitude of observer (m).
|
inline |
Get ObsLat: Geodetic latitude of observer.
|
inline |
Get ObsLon: Geodetic longitude of observer.
|
inline |
Get Permute: allow axis permutation when used as a template?
|
inline |
Get PreserveAxes: preserve axes?
|
inline |
Get Symbol(axis) for one axis: axis symbol.
|
inline |
Get System: coordinate system used to describe positions within the domain.
|
inline |
Get Title: frame title.
|
inline |
Get Top: the highest axis value to display
|
inline |
Get Unit(axis) for one axis: physical units for formatted axis values.
std::vector< double > ast::Frame::intersect | ( | std::vector< double > const & | a1, |
std::vector< double > const & | a2, | ||
std::vector< double > const & | b1, | ||
std::vector< double > const & | b2 | ||
) | const |
Find the point of intersection between two geodesic curves.
For example, in a basic Frame, it will find the point of intersection between two straight lines. But for a SkyFrame it will find an intersection of two great circles.
[in] | a1 | Coordinates of the first point on the first geodesic curve. |
[in] | a2 | Coordinates of the second point on the first geodesic curve. |
[in] | b1 | Coordinates of the first point on the second geodesic curve. |
[in] | b2 | Coordinates of the second point on the second geodesic curve. |
std::runtime_error | if the frame is not 2-dimensional |
a1
.nan
coordinate values if any of the input coordinates is invalid, or if the two points defining either geodesic are coincident, or if the two curves do not intersect.
|
inline |
Look for corresponding axes between this frame and another.
[in] | other | The other frame |
other
. Axis indices start at 1. A value of zero will be stored in the returned array for each axis in other
that has no corresponding axis in this frame. The number of elements in the array will be the number of axes in other
.Normalise a set of Frame coordinate values which might be unsuitable for display (e.g. may lie outside the expected range) into a set of acceptable values suitable for display.
[in] | value | A point in the space which the Frame describes. |
value
. If any axes of value
lie outside the expected range for the Frame, the corresponding returned value is changed to a acceptable (normalised) value. Otherwise, the axes of value
are returned unchanged.norm
function of a specified Frame.Find the point which is offset a specified distance along the geodesic curve between two other points.
For example, in a basic Frame, this offset will be along the straight line joining two points. For a more specialised Frame describing a sky coordinate system, however, it would be along the great circle passing through two sky positions.
[in] | point1 | The point marking the start of the geodesic curve. |
[in] | point2 | The point marking the end of the geodesic curve. |
[in] | offset | The required offset from the first point along the geodesic curve. If this is positive, it will be towards the second point. If it is negative, it will be in the opposite direction. This offset need not imply a position lying between the two points given, as the curve will be extrapolated if necessary. |
distance
function.std::invalid_argument | if:
|
|
inline |
Find the point which is offset a specified distance along the geodesic curve at a given angle from a specified starting point. This can only be used with 2-dimensional Frames.
For example, in a basic Frame, this offset will be along the straight line joining two points. For a more specialised Frame describing a sky coordinate system, however, it would be along the great circle passing through two sky positions.
[in] | point1 | The point marking the start of the geodesic curve. |
[in] | angle | The angle (in radians) from the positive direction of the second axis, to the direction of the required position, as seen from the starting position. Positive rotation is in the sense of rotation from the positive direction of axis 2 to the positive direction of axis 1. |
[in] | offset | The required offset from the first point along the geodesic curve. If this is positive, it will be in the direction of the given angle. If it is negative, it will be in the opposite direction. |
std::invalid_argument | if
|
|
inline |
Permute the order in which a Frame's axes occur
[in] | perm | A list of axes in their new order, using the current axis numbering. Axis numbers start at 1 for the first axis. Only genuine permutations of the axis order are permitted, so each axis must be referenced exactly once. |
When used on a FrameSet, the axes of the current frame are permuted and all connecting mappings are updated accordingly, so that current behavior is preserved (except for the new axis order for output data).
FrameMapping ast::Frame::pickAxes | ( | std::vector< int > const & | axes | ) | const |
Create a new Frame whose axes are copied from an existing Frame along with other Frame attributes, such as its Title.
Any number (zero or more) of the original Frame's axes may be copied, in any order, and additional axes with default attributes may also be included in the new Frame.
[in] | axes | the axes to be copied. These should be given in the order required in the new Frame, using the axis numbering in the original Frame (which starts at 1 for the first axis). Axes may be selected in any order, but each may only be used once. If additional (default) axes are also to be included, the corresponding elements of this array should be set to zero. |
ResolvedPoint ast::Frame::resolve | ( | std::vector< double > const & | point1, |
std::vector< double > const & | point2, | ||
std::vector< double > const & | point3 | ||
) | const |
Resolve a vector into two orthogonal components
The vector from point 1 to point 2 is used as the basis vector. The vector from point 1 to point 3 is resolved into components parallel and perpendicular to this basis vector. The lengths of the two components are returned, together with the position of closest aproach of the basis vector to point 3.
[in] | point1 | The start of the basis vector, and of the vector to be resolved. |
[in] | point2 | The end of the basis vector. |
[in] | point3 | The end of the vector to be resolved. |
nan
coordinate values if any of the input coordinates are invalid, or if the required output values are undefined.
|
inline |
Set ActiveUnit: pay attention to units when one Frame is used to match another?
|
inline |
Set AlignSystem: the coordinate system used by convert and findFrame to align Frames
|
inline |
Set Bottom: the lowest axis value to display
|
inline |
Set Digits for all axes: number of digits of precision.
|
inline |
Set Digits for one axis: number of digits of precision.
|
inline |
Set Direction for one axis: display axis in conventional direction?
|
inlinevirtual |
Set Domain: coordinate system domain
Reimplemented in ast::FrameDict.
|
inline |
Set Dut1: difference between the UT1 and UTC timescale (sec)
|
inline |
Set Epoch: Epoch of observation as a double (years)
|
inline |
Set Epoch: Epoch of observation as a string
|
inline |
Set Format for one axis: format specification for axis values.
|
inline |
Set Label(axis) for one axis: axis label.
|
inline |
Set MatchEnd: match trailing axes?
|
inline |
|
inline |
|
inline |
Set ObsAlt: Geodetic altitude of observer (m).
|
inline |
Set ObsLat: frame title.
|
inline |
Set ObsLon: Geodetic longitude of observer.
|
inline |
Set Permute: allow axis permutation when used as a template?
|
inline |
Set PreserveAxes: preserve axes?
|
inline |
Set Symbol(axis) for one axis: axis symbol.
|
inline |
Set System: coordinate system used to describe positions within the domain.
|
inline |
Set Title: frame title.
|
inline |
Set Top for one axis: the highest axis value to display
|
inline |
Set Unit(axis) for one axis: physical units for formatted axis values.
Combine this frame with another to form a compound frame (CmpFrame), with the axes of this frame followed by the axes of the next
frame.
A compound frame allows two component Frames (of any class) to be merged together to form a more complex Frame. The axes of the two component Frames then appear together in the resulting CmpFrame (those of this Frame, followed by those of next
).
Since a CmpFrame is itself a Frame, it can be used as a component in forming further CmpFrames. Frames of arbitrary complexity may be built from simple individual Frames in this way.
Also since a Frame is a Mapping, a CmpFrame can also be used as a Mapping. Normally, a CmpFrame is simply equivalent to a UnitMap, but if either of the component Frames within a CmpFrame is a Region (a sub-class of Frame), then the CmpFrame will use the Region as a Mapping when transforming values for axes described by the Region. Thus input axis values corresponding to positions which are outside the Region will result in bad output axis values.
The name comes the way vectors are sometimes shown for matrix multiplication: vertically, with the first axis at the bottom and the last axis at the top.
[in] | next | The next frame in the compound frame (the final next.getNAxes() axes) |
|
inline |
Read a formatted coordinate value (given as a character string) for a Frame axis and return the number of characters read and the value.
The principle use of this function is in decoding user-supplied input which contains formatted coordinate values. Free-format input is supported as far as possible. If input is ambiguous, it is interpreted with reference to the Frame's attributes (in particular, the Format string associated with the Frame's axis).
This function is, in essence, the inverse of astFormat.
Applicability:
Frame This function applies to all Frames. See the "Frame Input Format" section below for details of the input formats accepted by a basic Frame.
SkyFrame The SkyFrame class re-defines the input format to be suitable for representing angles and times, with the resulting coordinate value returned in radians. See the "SkyFrame Input Format" section below for details of the formats accepted.
FrameSet The input formats accepted by a FrameSet are determined by its current Frame (as specified by the Current attribute).
Frame Input Format:
The input format accepted for a basic Frame axis is as follows:
Examples of acceptable Frame input formats include:
99
1.25
-1.6
1E8
-.99e-17
<bad>
SkyFrame Input Format:
The input format accepted for a SkyFrame axis is as follows:
This final convention is intended to ensure that values formatted by Frame.format which contain less than three fields will be correctly interpreted if read back using Frame.unformat, even if they do not contain field identification characters.
Examples of acceptable SkyFrame input formats (with interpretation in parentheses) include:
001 : 02 : 03.4
(1d 02' 03.4" or 1h 02m 03.4s)22h 30
(22h 30m 00s)136::10"</tt> (136d 00' 10" or 136h 00m 10s)
`-14M 27S` (-0d 14' 27" or -0h 14m 27s)
- <tt>-:14:</tt> (-0d 14' 00" or -0h 14m 00s)
`-::4.1` (-0d 00' 04.1" or -0h 00m 04.1s)
- <tt>.9"
(0d 00' 00.9")
- `d12m` (0d 12' 00")H 12:22.3s
(0h 12m 22.3s)<bad>
(AST__BAD
)Where alternative interpretations are shown, the choice of angle or time depends on the associated Format(axis) attribute.
[in] | axis | The number of the Frame axis for which the coordinate value is to be read (axis numbering starts at zero for the first axis). |
[in] | str | String containing the formatted coordinate value. |