Azure Product
浏览模式: 普通 | 列表

绘制实心四面体

[ 2007-01-17 12:34:58 | 作者: Admin ]
uploads/200701/17_153427_solidtetrahedron.jpg

/*
 *
 */
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
...

阅读全文...

绘制线框四面体

[ 2007-01-17 12:33:42 | 作者: Admin ]
uploads/200701/17_153351_wiretetrahedron.jpg

/*
 *
 */
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
...

阅读全文...

绘制实心八面体

[ 2007-01-17 12:32:20 | 作者: Admin ]
uploads/200701/17_153046_solidoctahedron.jpg

/*
 *
 */
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(
...

阅读全文...

绘制线框八面体

[ 2007-01-17 12:30:19 | 作者: Admin ]
uploads/200701/17_152913_wireoctahedron.jpg

/*
 *
 */
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(
...

阅读全文...

绘制实心十二面体

[ 2007-01-17 12:28:55 | 作者: Admin ]
uploads/200701/17_152728_solidicosahedron.jpg

/*
 *
 */
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 ) ;
...

阅读全文...

绘制线框十二面体

[ 2007-01-17 12:27:12 | 作者: Admin ]
uploads/200701/17_152559_wiredodecahedron.jpg

/*
 *
 */
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 ) ;
...

阅读全文...

绘制实心圆环

[ 2007-01-17 12:25:34 | 作者: Admin ]
uploads/200701/17_152501_solidtorus.jpg

/*
 *
 */
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
...

阅读全文...

绘制线框圆环

[ 2007-01-17 12:24:31 | 作者: Admin ]
uploads/200701/17_152357_wiretorus.jpg

/*
 *
 */
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(
...

阅读全文...

绘制线框圆柱体

[ 2007-01-17 12:21:23 | 作者: Admin ]
uploads/200701/17_152230_wirecylinder.jpg


需要使用到前面的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;
...

阅读全文...

绘制实心的圆柱体

[ 2007-01-17 11:36:34 | 作者: Admin ]
uploads/200701/17_152104_solidcylinder.jpg


需要使用到前面的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;
...

阅读全文...
ħ˽ ħ˽ : ϲ ϲվ ϲʿ ϲʿ ϲʿ ϲվ ϲ ϲվ ϲ ϲ ͸۾ ˽ ѾѾַ document.write("");