55 template <
typename Po
int,
typename Array>
63 template <
typename Po
int,
typename Array>
65 return this->getNAxes() ==
other.getNAxes() &&
typeid(*this) ==
typeid(
other);
68 template <
typename Po
int,
typename Array>
70 return std::make_shared<ast::Frame>(getNAxes());
73 template <
typename Po
int,
typename Array>
75 if (nAxes != this->getNAxes()) {
77 os <<
"number of axes provided " << nAxes <<
" != " << this->getNAxes() <<
" required";
82 template <
typename Po
int>
88 this->_assertNAxes(_getNAxes(point));
92 ndarray::Array<double, 2, 2> GenericEndpoint::dataFromArray(Array
const& arr)
const {
93 this->_assertNAxes(_getNAxes(arr));
94 return ndarray::copy(arr);
98 this->_assertNAxes(data.
size());
102 ndarray::Array<double, 2, 2> GenericEndpoint::arrayFromData(ndarray::Array<double, 2, 2>
const&
data)
const {
103 this->_assertNAxes(_getNAxes(data));
104 return ndarray::copy(data);
110 os <<
"nAxes = " << nAxes <<
" != 2";
118 for (
int axInd = 0; axInd < nAxes; ++axInd) {
119 result[axInd] = point[axInd];
127 ndarray::Array<double, 2, 2>
data = ndarray::allocate(ndarray::makeVector(nAxes, nPoints));
128 auto dataColIter = data.transpose().begin();
129 for (
auto const& point : arr) {
130 for (
int axInd = 0; axInd < nAxes; ++axInd) {
131 (*dataColIter)[axInd] = point[axInd];
142 for (
int axInd = 0; axInd < nAxes; ++axInd) {
143 result[axInd] = data[axInd];
152 array.reserve(nPoints);
153 for (
auto const& dataCol : data.transpose()) {
154 array.emplace_back(dataCol[0], dataCol[1]);
161 std::string className = getCurrentFrame(framePtr)->getClassName();
162 if (className !=
"Frame") {
164 os <<
"frame is a " << className <<
", not a Frame";
172 os <<
"nAxes = " << nAxes <<
" != 2";
180 for (
int axInd = 0; axInd < nAxes; ++axInd) {
181 result[axInd] = point[axInd].asRadians();
189 ndarray::Array<double, 2, 2>
data = ndarray::allocate(ndarray::makeVector(nAxes, nPoints));
190 auto dataColIter = data.transpose().begin();
191 for (
auto const& point : arr) {
192 for (
int axInd = 0; axInd < nAxes; ++axInd) {
193 (*dataColIter)[axInd] = point[axInd].asRadians();
206 ndarray::Array<double, 2, 2>
const&
data)
const {
210 array.reserve(nPoints);
211 for (
auto const& dataCol : data.transpose()) {
221 auto currentFramePtr = getCurrentFrame(framePtr);
225 os <<
"frame is a " << currentFramePtr->getClassName() <<
", not a SkyFrame";
228 if (skyFramePtr->getLonAxis() != 1) {
233 framePtr->permAxes(perm);
238 os <<
"GenericEndpoint(" << endpoint.
getNAxes() <<
")";
243 os <<
"Point2Endpoint()";
248 os <<
"SpherePointEndpoint()";
Point in an unspecified spherical coordinate system.
int _getNPoints(ndarray::Array< double, 2, 2 > const &data) const
std::ostream & operator<<(std::ostream &os, lsst::afw::geom::AffineTransform const &transform)
virtual Point pointFromData(std::vector< double > const &data) const override
Get a single point from raw data.
AngleUnit constexpr radians
constant with units of radians
virtual ndarray::Array< double, 2, 2 > dataFromArray(Array const &arr) const override
std::shared_ptr< Frame > getFrame(int iframe, bool copy=true) const
bool operator==(CoordKey const &lhs, CoordKey const &rhs)
Compare CoordKeys for equality using the constituent Keys.
Base class for endpoints with Array = std::vector<Point> where Point has 2 dimensions.
std::vector< Point2D > Array
ItemVariant const * other
static int constexpr CURRENT
void _assertNAxes(int nAxes) const
A coordinate class intended to represent absolute positions.
virtual Array arrayFromData(ndarray::Array< double, 2, 2 > const &data) const override
Get an array of points from raw data.
lsst::afw::geom::SpherePoint SpherePoint
virtual void normalizeFrame(std::shared_ptr< ast::Frame > framePtr) const override
Check that framePtr points to a SkyFrame and set longitude axis to 0, latitude to 1...
A base class for image defects.
A generic endpoint for data in the format used by ast::Mapping.
virtual std::vector< double > dataFromPoint(Point const &point) const override
An endpoint for SpherePoint.
T dynamic_pointer_cast(T... args)
SpherePointEndpoint()
Construct a SpherePointEndpoint.
virtual std::vector< double > dataFromPoint(Point const &point) const override
std::unique_ptr< SchemaItem< U > > result
virtual std::shared_ptr< ast::Frame > makeFrame() const override
Create a Frame that can be used with this end point in a Transform.
virtual int getNPoints(Array const &arr) const override
int _getNAxes(ndarray::Array< double, 2, 2 > const &data) const
#define LSST_EXCEPT(type,...)
virtual Array arrayFromData(ndarray::Array< double, 2, 2 > const &data) const override
Get an array of points from raw data.
virtual void normalizeFrame(std::shared_ptr< ast::Frame > framePtr) const override
Check that framePtr points to a Frame, not a subclass.
virtual Point pointFromData(std::vector< double > const &data) const override
Get a single point from raw data.
BaseEndpoint(BaseEndpoint const &)=default
virtual ndarray::Array< double, 2, 2 > dataFromArray(Array const &arr) const override
Virtual base class for endpoints, which are helper classes for Transform.