Agar

<-- Back to AG_Intro.3

SYNOPSIS

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

DESCRIPTION

The M_Sphere structure describes a sphere in terms of an origin point p and a radius r:
typedef struct m_sphere {
	M_Vector3 p;
	M_Real r;
} M_Sphere;

INITIALIZATION


M_Sphere M_SphereFromPt (M_Vector p, M_Real r)

M_Sphere M_SphereRead (AG_DataSource *ds)

void M_SphereWrite (AG_DataSource *ds, M_Sphere *S)

M_Sphere M_SPHERE_INITIALIZER (M_Real x, M_Real y, M_Real z, M_Real r)


The M_SphereFromPt() function returns a M_Sphere describing a sphere of radius r centered at point p.

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

The M_SPHERE_INITIALIZER() macro expands to a static initializer for M_Sphere.

COMPUTATIONS


M_Real M_SpherePointDistance (M_Sphere S, M_Vector3 p)

M_Real M_SphereSurfaceArea (M_Sphere S)

M_Real M_SphereVolume (M_Sphere S)


The M_SpherePointDistance() routine computes the minimal distance between a sphere S and a point p.

M_SphereSurfaceArea() returns the surface area of the sphere. M_SphereVolume() returns the volume of the interior of the sphere.

SEE ALSO

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)

HISTORY

The M_Circle structure first appeared in Agar 1.3.4.
Csoft.net ElectronTubeStore