M_Rectangle
—
Agar-Math rectangle structure
#include <agar/core.h>
#include <agar/gui.h>
#include <agar/math/m.h>
The M_Rectangle2 structure describes a
rectangle in R^2 in terms of four points:
typedef struct m_rectangle2 {
M_Vector2 a, b, c, d;
} M_Rectangle2;
Similarly, M_Rectangle3 describes a
rectangle in R^3:
typedef struct m_rectangle3 {
M_Vector3 a, b, c, d;
} M_Rectangle3;
M_Rectangle2
M_RectangleFromLines2
(M_Line2
L1, M_Line2
L2);
M_Rectangle3
M_RectangleFromLines3
(M_Line2
L1, M_Line2 L2,
M_Line2 L3);
M_Rectangle2
M_RectangleFromPts2
(M_Vector2
a, M_Vector2
b);
M_Rectangle3
M_RectangleFromPts3
(M_Vector3
a, M_Vector3 b,
M_Vector3 c);
M_Rectangle2
M_RectangleRead2
(AG_DataSource
*ds);
M_Rectangle3
M_RectangleRead3
(AG_DataSource
*ds);
void
M_RectangleWrite2
(AG_DataSource
*ds, M_Rectangle2
*R);
void
M_RectangleWrite3
(AG_DataSource
*ds, M_Rectangle3
*R);
M_Rectangle2
M_RECTANGLE2_INITIALIZER
(M_Vector2
a, M_Vector2 b,
M_Vector2 c);
M_Rectangle3
M_RECTANGLE3_INITIALIZER
(M_Vector3
a, M_Vector3 b,
M_Vector3 c);
The functions
M_RectangleFromLines2
()
and M_RectangleFromLines3
() return an
M_Rectangle2 or M_Rectangle3
describing a rectangle in terms of two or three lines.
M_RectangleFromPts2
()
and M_RectangleFromPts3
() return a rectangle in
terms of two or three points.
The
M_RectangleRead[23]
()
and
M_RectangleWrite[23]
()
functions read or write a rectangle structure from/to an
AG_DataSource(3).
The macros
M_RECTANGLE2_INITIALIZER
()
and M_RECTANGLE3_INITIALIZER
() expand to static
initializers for M_Rectangle2 and
M_Rectangle3, respectively.
The M_Rectangle
structure first appeared
in Agar 1.3.4.