Agar Logo

Agar 1.7 Manual

(Printable Version)
M_Sphere(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


HISTORY

The M_Sphere structure first appeared in Agar 1.3.4.

Csoft.net ElectronTubeStore