LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
afw
11.0-2-g04d2804
src
cameraGeom
Orientation.cc
Go to the documentation of this file.
1
/*
2
* LSST Data Management System
3
* Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014 LSST Corporation.
4
*
5
* This product includes software developed by the
6
* LSST Project (http://www.lsst.org/).
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the LSST License Statement and
19
* the GNU General Public License along with this program. If not,
20
* see <http://www.lsstcorp.org/LegalNotices/>.
21
*/
22
23
#include "
lsst/afw/cameraGeom/Orientation.h
"
24
25
namespace
lsst {
26
namespace
afw {
27
namespace
cameraGeom {
28
29
Orientation::Orientation
(
30
geom::Point2D
const
fpPosition,
31
geom::Point2D
const
refPoint,
32
geom::Angle
const
yaw,
33
geom::Angle
const
pitch,
34
geom::Angle
const
roll
35
) :
36
_fpPosition(fpPosition),
37
_refPoint(refPoint),
38
_yaw(yaw),
39
_pitch(pitch),
40
_roll(roll),
41
_rotMat()
42
{
43
double
cosYaw = std::cos(
_yaw
);
44
double
sinYaw = std::sin(
_yaw
);
45
double
cosPitch = std::cos(
_pitch
);
46
double
sinPitch = std::sin(
_pitch
);
47
double
cosRoll = std::cos(
_roll
);
48
double
sinRoll = std::sin(
_roll
);
49
50
// This comes from the rotation matrix written down here:
51
// http://en.wikipedia.org/wiki/Euler_angles
52
// for Tait-Bryan angles Z_1Y_2X_3
53
// _rotMat = coeffA coeffB
54
// coeffD coeffE
55
_rotMat
<< cosYaw*cosPitch, cosYaw*sinPitch*sinRoll - cosRoll*sinYaw,
56
cosPitch*sinYaw, cosYaw*cosRoll + sinYaw*sinPitch*sinRoll;
57
58
}
59
61
int
Orientation::getNQuarter
()
const
{
62
float
yawDeg =
_yaw
.
asDegrees
();
63
while
(yawDeg < 0.) {
64
yawDeg += 360.;
65
}
66
return
std::floor
((yawDeg + 45.)/90.);
67
}
68
69
geom::AffineXYTransform
Orientation::makePixelFpTransform
(
70
geom::Extent2D
const
pixelSizeMm
71
)
const
{
72
// jacobian = coeffA*pixelSizeMmX, coeffB*pixelSizeMmY,
73
// coeffD*pixelSizeMmX, coeffE*pixelSizeMmY
74
Eigen::Matrix2d jacobian =
_rotMat
.array() \
75
* (Eigen::Vector2d::Ones() * pixelSizeMm.
asEigen
().transpose()).array();
76
77
Eigen::Vector2d refMm = pixelSizeMm.
asEigen
().array() *
_refPoint
.
asEigen
().array();
78
Eigen::Vector2d translation =
_fpPosition
.
asEigen
() - (
_rotMat
* refMm);
79
80
geom::AffineTransform
affineTransform =
geom::AffineTransform
(jacobian, translation);
81
return
geom::AffineXYTransform
(affineTransform);
82
}
83
84
geom::AffineXYTransform
Orientation::makeFpPixelTransform
(
85
geom::Extent2D
const
pixelSizeMm
86
)
const
{
87
return
geom::AffineXYTransform
(
makePixelFpTransform
(pixelSizeMm).getReverseTransform());
88
}
89
90
}}}
lsst::afw::cameraGeom::Orientation::makePixelFpTransform
geom::AffineXYTransform makePixelFpTransform(geom::Extent2D const pixelSizeMm) const
Generate an XYTransform from pixel to focal plane coordinates.
Definition:
Orientation.cc:69
Orientation.h
lsst::afw::cameraGeom::Orientation::_pitch
lsst::afw::geom::Angle _pitch
pitch
Definition:
Orientation.h:108
lsst::afw::geom::Extent< double, 2 >
lsst::afw::cameraGeom::Orientation::_roll
lsst::afw::geom::Angle _roll
roll
Definition:
Orientation.h:109
lsst::afw::cameraGeom::Orientation::Orientation
Orientation(geom::Point2D const fpPosition=geom::Point2D(0, 0), geom::Point2D const refPoint=geom::Point2D(-0.5,-0.5), geom::Angle const yaw=geom::Angle(0), geom::Angle const pitch=geom::Angle(0), geom::Angle const roll=geom::Angle(0))
Definition:
Orientation.cc:29
lsst::afw::geom::Angle::asDegrees
double asDegrees() const
Definition:
Angle.h:124
lsst::afw::geom::Point< double, 2 >
lsst::afw::geom::Angle
Definition:
Angle.h:104
lsst::afw::geom::AffineTransform
An affine coordinate transformation consisting of a linear transformation and an offset.
Definition:
AffineTransform.h:77
lsst::afw::cameraGeom::Orientation::makeFpPixelTransform
geom::AffineXYTransform makeFpPixelTransform(geom::Extent2D const pixelSizeMm) const
Generate an XYTransform from focal plane to pixel coordinates.
Definition:
Orientation.cc:84
lsst::afw::cameraGeom::Orientation::_yaw
lsst::afw::geom::Angle _yaw
yaw
Definition:
Orientation.h:107
lsst::afw::cameraGeom::Orientation::_refPoint
geom::Point2D _refPoint
reference point on detector
Definition:
Orientation.h:105
lsst::afw::geom::floor
Extent< int, N > floor(Extent< double, N > const &input)
lsst::afw::geom::CoordinateBase::asEigen
EigenVector const & asEigen() const
Return a fixed-size Eigen representation of the coordinate object.
Definition:
CoordinateBase.h:67
lsst::afw::cameraGeom::Orientation::_fpPosition
geom::Point2D _fpPosition
focal plane position of reference point on detector
Definition:
Orientation.h:104
lsst::afw::geom::AffineXYTransform
Wrap an AffineTransform.
Definition:
XYTransform.h:152
lsst::afw::cameraGeom::Orientation::getNQuarter
int getNQuarter() const
Return the number of quarter turns (rounded to the closest quarter)
Definition:
Orientation.cc:61
lsst::afw::cameraGeom::Orientation::_rotMat
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > _rotMat
Definition:
Orientation.h:113
Generated on Thu Sep 24 2015 02:29:16 for LSSTApplications by
1.8.5