105 bool is_zero(
void)
const {
return (fabsf(x) < FLT_EPSILON) && (fabsf(y) < FLT_EPSILON); }
110 #if MATH_CHECK_INDEXES 111 assert(i >= 0 && i < 2);
118 #if MATH_CHECK_INDEXES 119 assert(i >= 0 && i < 2);
133 return (T)(*
this * *
this);
156 *
this= *
this*2 - orig;
162 *
this= v * (*
this *
v)/(v*v);
168 return v * (*
this *
v)/(v*v);
177 T d1 = perpendicular1 * pos_delta;
178 T d2 = perpendicular2 * pos_delta;
180 return perpendicular1;
182 return perpendicular2;
195 if (l2 < FLT_EPSILON) {
203 const float t = ((p -
v) * (w - v)) / l2;
209 return v + (w -
v)*t;
Vector2< T > & operator*=(const T num)
Vector2< float > Vector2f
void project(const Vector2< T > &v)
Vector2< T > operator+(const Vector2< T > &v) const
Vector2< uint32_t > Vector2ul
Vector2< T > & operator-=(const Vector2< T > &v)
T & operator[](uint8_t i)
const T & operator[](uint8_t i) const
T operator%(const Vector2< T > &v) const
static bool segment_intersection(const Vector2< T > &seg1_start, const Vector2< T > &seg1_end, const Vector2< T > &seg2_start, const Vector2< T > &seg2_end, Vector2< T > &intersection)
static float closest_distance_between_radial_and_point(const Vector2< T > &w, const Vector2< T > &p)
Vector2< int16_t > Vector2i
static Vector2< T > perpendicular(const Vector2< T > &pos_delta, const Vector2< T > &v1)
Vector2< T > & operator/=(const T num)
static Vector2< T > closest_point(const Vector2< T > &p, const Vector2< T > &v, const Vector2< T > &w)
Vector2< T > operator*(const T num) const
bool operator!=(const Vector2< T > &v) const
void reflect(const Vector2< T > &n)
Vector2< T > projected(const Vector2< T > &v)
float angle(const Vector2< T > &v2) const
Vector2< T > normalized() const
bool operator==(const Vector2< T > &v) const
static bool circle_segment_intersection(const Vector2< T > &seg_start, const Vector2< T > &seg_end, const Vector2< T > &circle_center, float radius, Vector2< T > &intersection)
void operator()(const T x0, const T y0)
Vector2< T > operator-(void) const
Vector2< T > operator/(const T num) const
Vector2< int32_t > Vector2l
Vector2< T > & operator+=(const Vector2< T > &v)
Vector2< uint16_t > Vector2ui