Mercurial > hg > wabletios
annotate 2dvector.h @ 15:d5758530a039 tip
oF0.84
Retina, and iPhone support
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 12 May 2015 15:48:52 +0100 |
parents | c667dfe12d47 |
children |
rev | line source |
---|---|
rt300@0 | 1 /* |
rt300@0 | 2 * 2dvector.h |
rt300@0 | 3 * simplespring |
rt300@0 | 4 * |
rt300@0 | 5 * Created by Robert Tubb on 01/06/2011. |
rt300@0 | 6 * Copyright 2011 __MyCompanyName__. All rights reserved. |
rt300@0 | 7 * |
rt300@0 | 8 */ |
rt300@0 | 9 #ifndef _2DVECTORH |
rt300@0 | 10 #define _2DVECTORH |
rt300@0 | 11 |
rt300@0 | 12 class TwoVector{ |
rt300@0 | 13 public: |
rt300@0 | 14 double x, y; |
rt300@0 | 15 TwoVector(); |
rt300@0 | 16 TwoVector(double ax, double ay); |
rt300@0 | 17 |
rt300@0 | 18 // public methods |
rt300@0 | 19 double norm(); |
rt300@0 | 20 void setCoord(double ax, double ay); |
rt300@0 | 21 TwoVector minus(TwoVector otherPoint); |
rt300@0 | 22 TwoVector operator-(TwoVector otherPoint); |
rt300@0 | 23 TwoVector operator+(TwoVector otherPoint); |
rt300@0 | 24 |
rt300@0 | 25 TwoVector operator*(TwoVector otherPoint); |
rt300@0 | 26 TwoVector operator*(double scalar); // scalar is right operand |
rt300@0 | 27 TwoVector unitDir(); |
rt300@0 | 28 double distanceTo(TwoVector otherPoint); |
rt300@0 | 29 |
rt300@0 | 30 |
rt300@0 | 31 }; |
rt300@0 | 32 |
rt300@0 | 33 #endif // #ifndef _2DVECTORH |