Changeset 339

Show
Ignore:
Timestamp:
03/19/07 01:33:11 (1 year ago)
Author:
cweider2
Message:

LZ3DTorus: expose parameters for toroid

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/LaserLine_2.0/Src/Sequencing/Generators/LZ3DTorus.h

    r338 r339  
    1212#import "LZSequenceableElement.h" 
    1313 
    14 #define PI 3.1415926535 
    15  
    16  
    1714@interface LZ3DTorus : LZSequenceableElement 
    1815{ 
    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 
    2021} 
    2122 
  • trunk/LaserLine_2.0/Src/Sequencing/Generators/LZ3DTorus.m

    r338 r339  
    2424        if(self) 
    2525        { 
    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; 
    2737        } 
    2838        return self; 
     
    3444        gettimeofday(&time,NULL); 
    3545         
    36         unsigned pointCount = 500; 
     46        unsigned pointCount = 1000; 
    3747        RawPoint *points = malloc(sizeof(RawPoint)*pointCount); 
    3848        RawFrame frame = {points, pointCount}; 
    3949         
    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; 
    4653         
    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; 
    4857                 
    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)); 
    5461                 
    5562                float y1 = y0*cosf(xrot)-z0*sinf(xrot);