Mercurial > hg > wabletios
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2dvector.h Mon Nov 19 13:00:42 2012 +0000 @@ -0,0 +1,33 @@ +/* + * 2dvector.h + * simplespring + * + * Created by Robert Tubb on 01/06/2011. + * Copyright 2011 __MyCompanyName__. All rights reserved. + * + */ +#ifndef _2DVECTORH +#define _2DVECTORH + +class TwoVector{ +public: + double x, y; + TwoVector(); + TwoVector(double ax, double ay); + +// public methods + double norm(); + void setCoord(double ax, double ay); + TwoVector minus(TwoVector otherPoint); + TwoVector operator-(TwoVector otherPoint); + TwoVector operator+(TwoVector otherPoint); + + TwoVector operator*(TwoVector otherPoint); + TwoVector operator*(double scalar); // scalar is right operand + TwoVector unitDir(); + double distanceTo(TwoVector otherPoint); + + +}; + +#endif // #ifndef _2DVECTORH \ No newline at end of file