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_GEOMETRY(3) FreeBSD Library Functions Manual M_GEOMETRY(3)

M_Geometry
Agar-Math geometrical structures

#include <agar/math.h>

The Agar-Math library implements a number of algorithms and operations on related to geometrical structures. The following basic structures are defined, see their respective manual pages for more details:

M_Line(3)
Line segment or ray in R^2 (M_Line2) or R^3 (M_Line3).
M_Circle(3)
Circle in R^2 (M_Circle2) or R^3 (M_Circle3).
M_Sphere(3)
Sphere in R^3.
M_Plane(3)
Plane in R^3 (M_Plane).
M_Triangle(3)
Triangle in R^2 (M_Triangle2) or R^3 (M_Triangle3).
M_Rectangle(3)
Rectangle in R^2 (M_Rectangle2) or R^3 (M_Rectangle3).
M_Polygon(3)
Polygon in R^2.
M_Polyhedron(3)
Polyhedron in R^3.

A number of routines (e.g., computation of intersections) return sets of zero or more geometrical structures of different types, depending on the

The M_Geom2 structure defines a geometrical entity in R^2:

typedef struct m_geom2 {
	M_GeomType type;
	union {
		M_Vector2    point;
		M_Line2      line;
		M_Circle2    circle;
		M_Triangle2  triangle;
		M_Rectangle2 rectangle;
		M_Polygon    polygon;
	} g;
} M_Geom2;

Similarly, M_Geom3 defines an entity in R^3:

typedef struct m_geom3 {
	M_GeomType type;
	union {
		M_Vector3    point;
		M_Line3      line;
		M_Circle3    circle;
		M_Triangle3  triangle;
		M_Rectangle3 rectangle;
		M_Polygon    polygon;
		M_Sphere     sphere;
		M_Plane      plane;
		M_Polyhedron polyhedron;
	} g;
} M_Geom3;

The type field can take on the following values:

Undefined type
An M_Vector2(3) or M_Vector3(3).
An M_Line2(3) or M_Line3(3).
An M_Circle2(3) or M_Circle3(3).
An M_Polygon(3).
An M_Triangle2(3) or M_Triangle3(3).
An M_Rectangle2(3) or M_Rectnagle3(3).
An M_Sphere(3).
An M_Plane3(3).

Sets of generic geometric entities in R^2 are described by the structure:
typedef struct m_geom_set2 {
	M_Geom2 *g;
	Uint n;
} M_GeomSet2;
Similarly for R^3:
typedef struct m_geom_set3 {
	M_Geom3 *g;
	Uint n;
} M_GeomSet3;

The following routines allow the manipulation of these sets.


M_GeomSet2
M_GEOM_SET_EMPTY(void);


M_GeomSet3
M_GEOM_SET_EMPTY(void);


void
M_GeomSetAdd2(M_GeomSet2 *S, const M_Geom2 *g);


void
M_GeomSetAdd3(M_GeomSet3 *S, const M_Geom3 *g);


void
M_GeomSetFree2(M_GeomSet2 *S);


void
M_GeomSetFree3(M_GeomSet3 *S);

The M_GEOM_SET_EMPTY() macro is provided as a static initializer for M_GeomSet2 and M_GeomSet3.

The M_GeomSetAdd2() and M_GeomSetAdd3() functions insert a copy of the entity g into the geometric set S.

M_GeomSetFree2() and M_GeomSetFree3() release the resources allocated by a geometric set.

AG_Intro(3), M_Matrix(3), M_Real(3), M_Vector(3)

The M_Geometry structure first appeared in Agar 1.3.4.
July 14, 2009 FreeBSD 13.1-RELEASE

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.