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:

Include dependency graph

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

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  hugin_utils

Classes

struct  hugin_utils::TDiff2D< T >

Defines

#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 ) )

Typedefs

typedef TDiff2D< double > FDiff2D

Functions

double log2 (double x)
double round (double x)
float roundf (float x)
int ceili (double x)
int floori (double x)
template<class T>
int roundi (T x)
int isnan (double x)
template<class T>
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>
sqr (T t)
template<class T>
double norm (T t)
template<class InputIterator1, class InputIterator2>
double euclid_dist (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
 calculate squared Euclidean distance between two vectors.
template<class InputIterator1, class InputIterator2, class T>
sqr_dist (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T res)
 calculate squared Euclidean distance between two vectors.
template<class POINT>
vigra::Rect2D 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

Author:
Pablo d'Angelo <pablo.dangelo@web.de>
$Id$

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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

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(), DragTool::getTranslationShift(), HuginBase::Nona::SpaceTransform::Init(), HuginBase::Nona::SpaceTransform::InitInv(), PlaneOverviewToolHelper::MouseMoved(), PanosphereOverviewToolHelper::MouseMoved(), PlaneOverviewCameraTool::MouseMoveEvent(), PreviewPanel::mousePressLMBEvent(), PreviewPanel::mousePressRMBEvent(), DragTool::ParamStore::Move(), MainFrame::OnFineTuneAll(), CPEditorPanel::PointFineTune(), 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 PreviewPanel::mousePressLMBEvent(), PreviewPanel::mousePressRMBEvent(), DragTool::ParamStore::Move(), vigra_ext::PointFineTuneRotSearch(), and HuginBase::RotatePanorama::rotatePano().


Typedef Documentation

typedef TDiff2D<double> hugin_utils::FDiff2D
 

Definition at line 183 of file hugin_math.h.

Referenced by AddGeometricControlPoint(), HuginBase::MaskPolygon::addPoint(), HuginBase::angle_between(), HuginBase::Photometric::InvResponseTransform< VTIn, VTOut >::apply(), HuginBase::Photometric::ResponseTransform< VTIn >::apply(), ApplyLensDBParameters(), vigra_ext::applyMask(), PreviewColorPickerTool::CalcCorrection(), HuginBase::CalculateFOV::calcFOV(), PT::Panorama::calcFOV(), HuginBase::CalculateOptimalScale::calcOptimalPanoScale(), HuginBase::Photometric::ResponseTransform< VTIn >::calcVigFactor(), DisplayedControlPoint::CheckSelection(), vigra_ext::circularCrop(), HuginBase::clip_getIntersection(), HuginBase::clip_getIntersectionCircle(), HuginBase::clip_insideCircle(), HuginBase::clip_isSide(), HuginBase::clip_onPlane(), HuginBase::MaskPolygon::clipPolygon(), MeshManager::MeshInfo::Coord3D::Coord3D(), CPEvent::CPEvent(), CPEditorPanel::CreateNewPoint(), TextureManager::TextureInfo::DefineLevels(), GreatCircleArc::LineSegment::doGL(), GreatCircleArc::LineSegment::doGLcross(), DisplayedControlPoint::Draw(), MaskImageCtrl::DrawCrop(), DisplayedControlPoint::DrawLine(), DisplayedControlPoint::DrawLineSegment(), OverviewOutlinesTool::DrawRect(), CPImageCtrl::DrawSelectionRectangle(), DisplayedControlPoint::DrawTextMag(), CPEditorPanel::estimateAndAddOtherPoint(), HuginBase::estimateImageAlpha(), CPEditorPanel::EstimatePoint(), vigra_ext::extractRandomPoints(), HuginBase::MaskPolygon::FindPointNearPos(), MaskImageCtrl::FindPolygon(), CPEditorPanel::FineTuneNewPoint(), CPEditorPanel::FineTuneSelectedPoint(), HuginBase::CalculateFitPanorama::fitPano(), HuginBase::generateArc(), CPImageCtrl::generateMagBitmap(), PreviewMeshManager::GetCoord3D(), PlaneOverviewMeshManager::GetCoord3D(), PanosphereOverviewMeshManager::GetCoord3D(), MeshManager::PreviewMeshInfo::GetCoord3D(), MeshManager::PlaneOverviewMeshInfo::GetCoord3D(), MeshManager::PanosphereOverviewMeshInfo::GetCoord3D(), HuginBase::getCPinMasks(), HuginBase::LensDB::LensDB::GetCrop(), PreviewLayoutLinesTool::LineDetails::getDistance(), HuginLines::GetFootpoint(), ToolHelper::GetMousePanoPosition(), ToolHelper::GetMouseScreenPosition(), CPImageCtrl::getNewPoint(), CPEvent::getPoint(), DisplayedControlPoint::GetPos(), HuginBase::CalculateFOV::getResultFOV(), HuginBase::MaskPolygon::getTotalWindingNumber(), HuginBase::PanoramaOptions::getVFOV(), HuginBase::MaskPolygon::getWindingNumber(), GreatCircleArc::GreatCircleArc(), HuginBase::Nona::SpaceTransform::InitRadialCorrect(), HuginBase::MaskPolygon::insertPoint(), CPImageCtrl::invScale(), MaskImageCtrl::invtransform(), HuginBase::MaskPolygon::isInside(), CPImageCtrl::isOccupied(), DisplayedControlPoint::isOccupiedPos(), CPEditorPanel::LocalFineTunePoint(), main(), PanosphereOverviewCameraTool::MouseButtonEvent(), DragTool::MouseButtonEvent(), PanosphereOverviewCameraTool::MouseMoveEvent(), DragTool::MouseMoveEvent(), CPImageCtrl::mouseMoveEvent(), CPImageCtrl::mousePressLMBEvent(), CPImageCtrl::mousePressRMBEvent(), CPImageCtrl::mouseReleaseLMBEvent(), CPImageCtrl::mouseReleaseRMBEvent(), HuginBase::MaskPolygon::movePointBy(), HuginBase::MaskPolygon::movePointTo(), CPEditorPanel::NewPointChange(), CPEditorPanel::OnCPEvent(), MaskImageCtrl::OnDraw(), CPImageCtrl::OnDraw(), CPImageCtrl::OnKey(), MaskImageCtrl::OnLeftMouseDblClick(), MaskImageCtrl::OnLeftMouseDown(), MaskImageCtrl::OnLeftMouseUp(), HFOVDialog::OnLoadLensParameters(), CPImageCtrl::OnMouseLeave(), MaskImageCtrl::OnMouseMove(), MaskImageCtrl::OnRightMouseDown(), MaskImageCtrl::OnRightMouseUp(), ImageVariableDialog::OnShowDistortionGraph(), ImageVariableDialog::OnShowResponseGraph(), ImageVariableDialog::OnShowVignettingGraph(), HuginBase::Photometric::InvResponseTransform< VTIn, VTOut >::operator()(), HuginBase::Photometric::ResponseTransform< VTIn >::operator()(), vigra_ext::PassThroughFunctor< T >::operator()(), hugin_utils::TRANSFORM::InvRotERect::operator()(), hugin_utils::TRANSFORM::Translate::operator()(), hugin_utils::TRANSFORM::RotERect::operator()(), hugin_utils::TRANSFORM::ImgToCart::operator()(), hugin_utils::TRANSFORM::CartToImg::operator()(), hugin_utils::TRANSFORM::RectToERect::operator()(), hugin_utils::TRANSFORM::ERectToRect::operator()(), operator/(), PosMap::operator[](), HuginBase::MaskPolygon::parsePolygonString(), CPEditorPanel::PointFineTune(), vigra_ext::PointFineTuneRotSearch(), vigra_ext::PointPairT< VALUE >::PointPairT(), vigra_ext::radialVigCorrection(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::remapImage(), resetValues(), HuginBase::MaskPolygon::rotate90(), hugin_utils::TRANSFORM::rotatePoint(), vigra_ext::RotateTransform::RotateTransform(), CPImageCtrl::roundP(), HuginBase::AllPointSampler::sampleAllPanoPoints(), HuginBase::RandomPointSampler::sampleRandomPanoPoints(), HuginBase::LensDB::LensDB::SaveCrop(), SaveLensParameters(), OptimData::SaveToImgs(), CPImageCtrl::scale(), MaskImageCtrl::SelectPointsInsideMouseRect(), MaskImageCtrl::setCrop(), MaskEditorPanel::setImage(), CPImageCtrl::setNewPoint(), HuginBase::PTOVariableConverterFDiff2D< code_x1, code_y1, code_x2, code_y2 >::setValueFromVariable(), HuginBase::PanoramaOptions::setVFOV(), DisplayedControlPoint::ShiftControlPoint(), CPImageCtrl::showPosition(), CPImageCtrl::showSearchArea(), HuginBase::SmartOptimise::smartOptimize(), sortByDistance(), GreatCircleArc::LineSegment::squareDistance(), GreatCircleArc::squareDistance(), DisplayedControlPoint::StartLineControlPoint(), HuginBase::MaskPolygon::subSample(), HuginBase::PTools::Transform::transform(), HuginBase::Nona::SpaceTransform::transform(), MaskImageCtrl::transform(), vigra_ext::transformImageAlphaIntern(), vigra_ext::transformImageIntern(), HuginBase::Nona::SpaceTransform::transformImgCoord(), HuginBase::PTools::Transform::transformImgCoord(), HuginBase::MaskPolygon::transformPolygon(), DisplayedControlPoint::UpdateControlPoint(), MaskImageCtrl::UpdateCrop(), ImagesTreeCtrl::UpdateGroupText(), and ImagesTreeCtrl::UpdateImageText().


Function Documentation

template<class POINT>
vigra::Rect2D calcCircleROIFromPoints const POINT &  p1,
const POINT &  p2
 

calculate the bounding box of a circle that goes through both points.

the center of the circle is halfway between the two points

Definition at line 250 of file hugin_math.h.

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

int ceili double  x  )  [inline]
 

Definition at line 84 of file hugin_math.h.

Referenced by HuginBase::estimateImageAlpha().

template<class InputIterator1, class InputIterator2>
double euclid_dist InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2
 

calculate squared Euclidean distance between two vectors.

Definition at line 216 of file hugin_math.h.

int floori double  x  )  [inline]
 

Definition at line 89 of file hugin_math.h.

Referenced by HuginBase::CalculateCPStatisticsRadial::calcCtrlPntsRadiStats(), and HuginBase::estimateImageAlpha().

int isnan double  x  )  [inline]
 

Definition at line 104 of file hugin_math.h.

Referenced by vigra_ext::subpixelMaxima().

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().

template<class T>
double norm t  ) 
 

Definition at line 208 of file hugin_math.h.

Referenced by HuginBase::CalculateOptimalScale::calcOptimalPanoScale(), HuginBase::MaskPolygon::FindPointNearPos(), HuginBase::AllPointSampler::sampleAllPanoPoints(), HuginBase::RandomPointSampler::sampleRandomPanoPoints(), and HuginBase::MaskPolygon::subSample().

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::FDiff2D, 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.

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

double hugin_utils::round double  x  )  [inline]
 

Definition at line 72 of file hugin_math.h.

Referenced by PreviewPanel::updatePreview().

float hugin_utils::roundf float  x  )  [inline]
 

Definition at line 79 of file hugin_math.h.

template<class T>
int roundi x  )  [inline]
 

Definition at line 97 of file hugin_math.h.

Referenced by vigra_ext::ApplyGammaFunctor< vigra::UInt16, vigra::UInt8 >::ApplyGammaFunctor(), hugin_utils::calcCircleROIFromPoints(), PT::Panorama::calcOptimalWidth(), correctImage(), CPEvent::CPEvent(), HuginBase::AssistantMakefilelibExport::createItems(), RunStitchPanel::DetectProject(), MaskEditorPanel::DisplayCrop(), PanoPanel::DoCalcFOV(), DisplayedControlPoint::Draw(), DisplayedControlPoint::DrawLine(), DisplayedControlPoint::DrawLineSegment(), PreviewPanel::DrawOutline(), LensCalImageCtrl::DrawView(), CPEditorPanel::FineTuneSelectedPoint(), HuginBase::CalculateOptimalScale::getResultOptimalWidth(), loadPoints(), loadPointsC(), main(), CPImageCtrl::mouseMoveEvent(), CPEditorPanel::OnCPEvent(), CPImageCtrl::OnDraw(), MainFrame::OnFineTuneAll(), PreviewFrame::OnFitPano(), GLPreviewFrame::OnFitPano(), LensCalImageCtrl::OnMouseEvent(), PreviewFrame::panoramaChanged(), GLPreviewFrame::panoramaChanged(), print_result(), LensCalImageCtrl::Resize(), MainFrame::RunAssistant(), HuginBase::PointSampler::sampleAndExtractPoints(), HuginBase::PanoramaOptions::setWidth(), CPImageCtrl::showPosition(), hugin_utils::TDiff2D< double >::toDiff2D(), MaskImageCtrl::UpdateCrop(), and AppBase::StreamProgressDisplay::updateProgressDisplay().

template<class T>
T 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.

Definition at line 191 of file hugin_math.h.

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

Referenced by vigra_ext::PointFineTune(), and PointFineTune2().

template<class T>
T sqr t  ) 
 

Definition at line 202 of file hugin_math.h.

Referenced by HuginBase::MaskPolygon::FindPointNearPos(), HuginLines::GetFootpoint(), MaskImageCtrl::OnLeftMouseUp(), MaskImageCtrl::OnRightMouseUp(), vigra_ext::optimizeVignettingQuotient(), HuginBase::AllPointSampler::sampleAllPanoPoints(), HuginBase::RandomPointSampler::sampleRandomPanoPoints(), VertexCoordRemapper::SetLengthAndAngle(), and MaskImageCtrl::UpdateCrop().

template<class InputIterator1, class InputIterator2, class T>
T sqr_dist InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
res
 

calculate squared Euclidean distance between two vectors.

Definition at line 233 of file hugin_math.h.


Generated on Wed Jul 16 01:25:43 2014 for Hugintrunk by  doxygen 1.3.9.1