hugin_math.h File Reference

misc math function & classes used by other parts of the program More...

#include <hugin_shared.h>
#include <cmath>
#include <math.h>
#include <iostream>
#include <vigra/diff2d.hxx>

Include dependency graph for hugin_math.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


namespace  hugin_utils


struct  hugin_utils::TDiff2D< T >


#define M_PI   3.14159265358979323846
#define PI   3.14159265358979323846
#define DEG_TO_RAD(x)   ( (x) * 2.0 * PI / 360.0 )
#define RAD_TO_DEG(x)   ( (x) * 360.0 / ( 2.0 * PI ) )


typedef TDiff2D< double > hugin_utils::FDiff2D


double log2 (double x)
double hugin_utils::round (double x)
float hugin_utils::roundf (float x)
int hugin_utils::ceili (double x)
int hugin_utils::floori (double x)
template<class T>
int hugin_utils::roundi (T x)
int hugin_utils::isnan (double x)
template<class T>
hugin_utils::simpleClipPoint (const T &point, const T &min, const T &max)
 clip a point to fit int [min, max] does not do a mathematical clipping, just sets p.x and p.y to the borders if they are outside.
template<class T>
hugin_utils::sqr (T t)
template<class T>
double hugin_utils::norm (T t)
template<class InputIterator1, class InputIterator2>
double hugin_utils::euclid_dist (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
 calculate squared Euclidean distance between two vectors.
template<class InputIterator1, class InputIterator2, class T>
hugin_utils::sqr_dist (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T res)
 calculate squared Euclidean distance between two vectors.
template<class POINT>
vigra::Rect2D hugin_utils::calcCircleROIFromPoints (const POINT &p1, const POINT &p2)
 calculate the bounding box of a circle that goes through both points.
template<class T>
std::ostreamoperator<< (std::ostream &o, const hugin_utils::TDiff2D< T > &d)
hugin_utils::FDiff2D operator/ (const hugin_utils::FDiff2D &lhs, double val)
vigra::Diff2D operator * (const vigra::Diff2D &d, double scale)
vigra::Rect2D operator * (const vigra::Rect2D &r, double scale)
 uses floor for left and top and ceil for right and bottom -> extend image when rounding..

Detailed Description

misc math function & classes used by other parts of the program

Pablo d'Angelo <>

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this software. If not, see <>.

Definition in file hugin_math.h.

Define Documentation

#define DEG_TO_RAD (  )     ( (x) * 2.0 * PI / 360.0 )

Definition at line 44 of file hugin_math.h.

Referenced by HuginLines::_getVerticalLines(), HuginBase::StraightenPanorama::calcStraighteningRotation(), HuginLines::FilterLines(), GetImageRotatedTo(), DragTool::getTranslationShift(), PlaneOverviewToolHelper::MouseMoved(), PanosphereOverviewToolHelper::MouseMoved(), PlaneOverviewCameraTool::MouseMoveEvent(), PreviewPanel::mousePressLMBEvent(), PreviewPanel::mousePressRMBEvent(), DragTool::ParamStore::Move(), PointFineTuneProjectionAware(), HuginBase::RotatePanorama::rotatePano(), HuginBase::RotatePanorama::RotatePanorama(), and DragTool::SetRotationMatrix().

#define M_PI   3.14159265358979323846

Definition at line 37 of file hugin_math.h.

#define PI   3.14159265358979323846

Definition at line 41 of file hugin_math.h.

#define RAD_TO_DEG (  )     ( (x) * 360.0 / ( 2.0 * PI ) )

Definition at line 45 of file hugin_math.h.

Referenced by GetImageRotatedTo(), PreviewPanel::mousePressLMBEvent(), PreviewPanel::mousePressRMBEvent(), DragTool::ParamStore::Move(), vigra_ext::PointFineTuneRotSearch(), and HuginBase::RotatePanorama::rotatePano().

Function Documentation

double log2 ( double  x  )  [inline]

Definition at line 51 of file hugin_math.h.

References vigra_ext::log().

Referenced by HuginBase::CalculateOptimalROI::autocrop(), TextureManager::CheckUpdate(), and TextureManager::GetMaxTextureSizePower().

vigra::Rect2D operator * ( const vigra::Rect2D &  r,
double  scale 
) [inline]

uses floor for left and top and ceil for right and bottom -> extend image when rounding..

Definition at line 300 of file hugin_math.h.

vigra::Diff2D operator * ( const vigra::Diff2D &  d,
double  scale 
) [inline]

Definition at line 283 of file hugin_math.h.

hugin_utils::FDiff2D operator/ ( const hugin_utils::FDiff2D lhs,
double  val 
) [inline]

Definition at line 277 of file hugin_math.h.

References hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

template<class T>
std::ostream& operator<< ( std::ostream o,
const hugin_utils::TDiff2D< T > &  d 
) [inline]

Definition at line 272 of file hugin_math.h.

Generated on 3 Aug 2015 for Hugintrunk by  doxygen 1.4.7