|
 |
"LanuHum" <Lan### [at] yandex ru> wrote:
> "Bald Eagle" <cre### [at] netscape net> wrote:
> > #version 3.8;
> > global_settings {assumed_gamma 1.0 }
> >
> > camera {
> > location <0, 1, -3>
> > right x*image_width/image_height
> > up y
> > look_at <0, 1, 0>
> > }
> >
> > light_source {<10, 20, -50> rgb 1}
> > sky_sphere {pigment {rgb 1}}
> >
> >
> > #declare TPI = 11; // (Threads per inch / TPI)
> > #declare DM = 0.625/2;
> > #declare Dm = 0.5167/2;
> > #declare Angle = 60;
> >
> > #declare Pitch = 1/TPI;
> > #declare CompAngle = 90-Angle;
> > #declare Asin = atan(radians(CompAngle));
> > #declare dx = DM - Dm;
> > #declare dy = dx * Asin;
> > #declare AL = 2*dy; // total Angled length
> > #declare FL = (Pitch - AL)/2; // Flat length
> >
> > // Profile
> > #declare P = array {
> > <Dm, 0, 0>,
> > <DM, dy, 0>,
> > <DM, dy+FL, 0>,
> > <Dm, dy+FL+dy, 0>,
> > <Dm, dy+FL+dy+FL, 0>
> > }
> >
> > #declare OldPoint = array[5][3];
> > #declare NewPoint = array[5][3];
> >
> > #macro MakeBoltProfile (Pitch,Steps, Tex, Copies)
> > #local Increment = tau/Steps;
> > #local Unit =
> > union {
> > #for (Theta, 0, tau, Increment)
> >
> > #for (Pt, 0, 4)
> > #declare NewPoint[Pt][0] = P[Pt].x * cos (Theta);
> > #declare NewPoint[Pt][1] = P[Pt].y + Pitch * Theta/tau;
> > #declare NewPoint[Pt][2] = P[Pt].x * sin (Theta);
> > #end
> >
> > #if (Theta > 0)
> > #for (T, 0, 3)
> > triangle {<OldPoint[T][0], OldPoint[T][1], OldPoint[T][2]>,
> > <NewPoint[T][0], NewPoint[T][1], NewPoint[T][2]>,
> > <OldPoint[T+1][0], OldPoint[T+1][1], OldPoint[T+1][2]>
> > }
> > triangle {<OldPoint[T+1][0], OldPoint[T+1][1],
> > OldPoint[T+1][2]>,
> > <NewPoint[T][0], NewPoint[T][1], NewPoint[T][2]>,
> > <NewPoint[T+1][0], NewPoint[T+1][1], NewPoint[T+1][2]>
> > }
> > #end
> > #end
> >
> > #declare OldPoint = NewPoint;
> > #end
> > texture {Tex}
> > }
> > #for (C, 1, Copies)
> > object {Unit translate y*Pitch*C*1}
> > #end
> > #end
> >
> > #declare MyTex = texture {pigment {rgb 0.9} finish {specular 0.4 reflection
> > 0.01}}
> >
> > MakeBoltProfile (Pitch, 72, MyTex, 25)
>
> Thank you so much. I have no more questions about the topic.
Very glad you're back ! and it looks nice!
Post a reply to this message
|
 |