1 /******************************************************************************
2 * Copyright (c) 2015, Peter J. Gadomski <pete.gadomski@gmail.com>
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following
8 * conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided
15 * with the distribution.
16 * * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the
17 * names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior
19 * written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
32 * OF SUCH DAMAGE.
33 ****************************************************************************/
34
35 #pragma once
36
37 #include "pdal_util_export.hpp"
38
39 namespace pdal
40 {
41 namespace georeference
42 {
43
44 struct Xyz
45 {
Xyzpdal::georeference::Xyz46 Xyz(double x, double y, double z)
47 : X(x)
48 , Y(y)
49 , Z(z)
50 {
51 }
52
53 double X;
54 double Y;
55 double Z;
56 };
57
58
59 struct RotationMatrix
60 {
61 // Row-major
RotationMatrixpdal::georeference::RotationMatrix62 RotationMatrix(double m00, double m01, double m02, double m10, double m11,
63 double m12, double m20, double m21, double m22)
64 : m00(m00)
65 , m01(m01)
66 , m02(m02)
67 , m10(m10)
68 , m11(m11)
69 , m12(m12)
70 , m20(m20)
71 , m21(m21)
72 , m22(m22)
73 {
74 }
75
76 double m00, m01, m02, m10, m11, m12, m20, m21, m22;
77 };
78
79
createIdentityMatrix()80 inline RotationMatrix createIdentityMatrix()
81 {
82 return RotationMatrix(1, 0, 0, 0, 1, 0, 0, 0, 1);
83 }
84
85 // Returns Latitude, Longitude, Height triplet with angles in radians
86 PDAL_DLL Xyz georeferenceWgs84(double range, double scanAngle,
87 const RotationMatrix& boresightMatrix,
88 const RotationMatrix& imuMatrix, const Xyz& gpsPoint);
89
90 } // namespace georeference
91 } // namespace pdal
92
93