POV-Ray : Newsgroups : povray.general : Contigous height_fields and round corners. : Re: Contigous height_fields and round corners. Server Time
5 Aug 2024 14:17:48 EDT (-0400)
  Re: Contigous height_fields and round corners.  
From: Gilles Tran
Date: 8 Sep 2002 13:05:37
Message: <3d7b8361@news.povray.org>

3d7b7fd0@news.povray.org...
> I have two height_fields and I want them to create a round corner instead
of a sharp
> one. I thought about cutting the height_fields (which come from a seamless
bitmap)
> and rotating these thin "slices" around the y axis... but maybe there are
more
> efficient ways to accomplish this (hmm... displacing an iso cylinder?).

I used the slicing method once for my IRTC "fortress" image. The height
field I used were rough so that I didn't have to use many slices (I think 3
to 5 did the trick). Note that I was folding one HF in 2,  not joining two
of them but since you're using a seamless bitmap it should be the same
technique.
Oh well the macro's here:

#macro mHFCorner(HF,xHF,yHF,zHF,rCorner,nCorner)
    // the HF must be already textured and vertical
    // it must have been translated before to be in the positive z
    // xHF = width of front pane (x, 0 -> xHF)
    // yHF = height of side pane (y, 0 -> yHF)
    // zHF = depth of side pane (z, 0 -> zHF)
    // rCorner = radius of corner
    // nCorner = number of corner elements

    #local lHF=xHF+zHF+rCorner*(-2+pi/2);
    #local HF=object{HF scale <lHF,yHF,1>}
    #local iCorner=(rCorner*pi/2)/nCorner;
    #local i=0;
    union{
        object{HF clipped_by{plane{x,xHF-rCorner}}}
        #while (i<nCorner)
            object{HF clipped_by{box{<0,-0.1,-1.1>,<iCorner,yHF*1.1,1.1>
translate x*(xHF-rCorner+i*iCorner)}}
                translate -x*(xHF-rCorner+(i+0.5)*iCorner)
                translate z*-rCorner
                rotate -y*(i*90/nCorner+45/nCorner)
                translate z*rCorner+x*(xHF-rCorner)
            }
            #local i=i+1;
        #end
        object{HF clipped_by{plane{x,lHF-zHF+rCorner inverse}}
translate -x*(lHF-rCorner-zHF) rotate y*-90 translate <xHF,0,-rCorner>} //
pigment{Cyan}}
    }
#end


G.


--
**********************
http://www.oyonale.com
**********************
- Graphic experiments
- POV-Ray and Poser computer images
- Posters


Post a reply to this message

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