1
1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
1.0 KiB

#ifndef VECT_H
#define VECT_H
#include <math.h>
// origin-centred vector
typedef struct {
double x;
double y;
} Vect;
/* Return the magnitude of two vectors */
double vect_mag(Vect v);
/* Return the angle of a vector in radians (using atan2) */
double vect_dir(Vect V);
/* Return the dot product of two vectors */
double vect_dot(Vect V, Vect B);
/* return a vector multiplied by a scalar */
Vect vect_scalar(Vect V, double s);
/* Return the sum of two vectors */
Vect vect_add(Vect v1, Vect v2);
/* Return the projection of vector one onto vector two */
Vect project_vect(Vect one, Vect two);
/* Return the scalar projection of V onto P */
double vect_scalar_projection(Vect V, Vect P);
/* Return the vector v rotated by radians radians. */
Vect vect_rotate(Vect v, double radians);
/* Return the argument of v in radians */
double vect_arg(Vect v);
/* create a vector using modarg form */
Vect vect_modarg(double mod, double arg);
/* Return the distance between two point vectors A and B */
double vect_distance(Vect A, Vect B);
#endif