POV-Ray : Newsgroups : povray.binaries.images : Rail segments assembly problem : Re: Rail segments assembly problem Server Time
5 Nov 2024 13:23:08 EST (-0500)
  Re: Rail segments assembly problem  
From: Martin
Date: 12 Apr 2009 13:16:34
Message: <49e221f2$1@news.povray.org>

> High!
> 
> Martin wrote:
> 
>> You are not taking into account the bended sector rotation
> 
>>         #declare dir= select(RailElements[i][1],1,-1,-1);
>>         #declare pt= vrotate(x*(RailElements[i][2]+diff)*dir,
>>                          RailElements[i][1]*y)-x*RailElements[i][2]*dir;
>>         #declare trans= trans+vrotate(pt,y*d); //<-- solved
> 
>  From 400 metres above, your code looks like a solution... but then I 
> started animating a camera ride along the rail, and when I came to the 
> end of the first curved section, I got the result attached here...
> 
> I just can't figure out the reason... I tried several values for "diff", 
> the closest I found was 0.09 (and -0.09 respectively for left bends), 
> but even then only the end of the right bend roughly fits together with 
> the second straight section, not the end of the second curved (left 
> bend) section visible to the left of the image... I'm totally clueless!
> 
> See you in Khyberspace!
> 
> Yadgar
> 
> ------------------------------------------------------------------------
> 
  Ah, so there are another design problem. The StrightRail() object is 
not centered , and that's what you're seeign. I propose you to center it:

#macro StraightRail(le) // le: length in meters
   [...]
     object { StraightOuterRounding }
     object { StraightOuterRounding translate x*0.59 }
     texture { T_Bright_Metal } translate -0.3*x //<---- center it
   }
#end

Then the BendRail don't need to be off-centre:
#macro BendRail(rd, ang)
    [...]
     object { BendOuterRounding translate y*0.495 }
     object { BendInnerRounding translate y*0.495 }
     texture { T_Bright_Metal } #if(!RevEng)
     #if (ang >= 0)
       translate x*rd //<--------- also centered
     #else
       translate -x*rd
     #end #end
   }
#end

And now there is no need to compute this movement

[...]
     #case (1)
       object
       {
         BendRail(RailElements[i][2], RailElements[i][1])
         rotate y*d
         translate trans
        /*
         #if (RailElements[i][1] >= 0 )
           #declare diff = 0.3;
         #else
           #declare diff = -0.3;
         #end
        */ //<-- simply eliminate this term from the equations.
  [...]
     #break
   #end

cheers.


Post a reply to this message


Attachments:
Download 'rail.jpg' (7 KB)

Preview of image 'rail.jpg'
rail.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.