In file include/csgeom/math2d.h:

class csMath2

Various functions in 2D, such as 2D vector functions

Public Methods

static float Area2 (float ax, float ay, float bx, float by, float cx, float cy)
Calculates 2 x the area of a given triangle
static int InPoly2D (const csVector2& v, csVector2* P, int n, csBox* bounding_box)
Calculates whether a vector lies inside a given 2D polygon
static bool Left (float ax, float ay, float bx, float by, float cx, float cy)
Calculates whether a point lies to the left of a given line
static bool Right (float ax, float ay, float bx, float by, float cx, float cy)
Calculates whether a point lies to the right of a given line
static int WhichSide2D (const csVector2& v, const csVector2& s1, const csVector2& s2)
Calculates which side of a line a given point is on

Documentation

Various functions in 2D, such as 2D vector functions. This is a static class and contains only static member functions.
static int WhichSide2D(const csVector2& v, const csVector2& s1, const csVector2& s2)
Calculates which side of a line a given point is on. Returns -1 if point v is left of line segment 's1-s2', 1 if point v is right of segment 's1-s2' or 0 if point v lies on segment 's1-s2'.

static int InPoly2D(const csVector2& v, csVector2* P, int n, csBox* bounding_box)
Calculates whether a vector lies inside a given 2D polygon. Return CS_POLY_IN, CS_POLY_OUT, or CS_POLY_ON for this vector with respect to the given polygon. The polygon is given as an array of 2D vectors with a bounding box. WARNING: does no safety checking for P or bounding_box.

static float Area2(float ax, float ay, float bx, float by, float cx, float cy)
Calculates 2 x the area of a given triangle. Returns twice the signed area of the triangle determined by a,b,c, positive if a,b,c are oriented ccw, and negative if cw.

static bool Right(float ax, float ay, float bx, float by, float cx, float cy)
Calculates whether a point lies to the right of a given line. Returns true iff c is strictly to the right of the directed line through a to b.

static bool Left(float ax, float ay, float bx, float by, float cx, float cy)
Calculates whether a point lies to the left of a given line. Returns true iff c is strictly to the left of the directed line through a to b.


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de