MathTools.h
Go to the documentation of this file.
1 // *****************************************************************
2 // Filename: MathTools.h
3 // Copyright: Kai Welke, Chair Prof. Dillmann (IAIM),
4 // Institute for Computer Science and Engineering (CSE),
5 // University of Karlsruhe. All rights reserved.
6 // Author: Kai Welke
7 // Date: 12.06.2007
8 // *****************************************************************
9 
10 #pragma once
11 
12 // *****************************************************************
13 // defines
14 // *****************************************************************
15 #include <math.h>
16 #ifndef M_PI
17 #define M_PI 3.141592653589793
18 #endif
19 
20 // *****************************************************************
21 // includes
22 // *****************************************************************
23 #include <Eigen/Core>
24 #include <Eigen/Geometry>
25 
26 #include "Structs.h"
27 
28 // *****************************************************************
29 // class MathTools
30 // *****************************************************************
31 class MathTools
32 {
33 public:
34  // transformation of coordinates and paths
36  static TPath* transformPath(TTransform transform, TPath* pPath);
38 
40  TSphereCoord start2,
41  TSphereCoord end1,
42  TSphereCoord end2);
45 
47  TSphereCoord sc2,
48  float& fAlpha,
49  float& fBeta,
50  Eigen::Vector3d& betaAxis);
51  static TSphereCoord
52  transformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis);
53  static TSphereCoord
54  inverseTransformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis);
55 
56  // calculations on sphere coordimates
57  static float
59  static float getDistanceOnArc(TSphereCoord p1, TSphereCoord p2);
60  static float getDistance(TSphereCoord p1, TSphereCoord p2, float fRadius);
61 
62  // extended 2d math
63  static bool IntersectLines(Eigen::Vector2d p1,
64  Eigen::Vector2d m1,
65  Eigen::Vector2d p2,
66  Eigen::Vector2d m2,
67  Eigen::Vector2d& res);
68 
69  // extended 3d math
70  static Eigen::Vector3d dropAPerpendicular(Eigen::Vector3d point,
71  Eigen::Vector3d linepoint,
72  Eigen::Vector3d linevector);
73  static float
74  AngleAndDirection(Eigen::Vector3d vector1, Eigen::Vector3d vector2, Eigen::Vector3d normal);
75 
76  // coorrdinate conversion
77  static void convert(TSphereCoord in, Eigen::Vector3d& out);
78  static void convert(TSphereCoord in, Eigen::Vector3f& out);
79  static void convert(Eigen::Vector3d in, TSphereCoord& out);
80  static void convert(Eigen::Vector3f in, TSphereCoord& out);
81  static void convertWithDistance(TSphereCoord in, Eigen::Vector3d& out);
82 
83  static double Angle(Eigen::Vector3d vec1, Eigen::Vector3d vec2);
84 };
MathTools::transformAlphaBeta
static TSphereCoord transformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis)
Definition: MathTools.cpp:231
MathTools::determineTransformationAlphaBeta
static void determineTransformationAlphaBeta(TSphereCoord sc1, TSphereCoord sc2, float &fAlpha, float &fBeta, Eigen::Vector3d &betaAxis)
Definition: MathTools.cpp:168
GfxTL::vec2
VectorXD< 2, float > vec2
Definition: VectorXD.h:724
MathTools
Definition: MathTools.h:31
MathTools::inverseTransformAlphaBeta
static TSphereCoord inverseTransformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis)
Definition: MathTools.cpp:253
MathTools::AngleAndDirection
static float AngleAndDirection(Eigen::Vector3d vector1, Eigen::Vector3d vector2, Eigen::Vector3d normal)
Definition: MathTools.cpp:385
MathTools::convertWithDistance
static void convertWithDistance(TSphereCoord in, Eigen::Vector3d &out)
Definition: MathTools.cpp:466
Structs.h
TTransform
Definition: Structs.h:43
MathTools::determineTransformation
static TTransform determineTransformation(TSphereCoord start1, TSphereCoord start2, TSphereCoord end1, TSphereCoord end2)
Definition: MathTools.cpp:85
MathTools::inverseTransform
static TSphereCoord inverseTransform(TSphereCoord sc, TTransform transform)
Definition: MathTools.cpp:148
MathTools::determinePathTransformation
static TTransform determinePathTransformation(TPath *p1, TPath *p2)
Definition: MathTools.cpp:25
MathTools::CalculateCrossProductFromDifference
static float CalculateCrossProductFromDifference(TSphereCoord p1, TSphereCoord p2, TSphereCoord p3)
Definition: MathTools.cpp:281
MathTools::getDistance
static float getDistance(TSphereCoord p1, TSphereCoord p2, float fRadius)
Definition: MathTools.cpp:321
MathTools::transform
static TSphereCoord transform(TSphereCoord sc, TTransform transform)
Definition: MathTools.cpp:127
MathTools::transformPath
static TPath * transformPath(TTransform transform, TPath *pPath)
Definition: MathTools.cpp:37
GfxTL::vec1
VectorXD< 1, float > vec1
Definition: VectorXD.h:723
MathTools::IntersectLines
static bool IntersectLines(Eigen::Vector2d p1, Eigen::Vector2d m1, Eigen::Vector2d p2, Eigen::Vector2d m2, Eigen::Vector2d &res)
Definition: MathTools.cpp:337
MathTools::Angle
static double Angle(Eigen::Vector3d vec1, Eigen::Vector3d vec2)
Definition: MathTools.cpp:294
MathTools::inverseTransformPath
static TPath * inverseTransformPath(TTransform transform, TPath *pPath)
Definition: MathTools.cpp:61
MathTools::getDistanceOnArc
static float getDistanceOnArc(TSphereCoord p1, TSphereCoord p2)
Definition: MathTools.cpp:302
TSphereCoord
Definition: Structs.h:23
MathTools::convert
static void convert(TSphereCoord in, Eigen::Vector3d &out)
Definition: MathTools.cpp:440
MathTools::dropAPerpendicular
static Eigen::Vector3d dropAPerpendicular(Eigen::Vector3d point, Eigen::Vector3d linepoint, Eigen::Vector3d linevector)
Definition: MathTools.cpp:412
TPath
std::vector< TPathElement > TPath
Definition: Structs.h:63