Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Cyl.cpp
Package: OpenGL动画演示(包含代码).rar [view]
Upload User: sz83729876
Upload Date: 2013-03-07
Package Size: 4140k
Code Size: 1k
Category:
OpenGL program
Development Platform:
Windows_Unix
- ////test
- #define EPS (1e-49)
- void vector_sub(float *c, float *a, float *b)
- {
- int i;
- for (i=0; i<3; i++)
- {
- c[i]=a[i]-b[i];
- }
- }
- void vector_add(float *c, float *a, float *b)
- {
- int i;
- for (i=0; i<3; ++i)
- {
- c[i]=a[i]+b[i];
- }
- }
- void vector_cross(float *c, float *a, float *b)
- {
- c[0]=a[1]*b[2] - a[2]*b[1];
- c[1]=a[2]*b[0] - a[0]*b[2];
- c[2]=a[0]*b[1] - a[1]*b[0];
- }
- void vector_normalize(float *c)
- {
- float l,m;
- l=(float) sqrt(c[0]*c[0] + c[1]*c[1] + c[2]*c[2]);
- if (fabs(l)<EPS)
- {
- c[0]=c[1]=c[2]=0.0f;
- if ((c[0]>=c[1]) && (c[0]>=c[2]))
- {
- c[0]=1.0f;
- }
- else
- if (c[1]>=c[2])
- {
- c[1]=1.0f;
- }
- else
- {
- c[2]=1.0f;
- }
- }
- else
- {
- m=1.0f/l;
- c[0]*=m;
- c[1]*=m;
- c[2]*=m;
- }
- }
- void vector_normal(float *n, float *a, float *b, float *c)
- {
- float p[3],q[3];
- vector_sub(p,c,b);
- vector_sub(q,a,b);
- vector_cross(n,p,q);
- vector_normalize(n);
- }
- #include "3d_intro.h"
- ///////////////// test !!!!!!!!!