POV-Ray : Newsgroups : povray.general : Wrapping a HF around a Cylinder : Re: Wrapping a HF around a Cylinder Server Time
7 Aug 2024 07:16:38 EDT (-0400)
  Re: Wrapping a HF around a Cylinder  
From: Mike Williams
Date: 3 Nov 2001 07:53:44
Message: <DRAHLFAr+647Ew1C@econym.demon.co.uk>
Wasn't it Cris Williams who wrote:

>I seem to recall someone describing a way to wrap a heightfield around a
>cylinder.  Does anyone else remember this, or was I just dreaming?

You may not be able to wrap a height_field round a cylinder, but you can
wrap an image_map pigment around a cylinder (using map_type 2). In v3.5
any pigment can be used as an isosurface function, so we can combine the
cylindrical image_map function with a cylindrical isosurface.

Note: I've applied a scaling of y/pi to the HF function in this example,
so that a square heightfield image looks correctly proportioned when
stretched round a cylinder. Alternatively create a heightfield image
that is pi times wider than it is high.


camera { location  <0, 2, -6> look_at <0, 0, 0>}

light_source {<-100,200,-100> colour rgb 1}
light_source {<100,-200,-100> colour rgb 1}

// ----------------------------------------

#declare  Cyl = function {x^2 + z^2 -1}
#declare  HF  = function {pigment {image_pattern {jpeg "foo.jpg"
map_type 2 interpolate 2}}}

#declare F=function{Cyl(x,0,z) - HF(x,y/pi,z).grey} // See Note

isosurface {
  function { F(x,y,z) }
        max_gradient 20
        contained_by{box{-1.5,1.5}}
        pigment {rgb 1}
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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