|
![](/i/fill.gif) |
Thank you Roman, for your help! This works fine.
One question: you use vlength() instead of VDist() and seem not to take
into account the y-component. However, it seems to me that between P1
and P2 the y-component can potentially be of importance especially if
height differences are large. Would that not be compensated by VDist()?
Or vlength(d)?
Thomas
On 14-7-2011 14:08, Roman Reiner wrote:
> In that case it should read Reorient_Trans(<1,0,0>,<d.x, 0, d.z>) where d is,
> again, P2-P1.
>
> Also b = d.x needs to be replaced with b = vlength(<d.x, 0, d.z>).
>
> Altogether:
>
> //Start Code
> #local P1 =<-1.6, 0.1, -.5>;
> #local P2 =< 1.7, 1.5, 1>;
>
> #local Point =
> sphere {
> <0,0,0>, 0.05
> pigment { rgb 1 }
> }
>
> object {Point}
> object {Point translate P1 pigment {rgb<1,0,0>}}
> object {Point translate P2 pigment {rgb<1,1,0>}}
>
> #local Segment =
> box {<0.00, 0.00, -0.010>,<1.00, 0.10, 0.010>}
>
> #declare d = P2-P1;
>
> #local a = 0;
> #local b = vlength(<d.x, 0, d.z>);
> union {
> #while (a< b)
> object {Segment
> translate<a, 0, 0>
> #if (mod(a,2)=0)
> pigment {rgb<0,1,0>}
> #else
> pigment {rgb<0,0,1>}
> #end
> #local a=a+1;
> }
> #end
> clipped_by {plane {x, b}}
> matrix<1 d.y/b, 0,
> 0, 1, 0,
> 0, 0, 1,
> 0, 0, 0>
> Reorient_Trans(x, d*(1-y)) //short for Reorient_Trans(<1,0,0>,<d.x, 0, d.z>)
> translate P1
> }
> //End Code
>
> [Note, that the above version shears the segments by dragging the far end up
> resulting in the originally unit length segments to get longer. If you want them
> to remain at unit length you need to use
>
> clipped_by {plane {x, vlength(d)}}
> matrix<b/vlength(d) d.y/vlength(d), 0,
> 0, 1, 0,
> 0, 0, 1,
> 0, 0, 0>
>
> instead.]
>
> Feel free to ask if you need any explanations!
> Regards Roman
Post a reply to this message
|
![](/i/fill.gif) |