42 auto rawCopy =
reinterpret_cast<AstMapping *
>(astCopy(
getRawPtr()));
44 assertOK(reinterpret_cast<AstObject *>(rawCopy));
46 return Object::fromAstObject<Mapping>(
reinterpret_cast<AstObject *
>(rawCopy),
false);
54 Array2D fit = ndarray::allocate(ndarray::makeVector(1 + nIn, nOut));
63 template <
typename Class>
65 if ((i < 0) || (i > 1)) {
67 os <<
"i =" << i <<
"; must be 0 or 1";
75 int series, invert1, invert2;
76 astDecompose(
getRawPtr(), &rawMap1, &rawMap2, &series, &invert1, &invert2);
81 astAnnul(reinterpret_cast<AstObject *>(rawMap1));
83 os <<
"This " <<
getClassName() <<
" is not a compound object";
88 AstMapping *retRawMap;
91 retRawMap =
reinterpret_cast<AstMapping *
>(astCopy(reinterpret_cast<AstObject *>(rawMap1)));
94 retRawMap =
reinterpret_cast<AstMapping *
>(astCopy(reinterpret_cast<AstObject *>(rawMap2)));
97 astAnnul(reinterpret_cast<AstObject *>(rawMap1));
98 astAnnul(reinterpret_cast<AstObject *>(rawMap2));
104 if (invert != astGetI(retRawMap,
"Invert")) {
105 astInvert(retRawMap);
109 return Object::fromAstObject<Class>(
reinterpret_cast<AstObject *
>(retRawMap), copy);
115 detail::assertEqual(from.getSize<0>(),
"from.size[0]", static_cast<std::size_t>(nFromAxes),
117 detail::assertEqual(to.getSize<0>(),
"to.size[0]", static_cast<std::size_t>(nToAxes),
"to coords");
119 int const nPts = from.getSize<1>();
122 astTranN(
getRawPtr(), nPts, nFromAxes, nPts, from.getData(),
static_cast<int>(doForward), nToAxes, nPts,
129 void Mapping::_tranGrid(
PointI const &lbnd,
PointI const &ubnd,
double tol,
int maxpix,
bool doForward,
135 detail::assertEqual(to.getSize<1>(),
"to.size[1]", static_cast<std::size_t>(nToAxes),
"to coords");
136 int const nPts = to.getSize<0>();
137 astTranGrid(
getRawPtr(), nFromAxes, lbnd.
data(), ubnd.
data(),
tol, maxpix,
static_cast<int>(doForward),
138 nToAxes, nPts, to.getData());
A series compound mapping where the first Mapping is used to transform the coordinates of each point ...
ndarray::Array< const double, 2, 2 > ConstArray2D
2D array of const double; typically used for lists of const points
AstObject const * getRawPtr() const
Get the raw AST pointer.
ndarray::Array< double, 2, 2 > Array2D
2D array of const double; typically used for lists of const points
AST wrapper classes and functions.
std::string getClassName() const
Get Class: the name of the class (e.g.
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.
SeriesMap then(Mapping const &next) const
Return a series compound mapping this(first(input)) containing shallow copies of the original...
std::shared_ptr< Class > decompose(int i, bool copy) const
Return a deep copy of one of the two component mappings.
Relationship invert(Relationship r)
Given the relationship between two sets A and B (i.e.
void astBadToNan(std::vector< double > &p)
Replace AST__BAD with a quiet NaN in a vector.
An abstract base class for objects which transform one set of coordinates to another.
std::shared_ptr< Mapping > inverted() const
Get an inverse mapping.
A parallel compound mapping where the first Mapping is used to transform the lower numbered coordinat...
std::shared_ptr< Mapping > copy() const
Return a deep copy of this object.
Array2D linearApprox(PointD const &lbnd, PointD const &ubnd, double tol) const
Compute a linear approximation to the forward transformation.
ParallelMap under(Mapping const &next) const
Return a parallel compound mapping containing shallow copies of the original.
int getNIn() const
Get NIn: the number of input axes.
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
int getNOut() const
Get NOut: the number of output axes.