view 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
line wrap: on
line source
/*
 *  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