|
![](/i/fill.gif) |
Had to vectorise the vectors for this one, the turns bank properly and the
rails never leave their supports. Here is the code for the track building.
#while (section < sections-1)
#declare bear1 = tpoints1[section][0];
#declare bear2 = tpoints1[section+1][0];
#declare azim1 = tpoints1[section][1];
#declare azim2 = tpoints1[section+1][1];
#declare roll1 = tpoints1[section][2];
#declare roll2 = tpoints1[section+1][2];
#declare xpos1 = tpoints1[section][3];
#declare xpos2 = tpoints1[section+1][3];
#declare ypos1 = tpoints1[section][4];
#declare ypos2 = tpoints1[section+1][4];
#declare zpos1 = tpoints1[section][5];
#declare zpos2 = tpoints1[section+1][5];
// Components
#declare xcomp1 = abs(w1 * sind(roll1) * sind(azim1));
#declare xcomp2 = abs(w1 * sind(roll2) * sind(azim2));
#declare ycomp1 = w1 * sind(roll1) * cosd(azim1);
#declare ycomp2 = w1 * sind(roll2) * cosd(azim2);
#declare zcomp1 = w1 * cosd(roll1);
#declare zcomp2 = w1 * cosd(roll2);
// Left Rail
#declare lrx1 = xpos1 + xcomp1 * cosd(bear1) - zcomp1 * sind(bear1);
#declare lrx2 = xpos2 + xcomp2 * cosd(bear2) - zcomp2 * sind(bear2);
#declare lry1 = ypos1 - ycomp1;
#declare lry2 = ypos2 - ycomp2;
#declare lrz1 = zpos1 + xcomp1 * sind(bear1) + zcomp1 * cosd(bear1);
#declare lrz2 = zpos2 + xcomp2 * sind(bear2) + zcomp2 * cosd(bear2);
// Right Rail
#declare rrx1 = xpos1 - xcomp1 * cosd(bear1) + zcomp1 * sind(bear1);
#declare rrx2 = xpos2 - xcomp2 * cosd(bear2) + zcomp2 * sind(bear2);
#declare rry1 = ypos1 + ycomp1;
#declare rry2 = ypos2 + ycomp2;
#declare rrz1 = zpos1 - xcomp1 * sind(bear1) - zcomp1 * cosd(bear1);
#declare rrz2 = zpos2 - xcomp2 * sind(bear2) - zcomp2 * cosd(bear2);
#cylinder {<lrx1,lry1,lrz1> <lrx2,lry2,lrz2> 0.025 pigment {rgb <1,0,0>}
}
#cylinder {<rrx1,rry1,rrz1> <rrx2,rry2,rrz2> 0.025 pigment {rgb <0,0,1>}
}
#sphere {<lrx1,lry1,lrz1> 0.025 pigment {rgb <1,0,0>} }
#sphere {<rrx1,rry1,rrz1> 0.025 pigment {rgb <0,0,1>} }
#declare section = section + 1;
#end
Post a reply to this message
Attachments:
Download 'coaster9lq.mpg' (323 KB)
|
![](/i/fill.gif) |