GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
M_POINT_SET(3) FreeBSD Library Functions Manual M_POINT_SET(3)

M_PointSetAgar-Math point set structures

#include <agar/core.h>
#include <agar/gui.h>
#include <agar/math/m.h>

The M_PointSet family of structures describe arbitrary sets of points in space. They are defined as follows:

/* Points in R^2 */
typedef struct m_point_set2 {
	M_Vector2 *p;
	Uint n, nMax;
} M_PointSet2;

/* Points in Z^2 */
typedef struct m_point_set2i {
	M_Real w, h;
	int *x, *y;
	Uint n, nMax;
} M_PointSet2i;

/* Points in R^3 */
typedef struct m_point_set3 {
	M_Vector3 *p;
	Uint n, nMax;
} M_PointSet3;

/* Points in Z^3 */
typedef struct m_point_set3i {
	M_Real w, h, d;			/* Scaling factor */
	int *x, *y, *z;
	Uint n, nMax;
} M_PointSet3i;

The points in a M_PointSet[23] are stored under the p array of vectors (see M_Vector(3)).

The points in M_PointSet[23]i are stored as separate arrays of integers x, y, z. The w, h and d members specify scaling factors to use when converting from an integer set to a real set.

void
(M_PointSet2 *S);


void
(M_PointSet3 *S);


void
(M_PointSet2i *S, M_Real w, M_Real h);


void
(M_PointSet3i *S, M_Real w, M_Real h, M_Real d);


int
(M_PointSet2 *S, Uint n);


int
(M_PointSet3 *S, Uint n);


int
(M_PointSet2i *S, Uint n);


int
(M_PointSet3i *S, Uint n);


void
(M_PointSet2 *S);


void
(M_PointSet3 *S);


void
(M_PointSet2i *S);


void
(M_PointSet2i *S);


M_PointSet2
(AG_DataSource *ds);


void
(AG_DataSource *ds, const M_PointSet2 *S);


M_PointSet3
(AG_DataSource *ds);


void
(AG_DataSource *ds, const M_PointSet3 *S);


M_PointSet2i
(AG_DataSource *ds);


void
(AG_DataSource *ds, const M_PointSet2i *S);


M_PointSet3i
(AG_DataSource *ds);


void
(AG_DataSource *ds, const M_PointSet3i *S);


M_PointSet2
(void);


M_PointSet3
(void);


M_PointSet2i
(void);


M_PointSet3i
(void);

The () functions initialize a point set in R^2 or R^3 to the null set.

The () functions initialize a point set in Z^3 or Z^3 to the null set. The w, h, d arguments specify the scaling factor to use when converting from an integer to a real point set.

The () functions allocates memory for the specified number of points, returning 0 on success or -1 if insufficient memory is available.

The () functions free the point sets, clearing the arrays and reinitializing the point count to 0.

The () and () functions read or write a triangle structure from/to an AG_DataSource(3).

The macros () expand to static initializers for any of the M_PointSet structures.

int
(M_PointSet2 *S, M_Vector2 v);


int
(M_PointSet3 *S, M_Vector3 v);


int
(M_PointSet2 *S, int x, int y);


int
(M_PointSet3i *S, int x, int y, int z);


int
(M_PointSet2 *D, const M_PointSet2 *S);


int
(M_PointSet3 *D, const M_PointSet3 *S);


int
(M_PointSet2i *D, const M_PointSet2i *S);


int
(M_PointSet3i *D, const M_PointSet3i *S);


void
(M_PointSet2 *S, enum m_point_set_sort_mode2);


void
(M_PointSet3 *S, enum m_point_set_sort_mode3);

The () functions insert a new point at the end of the set S. On success, the index of the new point is returned. If insufficient memory is available, -1 is returned.

The () functions copy the contents of source set S into destination set D, returning 0 on success or -1 if insufficient memory is available.

The () functions sort the point sets by point coordinate. The mode arguments specify the sorting mode:

enum m_point_set_sort_mode2 {
	M_POINT_SET_SORT_XY,
	M_POINT_SET_SORT_YX,
};
enum m_point_set_sort_mode3 {
	M_POINT_SET_SORT_XYZ,
	M_POINT_SET_SORT_XZY,
	M_POINT_SET_SORT_YXZ,
	M_POINT_SET_SORT_YZX,
	M_POINT_SET_SORT_ZXY,
	M_POINT_SET_SORT_ZYX,
};

AG_DataSource(3), AG_Intro(3), M_Circle(3), M_Geometry(3), M_Plane(3), M_Polygon(3), M_Rectangle(3), M_Sphere(3), M_Triangle(3), M_Vector(3)

The M_PointSet family of structures first appeared in Agar 1.4.2.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.