view src/Vector.cpp @ 6:11e216148d1c

Making progress in Matrix. Reorganized code a bit. Reworked Vector routines to use += -= *=
author Eris Caffee <discordia@eldalin.com>
date Tue, 06 Sep 2011 11:26:39 -0500
parents
children
line source
1 #include "Vector.h"
3 #include <iostream>
4 #include <string>
5 #include <sstream>
7 ////////////////////////////////////////////////////////////////////////////////
8 std::string & arda::Vector::getstring2v(Vector2i v, std::string & s)
9 {
10 s.clear();
11 std::stringstream ss;
12 ss << "[ " << v[0] << ", " << v[1] << " ]";
13 s = ss.str();
14 return s;
15 }
17 ////////////////////////////////////////////////////////////////////////////////
18 std::string & arda::Vector::getstring2v(Vector2f v, std::string & s)
19 {
20 s.clear();
21 std::stringstream ss;
22 ss << "[ " << v[0] << ", " << v[1] << " ]";
23 s = ss.str();
24 return s;
25 }
27 ////////////////////////////////////////////////////////////////////////////////
28 std::string & arda::Vector::getstring2v(Vector2d v, std::string & s)
29 {
30 s.clear();
31 std::stringstream ss;
32 ss << "[ " << v[0] << ", " << v[1] << " ]";
33 s = ss.str();
34 return s;
35 }
37 ////////////////////////////////////////////////////////////////////////////////
38 std::string & arda::Vector::getstring3v(Vector3i v, std::string & s)
39 {
40 s.clear();
41 std::stringstream ss;
42 ss << "[ " << v[0] << ", " << v[1] << ", " << v[2] << " ]";
43 s = ss.str();
44 return s;
45 }
47 ////////////////////////////////////////////////////////////////////////////////
48 std::string & arda::Vector::getstring3v(Vector3f v, std::string & s)
49 {
50 s.clear();
51 std::stringstream ss;
52 ss << "[ " << v[0] << ", " << v[1] << ", " << v[2] << " ]";
53 s = ss.str();
54 return s;
55 }
57 ////////////////////////////////////////////////////////////////////////////////
58 std::string & arda::Vector::getstring3v(Vector3d v, std::string & s)
59 {
60 s.clear();
61 std::stringstream ss;
62 ss << "[ " << v[0] << ", " << v[1] << ", " << v[2] << " ]";
63 s = ss.str();
64 return s;
65 }
67 ////////////////////////////////////////////////////////////////////////////////
68 std::string & arda::Vector::getstring4v(Vector4i v, std::string & s)
69 {
70 s.clear();
71 std::stringstream ss;
72 ss << "[ " << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << " ]";
73 s = ss.str();
74 return s;
75 }
77 ////////////////////////////////////////////////////////////////////////////////
78 std::string & arda::Vector::getstring4v(Vector4f v, std::string & s)
79 {
80 s.clear();
81 std::stringstream ss;
82 ss << "[ " << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << " ]";
83 s = ss.str();
84 return s;
85 }
87 ////////////////////////////////////////////////////////////////////////////////
88 std::string & arda::Vector::getstring4v(Vector4d v, std::string & s)
89 {
90 s.clear();
91 std::stringstream ss;
92 ss << "[ " << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << " ]";
93 s = ss.str();
94 return s;
95 }