breakout/vector.h

27 lines
759 B
C
Raw Normal View History

#ifndef __vector_h__
#define __vector_h__
// Structs
typedef struct vectorStruct {
double x, y;
} Vector;
// End Structs
// Prototypes
Vector vectorScale(Vector v, double factor);
double vectorMagnitude(Vector v);
double vectorRotation(Vector v);
Vector vectorScaleTo(Vector v, double magnitude);
double dotProduct(Vector v1, Vector v2);
double vectorDist(Vector v1, Vector v2);
Vector vectorAdd(Vector v1, Vector v2);
Vector vectorSub(Vector v1, Vector v2);
double degreeSin(double x);
double degreeCos(double x);
Vector getDirectionalUnitVector(double rotation);
Vector getScaledDirectionalUnitVector(double rotation, double Magnitude);
Vector getScaledVectorFromTo(Vector from, Vector to, double Magnitude);
// End Prototypes
#endif // __vector_h__