Changeset 339
- Timestamp:
- 03/19/07 01:33:11 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/LaserLine_2.0/Src/Sequencing/Generators/LZ3DTorus.h
r338 r339 12 12 #import "LZSequenceableElement.h" 13 13 14 #define PI 3.141592653515 16 17 14 @interface LZ3DTorus : LZSequenceableElement 18 15 { 19 16 float R, r; //Radius of revolution, of cross-section 17 float A, a; //Aspect Ratio of revolution, of cross-section 18 float w; //Winds around toroid 19 20 float xs,ys,zs;//x,y,z speeds 20 21 } 21 22 trunk/LaserLine_2.0/Src/Sequencing/Generators/LZ3DTorus.m
r338 r339 24 24 if(self) 25 25 { 26 ; 26 R = 2; 27 r = 1; 28 29 A = 1; 30 a = 1; 31 32 w = 40; 33 34 xs = 10; 35 ys = 33; 36 zs = 27; 27 37 } 28 38 return self; … … 34 44 gettimeofday(&time,NULL); 35 45 36 unsigned pointCount = 500;46 unsigned pointCount = 1000; 37 47 RawPoint *points = malloc(sizeof(RawPoint)*pointCount); 38 48 RawFrame frame = {points, pointCount}; 39 49 40 const float Ra = 2; 41 const float Rb = .5; 42 43 float xrot = (time.tv_sec + time.tv_usec/1000000)/500000000*position * 8 * PI; 44 float yrot = (time.tv_sec + time.tv_usec/1000000)/500000000*position * 4.6 * PI; 45 float zrot = (time.tv_sec + time.tv_usec/1000000)/500000000*position * 3.25 * PI; 50 float xrot = (time.tv_sec + time.tv_usec/1000000)/500000000*position * xs; 51 float yrot = (time.tv_sec + time.tv_usec/1000000)/500000000*position * ys; 52 float zrot = (time.tv_sec + time.tv_usec/1000000)/500000000*position * zs; 46 53 47 for (int p = 0 ; p <= pointCount ; p++) { 54 for (int p = 0 ; p <= pointCount ; p++) 55 { 56 float t = p * 2 * 3.14159/pointCount; 48 57 49 float t = p * 2 * PI/pointCount; 50 51 float x0 = cosf(t)*(Ra+Rb*cosf(20*t)); 52 float y0 = sinf(20*t); 53 float z0 = sinf(t)*(Ra+Rb*cosf(20*t)); 58 float x0 = A*cosf(t)*(R+r*cosf(w*t)); 59 float y0 = r*a*sinf(w*t); 60 float z0 = sinf(t)*(R+r*cosf(w*t)); 54 61 55 62 float y1 = y0*cosf(xrot)-z0*sinf(xrot);
