lsst.jointcal  14.0-27-ga47eb89
AstroUtils.cc
Go to the documentation of this file.
1 #include <math.h>
2 #include <iostream>
3 #include <fstream>
4 #include <stdio.h>
5 #include <string.h>
6 
9 #include "lsst/jointcal/Frame.h"
10 #include "lsst/jointcal/Gtransfo.h"
11 
12 namespace lsst {
13 namespace jointcal {
14 
15 Frame applyTransfo(const Frame& inputframe, const Gtransfo& gtransfo, const WhichTransformed which) {
16  // 2 opposite corners
17  double xtmin1, xtmax1, ytmin1, ytmax1;
18  gtransfo.apply(inputframe.xMin, inputframe.yMin, xtmin1, ytmin1);
19  gtransfo.apply(inputframe.xMax, inputframe.yMax, xtmax1, ytmax1);
20  Frame fr1(std::min(xtmin1, xtmax1), std::min(ytmin1, ytmax1), std::max(xtmin1, xtmax1),
21  std::max(ytmin1, ytmax1));
22  // 2 other corners
23  double xtmin2, xtmax2, ytmin2, ytmax2;
24  gtransfo.apply(inputframe.xMin, inputframe.yMax, xtmin2, ytmax2);
25  gtransfo.apply(inputframe.xMax, inputframe.yMin, xtmax2, ytmin2);
26  Frame fr2(std::min(xtmin2, xtmax2), std::min(ytmin2, ytmax2), std::max(xtmin2, xtmax2),
27  std::max(ytmin2, ytmax2));
28 
29  if (which == SmallFrame) return fr1 * fr2;
30  return fr1 + fr2;
31 }
32 } // namespace jointcal
33 } // namespace lsst
double xMin
coordinate of boundary.
Definition: Frame.h:22
T min(T... args)
rectangle with sides parallel to axes.
Definition: Frame.h:19
Class for a simple mapping implementing a generic Gtransfo.
T max(T... args)
WhichTransformed
Definition: Frame.h:13
a virtual (interface) class for geometric transformations.
Definition: Gtransfo.h:41
Frame applyTransfo(const Frame &inputframe, const Gtransfo &gtransfo, const WhichTransformed which)
Transform a Frame through a Transfo.
Definition: AstroUtils.cc:15
virtual void apply(const double xIn, const double yIn, double &xOut, double &yOut) const =0