/*
*
*/
void renderSolidTetrahedron( void )
{
/* Magic Numbers: r0 = ( 1, 0, 0 )
* r1 = ( -1/3, 2 sqrt(2) / 3, 0 )
* r2 = ( -1/3, -sqrt(2) / 3, sqrt(6) / 3 )
* r3 = ( -1/3, -sqrt(2) / 3, -sqrt(6) / 3 )
* |r0| = |r1| = |r2| = |r3| = 1
* Distance between any two points is 2 sqrt(6) / 3
...*
*/
void renderSolidTetrahedron( void )
{
/* Magic Numbers: r0 = ( 1, 0, 0 )
* r1 = ( -1/3, 2 sqrt(2) / 3, 0 )
* r2 = ( -1/3, -sqrt(2) / 3, sqrt(6) / 3 )
* r3 = ( -1/3, -sqrt(2) / 3, -sqrt(6) / 3 )
* |r0| = |r1| = |r2| = |r3| = 1
* Distance between any two points is 2 sqrt(6) / 3
阅读全文...
/*
*
*/
void renderWireTetrahedron( void )
{
/* Magic Numbers: r0 = ( 1, 0, 0 )
* r1 = ( -1/3, 2 sqrt(2) / 3, 0 )
* r2 = ( -1/3, -sqrt(2) / 3, sqrt(6) / 3 )
* r3 = ( -1/3, -sqrt(2) / 3, -sqrt(6) / 3 )
* |r0| = |r1| = |r2| = |r3| = 1
* Distance between any two points is 2 sqrt(6) / 3
...*
*/
void renderWireTetrahedron( void )
{
/* Magic Numbers: r0 = ( 1, 0, 0 )
* r1 = ( -1/3, 2 sqrt(2) / 3, 0 )
* r2 = ( -1/3, -sqrt(2) / 3, sqrt(6) / 3 )
* r3 = ( -1/3, -sqrt(2) / 3, -sqrt(6) / 3 )
* |r0| = |r1| = |r2| = |r3| = 1
* Distance between any two points is 2 sqrt(6) / 3
阅读全文...
/*
*
*/
void renderSolidOctahedron( void )
{
#define RADIUS 1.0f
glBegin( GL_TRIANGLES );
glNormal3d( 0.577350269189, 0.577350269189, 0.577350269189); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350269189, 0.577350269189,-0.577350269189); glVertex3d(
...*
*/
void renderSolidOctahedron( void )
{
#define RADIUS 1.0f
glBegin( GL_TRIANGLES );
glNormal3d( 0.577350269189, 0.577350269189, 0.577350269189); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350269189, 0.577350269189,-0.577350269189); glVertex3d(
阅读全文...
/*
*
*/
void renderWireOctahedron( void )
{
#define RADIUS 1.0f
glBegin( GL_LINE_LOOP );
glNormal3d( 0.577350269189, 0.577350269189, 0.577350269189); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350269189, 0.577350269189,-0.577350269189); glVertex3d(
...*
*/
void renderWireOctahedron( void )
{
#define RADIUS 1.0f
glBegin( GL_LINE_LOOP );
glNormal3d( 0.577350269189, 0.577350269189, 0.577350269189); glVertex3d( RADIUS, 0.0, 0.0 ); glVertex3d( 0.0, RADIUS, 0.0 ); glVertex3d( 0.0, 0.0, RADIUS );
glNormal3d( 0.577350269189, 0.577350269189,-0.577350269189); glVertex3d(
阅读全文...
/*
*
*/
void renderSolidDodecahedron( void )
{
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_POLYGON ) ;
...*
*/
void renderSolidDodecahedron( void )
{
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_POLYGON ) ;
阅读全文...
/*
*
*/
void renderWireDodecahedron( void )
{
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_LINE_LOOP ) ;
...*
*/
void renderWireDodecahedron( void )
{
/* Magic Numbers: It is possible to create a dodecahedron by attaching two pentagons to each face of
* of a cube. The coordinates of the points are:
* (+-x,0, z); (+-1, 1, 1); (0, z, x )
* where x = 0.61803398875 and z = 1.61803398875.
*/
glBegin ( GL_LINE_LOOP ) ;
阅读全文...
/*
*
*/
void renderSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings )
{
double iradius = dInnerRadius, oradius = dOuterRadius, phi, psi, dpsi, dphi;
double *vertex, *normal;
int i, j;
double spsi, cpsi, sphi, cphi ;
/*
* Increment the number of sides and rings to allow for one more point than surface
...*
*/
void renderSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings )
{
double iradius = dInnerRadius, oradius = dOuterRadius, phi, psi, dpsi, dphi;
double *vertex, *normal;
int i, j;
double spsi, cpsi, sphi, cphi ;
/*
* Increment the number of sides and rings to allow for one more point than surface
阅读全文...
/*
*
*/
void renderWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings )
{
double iradius = dInnerRadius, oradius = dOuterRadius, phi, psi, dpsi, dphi;
double *vertex, *normal;
int i, j;
double spsi, cpsi, sphi, cphi ;
/*
* Allocate the vertices array
*/
vertex = (double *)calloc(
...*
*/
void renderWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLint nSides, GLint nRings )
{
double iradius = dInnerRadius, oradius = dOuterRadius, phi, psi, dpsi, dphi;
double *vertex, *normal;
int i, j;
double spsi, cpsi, sphi, cphi ;
/*
* Allocate the vertices array
*/
vertex = (double *)calloc(
阅读全文...
需要使用到前面的SIN,COS查表函数。
/*
* Draws a wire cylinder
*/
void renderWireCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
{
int i,j;
/* Step in z and radius as stacks are drawn. */
double z = 0.0;
const double zStep = height/stacks;
/* Pre-computed circle */
double *sint,*cost;
...* Draws a wire cylinder
*/
void renderWireCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
{
int i,j;
/* Step in z and radius as stacks are drawn. */
double z = 0.0;
const double zStep = height/stacks;
/* Pre-computed circle */
double *sint,*cost;
阅读全文...
需要使用到前面的SIN,COS查表函数
/*
* Draws a solid cylinder
*/
void renderSolidCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
{
int i,j;
/* Step in z and radius as stacks are drawn. */
double z0,z1;
const double zStep = height/stacks;
/* Pre-computed circle */
double *sint,*cost;
...* Draws a solid cylinder
*/
void renderSolidCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
{
int i,j;
/* Step in z and radius as stacks are drawn. */
double z0,z1;
const double zStep = height/stacks;
/* Pre-computed circle */
double *sint,*cost;
阅读全文...




















