normalize_angle.h
Go to the documentation of this file.
00001 
00002 // Ceres Solver - A fast non-linear least squares minimizer
00003 // Copyright 2016 Google Inc. All rights reserved.
00004 // http://ceres-solver.org/
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //
00009 // * Redistributions of source code must retain the above copyright notice,
00010 //   this list of conditions and the following disclaimer.
00011 // * Redistributions in binary form must reproduce the above copyright notice,
00012 //   this list of conditions and the following disclaimer in the documentation
00013 //   and/or other materials provided with the distribution.
00014 // * Neither the name of Google Inc. nor the names of its contributors may be
00015 //   used to endorse or promote products derived from this software without
00016 //   specific prior written permission.
00017 //
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00022 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028 // POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // Author: vitus@google.com (Michael Vitus)
00031 #ifndef CERES_EXAMPLES_POSE_GRAPH_2D_NORMALIZE_ANGLE_H_
00032 #define CERES_EXAMPLES_POSE_GRAPH_2D_NORMALIZE_ANGLE_H_
00033 #include <cmath>
00034 #include "ceres/ceres.h"
00035 namespace ceres {
00036 namespace examples {
00037 // Normalizes the angle in radians between [-pi and pi).
00038 template <typename T>
00039 inline T NormalizeAngle(const T& angle_radians) {
00040   // Use ceres::floor because it is specialized for double and Jet types.
00041   T two_pi(2.0 * M_PI);
00042   return angle_radians -
00043       two_pi * ceres::floor((angle_radians + T(M_PI)) / two_pi);
00044 }
00045 }  // namespace examples
00046 }  // namespace ceres
00047 #endif  // CERES_EXAMPLES_POSE_GRAPH_2D_NORMALIZE_ANGLE_H_


hector_gps_calibration
Author(s):
autogenerated on Wed Sep 6 2017 02:41:37