Mercurial > hg > wabletios
comparison 2dvector.h @ 0:c667dfe12d47
OK. Ther real deal.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 19 Nov 2012 13:00:42 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c667dfe12d47 |
---|---|
1 /* | |
2 * 2dvector.h | |
3 * simplespring | |
4 * | |
5 * Created by Robert Tubb on 01/06/2011. | |
6 * Copyright 2011 __MyCompanyName__. All rights reserved. | |
7 * | |
8 */ | |
9 #ifndef _2DVECTORH | |
10 #define _2DVECTORH | |
11 | |
12 class TwoVector{ | |
13 public: | |
14 double x, y; | |
15 TwoVector(); | |
16 TwoVector(double ax, double ay); | |
17 | |
18 // public methods | |
19 double norm(); | |
20 void setCoord(double ax, double ay); | |
21 TwoVector minus(TwoVector otherPoint); | |
22 TwoVector operator-(TwoVector otherPoint); | |
23 TwoVector operator+(TwoVector otherPoint); | |
24 | |
25 TwoVector operator*(TwoVector otherPoint); | |
26 TwoVector operator*(double scalar); // scalar is right operand | |
27 TwoVector unitDir(); | |
28 double distanceTo(TwoVector otherPoint); | |
29 | |
30 | |
31 }; | |
32 | |
33 #endif // #ifndef _2DVECTORH |