coord_value
namespace nin {
template <coordsys_traits CT>
class coord_value;
}
A coord_value wraps a coordinate quantity together with the coordinate system it is
expressed in. This pairing prevents a common class of errors: accidentally mixing
coordinates from different coordinate systems without an explicit transformation.
Equality comparison is deliberately deleted — comparing the raw numbers of two
coord_value objects is meaningless unless they are in the same coordinate system, and the
library does not silently transform behind your back.
Constructors (6) and (7) are the converting constructors: they accept a target coordinate
system and an existing coord_value, internally calling mapCS() to transform the
quantity into the new system.
Member functions
(Constructor)
constructs a coordinate value
(Constructor)
constructs a coordinate value
|
(1) |
|
(2) |
|
(3) |
|
(4) |
|
(5) |
|
(6) |
|
(7) |
-
(1) Default constructor. In WCS with a default-constructed quantity.
-
(2)-(3) Copy and move.
-
(4)-(5) Constructs in a given coordinate system (or WCS) with an optional quantity.
-
(6)-(7) Transforms an existing
coord_valueinto a different coordinate system. Internally equivalent tomapCS(value.inCS(), cs)(value).
| Constructing from a bare quantity without a coordinate system is deleted — the coordinate system is always required. |
inCS
associated coordinate system
inCS
associated coordinate system
|
(1) |
Returns the coordinate system this value is expressed in.
qty
access the raw quantity
qty
access the raw quantity
|
(1) |
|
(2) |
-
(1) Returns a const reference to the underlying coordinate quantity.
-
(2) Returns a mutable reference, allowing direct modification.
map_to
transform to another coordinate system
map_to
transform to another coordinate system
|
(1) |
Returns a new coord_value in the target coordinate system.
Accepts a coordsys, WCS, or a chain of bridges followed by a target.
Equivalent to creating a coord_tf with mapCS() and applying it.