46 auto frameSetPtr = std::dynamic_pointer_cast<ast::FrameSet>(framePtr);
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) {
149 ndarray::Array<double, 2, 2>
const&
data)
const {
153 array.reserve(nPoints);
154 for (
auto const& dataCol :
data.transpose()) {
155 array.emplace_back(dataCol[0], dataCol[1]);
162 std::string className = getCurrentFrame(framePtr)->getClassName();
163 if (className !=
"Frame") {
165 os <<
"frame is a " << className <<
", not a Frame";
173 os <<
"nAxes = " << nAxes <<
" != 2";
181 for (
int axInd = 0; axInd < nAxes; ++axInd) {
182 result[axInd] = point[axInd].asRadians();
190 ndarray::Array<double, 2, 2>
data = ndarray::allocate(ndarray::makeVector(nAxes, nPoints));
191 auto dataColIter =
data.transpose().begin();
192 for (
auto const& point : arr) {
193 for (
int axInd = 0; axInd < nAxes; ++axInd) {
194 (*dataColIter)[axInd] = point[axInd].asRadians();
207 ndarray::Array<double, 2, 2>
const&
data)
const {
211 array.reserve(nPoints);
212 for (
auto const& dataCol :
data.transpose()) {
219 return std::make_shared<ast::SkyFrame>();
224 auto currentFramePtr = getCurrentFrame(framePtr);
225 auto skyFramePtr = std::dynamic_pointer_cast<ast::SkyFrame>(currentFramePtr);
228 os <<
"frame is a " << currentFramePtr->getClassName() <<
", not a SkyFrame";
231 if (skyFramePtr->getLonAxis() != 1) {
241 os <<
"GenericEndpoint(" << endpoint.
getNAxes() <<
")";
246 os <<
"Point2Endpoint()";
251 os <<
"SpherePointEndpoint()";
256 template class BaseEndpoint<std::vector<double>, ndarray::Array<double, 2, 2>>;
257 template class BaseEndpoint<lsst::geom::Point2D, std::vector<lsst::geom::Point2D>>;
258 template class BaseEndpoint<lsst::geom::SpherePoint, std::vector<lsst::geom::SpherePoint>>;
260 template class BaseVectorEndpoint<lsst::geom::Point2D>;
261 template class BaseVectorEndpoint<lsst::geom::SpherePoint>;