radialobject.h
C header source for Polychorons, 90 lines. Raw file
/*
RADIALOBJECT
A radial object is a 3d object with a defined distance from the origin for any directional vector
They are also animated, with a time parameter
The function to define a radial object returns a distance given a directional vector and the time
The surface is rendered by dividing the surfaces of a cube into a grid of res x res squares
and moving the points radially to the surface of the object
Tetra and TetraStar are currently rubbish, maybe aligning them differently with the axes will help
*/
#ifndef __RADIALOBJECT_H__
#define __RADIALOBJECT_H__
//---- GET_RADIALOBJECT_DISTANCE
// Generic function to define a radial object
typedef double (*GET_RADIALOBJECT_DISTANCE)( double, double, double, double );
//---- RADIALOBJECT FUNCTIONS
double getRadialObjectDistanceCube ( double x, double y, double z, double time );
double getRadialObjectDistanceSphere( double x, double y, double z, double time );
double getRadialObjectDistanceBlob ( double x, double y, double z, double time );
double getRadialObjectDistanceZNPill( double x, double y, double z, double time );
double getRadialObjectDistanceTetra ( double x, double y, double z, double time );
double getRadialObjectDistanceTetraStar( double x, double y, double z, double time );
// Alternates through the radial objects above
double getRadialObjectDistanceAlternating( double x, double y, double z, double time );
//---- RENDERING FUNCTIONS
#define RADIALOBJECT_MAXRES 64
extern int radialObject_res; // Each face of the cubic surface is divided into res x res squares
void drawRadialObject( double time, GET_RADIALOBJECT_DISTANCE thing_fn );
#endif