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// *****************************************************************
32{
33public:
34 // transformation of coordinates and paths
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};
std::vector< TPathElement > TPath
Definition Structs.h:63
static bool IntersectLines(Eigen::Vector2d p1, Eigen::Vector2d m1, Eigen::Vector2d p2, Eigen::Vector2d m2, Eigen::Vector2d &res)
static double Angle(Eigen::Vector3d vec1, Eigen::Vector3d vec2)
static void determineTransformationAlphaBeta(TSphereCoord sc1, TSphereCoord sc2, float &fAlpha, float &fBeta, Eigen::Vector3d &betaAxis)
static TSphereCoord inverseTransform(TSphereCoord sc, TTransform transform)
static TSphereCoord inverseTransformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis)
static TSphereCoord transformAlphaBeta(TSphereCoord sc, float fAlpha, float fBeta, Eigen::Vector3d betaAxis)
static TPath * inverseTransformPath(TTransform transform, TPath *pPath)
Definition MathTools.cpp:61
static float getDistanceOnArc(TSphereCoord p1, TSphereCoord p2)
static TPath * transformPath(TTransform transform, TPath *pPath)
Definition MathTools.cpp:37
static void convertWithDistance(TSphereCoord in, Eigen::Vector3d &out)
static float AngleAndDirection(Eigen::Vector3d vector1, Eigen::Vector3d vector2, Eigen::Vector3d normal)
static Eigen::Vector3d dropAPerpendicular(Eigen::Vector3d point, Eigen::Vector3d linepoint, Eigen::Vector3d linevector)
static TTransform determineTransformation(TSphereCoord start1, TSphereCoord start2, TSphereCoord end1, TSphereCoord end2)
Definition MathTools.cpp:85
static float CalculateCrossProductFromDifference(TSphereCoord p1, TSphereCoord p2, TSphereCoord p3)
static TSphereCoord transform(TSphereCoord sc, TTransform transform)
static float getDistance(TSphereCoord p1, TSphereCoord p2, float fRadius)
static void convert(TSphereCoord in, Eigen::Vector3d &out)
static TTransform determinePathTransformation(TPath *p1, TPath *p2)
Definition MathTools.cpp:25