versor
3.0
C++11 library for Geometric algebra
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
vsr
draw
vsr_print.h
1
/*
2
* =====================================================================================
3
*
4
* Filename: vsr_print.h
5
*
6
* Description: routines for printing to tikz (postscript)
7
*
8
* Version: 1.0
9
* Created: 10/17/2014 19:26:47
10
* Revision: none
11
* Compiler: gcc
12
*
13
* Author: Pablo Colapinto (), gmail -> wolftype
14
* Organization:
15
*
16
* =====================================================================================
17
*/
18
19
#include <sstream>
20
21
using namespace
std
;
22
23
namespace
vsr
{
24
25
namespace
tikz{
26
27
string
begin(){
28
return
"\\begin{tikzpicture}"
;
29
}
30
string
end(){
31
return
"\\end{tikzpicture}"
;
32
}
33
34
template
<
class
T>
35
string
coord(
const
T& t){
36
stringstream os;
37
os <<
"("
<<ZERO(t[0])<<
","
<<ZERO(t[1])<<
","
<<ZERO(t[2])<<
")"
;
38
return
os.str();
39
}
40
41
template
<
class
T>
42
string
coord(
string
name,
const
T& t){
43
stringstream os ; os<<
"\\coordinate"
+name+
" at "
+coord(t)<<
";"
<< endl;
44
return
os.str();
45
}
46
47
string
name(
string
n,
int
x){
48
stringstream os; os <<
"("
<<n<<x<<
")"
;
49
return
os.str();
50
}
51
52
/* string drawPS(string style = "[->]"){ */
53
/* return "\\draw"+style; */
54
/* } */
55
template
<
class
T>
56
string
draw(
const
T& from,
const
T& to,
string
style =
"->"
){
57
stringstream os;
58
os <<
"\\draw["
<<style<<
"]"
<<coord(from) <<
"--"
<< coord(to) <<
";"
<<endl;
59
return
os.str();
60
}
61
62
63
}
64
65
66
}
//vsr::
std
vsr
the versor library namespace
Definition:
vsr_algebra.h:29
Generated on Tue Jul 28 2015 16:26:05 for versor by
1.8.10