<commit_before>// This file is part of OpenMVG, an Open Multiple View Geometry C++ library.

// Copyright (c) 2017 <Zillow Inc.> <NAME>

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef OPENMVG_CAMERAS_CAMERA_SPHERICAL_HPP
#define OPENMVG_CAMERAS_CAMERA_SPHERICAL_HPP

#include "openMVG/cameras/Camera_Intrinsics.hpp"

namespace openMVG
{
namespace cameras
{

/**
 * @brief Implement a Spherical camera model
 */
class Intrinsic_Spherical : public IntrinsicBase {

using class_type = Intrinsic_Spherical;

  public:

  /**
  * @brief Constructor
  * @param w Width of the image plane
  * @param h Height of the image plane
  */
  Intrinsic_Spherical
  (
    unsigned int w = 0,
    unsigned int h = 0
  )
  : IntrinsicBase(w, h)
  {
  }

  ~Intrinsic_Spherical() override = default;

  /**
  * @brief Tell from which type the embed camera is
  * @retval CAMERA_SPHERICAL
  */
  virtual EINTRINSIC getType() const override
  {
    return CAMERA_SPHERICAL;
  }

  /**
  * @brief Data wrapper for non linear optimization (get data)
  * @return an empty vector of parameter since a spherical camera does not have any intrinsic parameter
  */
  virtual std::vector<double> getParams() const override
  {
    return {};
  }

  /**
  * @brief Data wrapper for non linear optimization (update from data)
  * @param params List of params used to update this intrinsic
  * @retval true if update is correct
  * @retval false if there was an error during update
  */
  virtual bool updateFromParams(const std::vector<double> &params) override
  {
    return true;
  }

  /**
  * @brief Return the list of parameter indexes that must be held constant
  * @param parametrization The given parametrization
  */
  virtual std::vector<int> subsetParameterization
  (
    const Intrinsic_Parameter_Type & parametrization
  ) const override
  {
    return {};
  }

  /**
  * @brief Transform a point from the camera plane to the image plane
  * @param p Camera plane point
  * @return Point on image plane
  */
  virtual Vec2 cam2ima(const Vec2 &p) const override
  {
    const size_t size = std::max(w(), h());
    return {
      p.x() * size + w() / 2.0,
      p.y() * size + h() / 2.0 };
  }

  /**
  * @brief Transform a point from the image plane to the camera plane
  * @param p Image plane point
  * @return camera plane point
  */
  virtual Vec2 ima2cam(const Vec2 &p) const override
  {
    const size_t size = std::max(w(), h());
    return {
      (p.x() - w() / 2.0) / size,<commit_msg>[cameras] Cast image size to double.<commit_after>// This file is part of OpenMVG, an Open Multiple View Geometry C++ library.

// Copyright (c) 2017 <Zillow Inc.> <NAME>

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef OPENMVG_CAMERAS_CAMERA_SPHERICAL_HPP
#define OPENMVG_CAMERAS_CAMERA_SPHERICAL_HPP

#include "openMVG/cameras/Camera_Intrinsics.hpp"

namespace openMVG
{
namespace cameras
{

/**
 * @brief Implement a Spherical camera model
 */
class Intrinsic_Spherical : public IntrinsicBase {

using class_type = Intrinsic_Spherical;

  public:

  /**
  * @brief Constructor
  * @param w Width of the image plane
  * @param h Height of the image plane
  */
  Intrinsic_Spherical
  (
    unsigned int w = 0,
    unsigned int h = 0
  )
  : IntrinsicBase(w, h)
  {
  }

  ~Intrinsic_Spherical() override = default;

  /**
  * @brief Tell from which type the embed camera is
  * @retval CAMERA_SPHERICAL
  */
  virtual EINTRINSIC getType() const override
  {
    return CAMERA_SPHERICAL;
  }

  /**
  * @brief Data wrapper for non linear optimization (get data)
  * @return an empty vector of parameter since a spherical camera does not have any intrinsic parameter
  */
  virtual std::vector<double> getParams() const override
  {
    return {};
  }

  /**
  * @brief Data wrapper for non linear optimization (update from data)
  * @param params List of params used to update this intrinsic
  * @retval true if update is correct
  * @retval false if there was an error during update
  */
  virtual bool updateFromParams(const std::vector<double> &params) override
  {
    return true;
  }

  /**
  * @brief Return the list of parameter indexes that must be held constant
  * @param parametrization The given parametrization
  */
  virtual std::vector<int> subsetParameterization
  (
    const Intrinsic_Parameter_Type & parametrization
  ) const override
  {
    return {};
  }

  /**
  * @brief Transform a point from the camera plane to the image plane
  * @param p Camera plane point
  * @return Point on image plane
  */
  virtual Vec2 cam2ima(const Vec2 &p) const override
  {
    const double size(std::max(w(), h()));
    return {
      p.x() * size + w() / 2.0,
      p.y() * size + h() / 2.0 };
  }

  /**
  * @brief Transform a point from the image plane to the camera plane
  * @param p Image plane point
  * @return camera plane point
  */
  virtual Vec2 ima2cam(const Vec2 &p) const override
  {
    const double size(std::max(w(), h()));
    return {
      (p.x() - w() / 2.0) / size,
{'fraction_non_alphanumeric': 0.09783223374175307, 'fraction_numerical': 0.008294062205466541, 'mean_word_length': 3.122766122766123, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2221369', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1641, 'n_words': 616}