Reuse constants

Change-Id: I306da23d26667e801cfa4fb12306cdd92af09a65
This commit is contained in:
Sergiu Deitsch
2025-06-08 19:19:00 +02:00
parent 93e66f0d94
commit 6f00e41111
3 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2023 Google Inc. All rights reserved.
// Copyright 2025 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -85,6 +85,7 @@
#include "absl/log/initialize.h"
#include "absl/log/log.h"
#include "ceres/ceres.h"
#include "ceres/constants.h"
#include "ceres/tiny_solver.h"
#include "ceres/tiny_solver_cost_function_adapter.h"
@@ -423,8 +424,7 @@ NIST_BEGIN(Misra1d)
b[0] * b[1] * x / (1.0 + b[1] * x)
NIST_END
const double kPi = 3.141592653589793238462643383279;
// pi = 3.141592653589793238462643383279E0
constexpr double kPi = ceres::constants::pi;
// y = b1 - b2*x - arctan[b3/(x-b4)]/pi + e
NIST_BEGIN(Roszman1)
b[0] - b[1] * x - atan2(b[2], (x - b[3])) / kPi
+1 -1
View File
@@ -702,7 +702,7 @@ inline void EulerAnglesToRotationMatrix(const T* euler,
template <typename T, int row_stride, int col_stride>
void EulerAnglesToRotationMatrix(
const T* euler, const MatrixAdapter<T, row_stride, col_stride>& R) {
const double kPi = 3.14159265358979323846;
const double kPi = constants::pi;
const T degrees_to_radians(kPi / 180.0);
const T pitch(euler[0] * degrees_to_radians);
@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2023 Google Inc. All rights reserved.
// Copyright 2025 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "ceres/autodiff_cost_function.h"
#include "ceres/constants.h"
#include "ceres/cost_function.h"
#include "ceres/dense_qr_solver.h"
#include "ceres/dense_sparse_matrix.h"
@@ -388,9 +389,8 @@ class CurveCostFunction : public CostFunction {
TEST(TrustRegionMinimizer, JacobiScalingTest) {
int N = 6;
std::vector<double*> y(N);
const double pi = 3.1415926535897932384626433;
for (int i = 0; i < N; i++) {
double theta = i * 2. * pi / static_cast<double>(N);
double theta = i * 2. * constants::pi / static_cast<double>(N);
y[i] = new double[2];
y[i][0] = cos(theta);
y[i][1] = sin(theta);