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 "Structs.h"
24 
25 #include <Eigen/Core>
26 #include <Eigen/Geometry>
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 
42 
43  static void determineTransformationAlphaBeta(TSphereCoord sc1, TSphereCoord sc2, float& fAlpha, float& fBeta, Eigen::Vector3d& betaAxis);
44  static TSphereCoord transformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis);
45  static TSphereCoord inverseTransformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis);
46 
47  // calculations on sphere coordimates
49  static float getDistanceOnArc(TSphereCoord p1, TSphereCoord p2);
50  static float getDistance(TSphereCoord p1, TSphereCoord p2, float fRadius);
51 
52  // extended 2d math
53  static bool IntersectLines(Eigen::Vector2d p1, Eigen::Vector2d m1, Eigen::Vector2d p2, Eigen::Vector2d m2, Eigen::Vector2d& res);
54 
55  // extended 3d math
56  static Eigen::Vector3d dropAPerpendicular(Eigen::Vector3d point, Eigen::Vector3d linepoint, Eigen::Vector3d linevector);
57  static float AngleAndDirection(Eigen::Vector3d vector1, Eigen::Vector3d vector2, Eigen::Vector3d normal);
58 
59  // coorrdinate conversion
60  static void convert(TSphereCoord in, Eigen::Vector3d& out);
61  static void convert(TSphereCoord in, Eigen::Vector3f& out);
62  static void convert(Eigen::Vector3d in, TSphereCoord& out);
63  static void convert(Eigen::Vector3f in, TSphereCoord& out);
64  static void convertWithDistance(TSphereCoord in, Eigen::Vector3d& out);
65 
66  static double Angle(Eigen::Vector3d vec1, Eigen::Vector3d vec2);
67 
68 
69 };
70 
MathTools::transformAlphaBeta
static TSphereCoord transformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis)
Definition: MathTools.cpp:213
MathTools::determineTransformationAlphaBeta
static void determineTransformationAlphaBeta(TSphereCoord sc1, TSphereCoord sc2, float &fAlpha, float &fBeta, Eigen::Vector3d &betaAxis)
Definition: MathTools.cpp:156
GfxTL::vec2
VectorXD< 2, float > vec2
Definition: VectorXD.h:682
MathTools
Definition: MathTools.h:31
MathTools::inverseTransformAlphaBeta
static TSphereCoord inverseTransformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis)
Definition: MathTools.cpp:234
MathTools::AngleAndDirection
static float AngleAndDirection(Eigen::Vector3d vector1, Eigen::Vector3d vector2, Eigen::Vector3d normal)
Definition: MathTools.cpp:353
GfxTL::vec1
VectorXD< 1, float > vec1
Definition: VectorXD.h:681
MathTools::convertWithDistance
static void convertWithDistance(TSphereCoord in, Eigen::Vector3d &out)
Definition: MathTools.cpp:427
Structs.h
TTransform
Definition: Structs.h:42
MathTools::determineTransformation
static TTransform determineTransformation(TSphereCoord start1, TSphereCoord start2, TSphereCoord end1, TSphereCoord end2)
Definition: MathTools.cpp:81
MathTools::inverseTransform
static TSphereCoord inverseTransform(TSphereCoord sc, TTransform transform)
Definition: MathTools.cpp:138
MathTools::determinePathTransformation
static TTransform determinePathTransformation(TPath *p1, TPath *p2)
Definition: MathTools.cpp:22
MathTools::CalculateCrossProductFromDifference
static float CalculateCrossProductFromDifference(TSphereCoord p1, TSphereCoord p2, TSphereCoord p3)
Definition: MathTools.cpp:258
MathTools::getDistance
static float getDistance(TSphereCoord p1, TSphereCoord p2, float fRadius)
Definition: MathTools.cpp:295
MathTools::transform
static TSphereCoord transform(TSphereCoord sc, TTransform transform)
Definition: MathTools.cpp:119
MathTools::transformPath
static TPath * transformPath(TTransform transform, TPath *pPath)
Definition: MathTools.cpp:33
MathTools::IntersectLines
static bool IntersectLines(Eigen::Vector2d p1, Eigen::Vector2d m1, Eigen::Vector2d p2, Eigen::Vector2d m2, Eigen::Vector2d &res)
Definition: MathTools.cpp:310
MathTools::Angle
static double Angle(Eigen::Vector3d vec1, Eigen::Vector3d vec2)
Definition: MathTools.cpp:270
MathTools::inverseTransformPath
static TPath * inverseTransformPath(TTransform transform, TPath *pPath)
Definition: MathTools.cpp:57
MathTools::getDistanceOnArc
static float getDistanceOnArc(TSphereCoord p1, TSphereCoord p2)
Definition: MathTools.cpp:277
TSphereCoord
Definition: Structs.h:22
MathTools::convert
static void convert(TSphereCoord in, Eigen::Vector3d &out)
Definition: MathTools.cpp:401
MathTools::dropAPerpendicular
static Eigen::Vector3d dropAPerpendicular(Eigen::Vector3d point, Eigen::Vector3d linepoint, Eigen::Vector3d linevector)
Definition: MathTools.cpp:377
TPath
std::vector< TPathElement > TPath
Definition: Structs.h:62