rt300@0: /* rt300@0: * 2dvector.h rt300@0: * simplespring rt300@0: * rt300@0: * Created by Robert Tubb on 01/06/2011. rt300@0: * Copyright 2011 __MyCompanyName__. All rights reserved. rt300@0: * rt300@0: */ rt300@0: #ifndef _2DVECTORH rt300@0: #define _2DVECTORH rt300@0: rt300@0: class TwoVector{ rt300@0: public: rt300@0: double x, y; rt300@0: TwoVector(); rt300@0: TwoVector(double ax, double ay); rt300@0: rt300@0: // public methods rt300@0: double norm(); rt300@0: void setCoord(double ax, double ay); rt300@0: TwoVector minus(TwoVector otherPoint); rt300@0: TwoVector operator-(TwoVector otherPoint); rt300@0: TwoVector operator+(TwoVector otherPoint); rt300@0: rt300@0: TwoVector operator*(TwoVector otherPoint); rt300@0: TwoVector operator*(double scalar); // scalar is right operand rt300@0: TwoVector unitDir(); rt300@0: double distanceTo(TwoVector otherPoint); rt300@0: rt300@0: rt300@0: }; rt300@0: rt300@0: #endif // #ifndef _2DVECTORH