POV-Ray : Newsgroups : povray.advanced-users : sinewave wrapped around a cylinder : Re: sinewave wrapped around a cylinder Server Time
4 Oct 2024 17:08:57 EDT (-0400)
  Re: sinewave wrapped around a cylinder  
From: Trevor G Quayle
Date: 1 Oct 2007 12:30:00
Message: <web.47012051eb21779cc150d4c10@news.povray.org>
"Leef_me" <nomail@nomail> wrote:
> I have seen a drinking glass design that has metal embedded in it. The shape
> seems to be a sinewave, or rather 4 periods of a sinewave.

Meshes can be very fast comparatively.  Try using a heightfield (mesh
object), you can take advantage of the 'radial' pattern and use 'frequency'
and 'sine_wave' to get the appropriate shapes.

Try this which creates a function from such a pattern and uses it to create
a sine-shaped heightfield of user controllable resoulution

//START
global_settings {
  assumed_gamma 1.0
}

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

camera {
        orthographic
  location  <0, 20,-20>
  angle 0
  look_at   <0.0, 0.0,  0.0>
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <50, 50, 50>
}

#declare PIGGY1 =  pigment{radial sine_wave colour_map{[0 rgb 0][1 rgb 1]}
frequency 4 translate 1/2 rotate -x*90} //radial pigment with 4 periods,
sine_wave shape
#declare Func1A = function {pigment{PIGGY1}} //convert to function

difference{
  cylinder{0,y*5,10}
  cylinder{-y*1,y*6,9}
  height_field{function 100,100
{pattern{function{Func1A(x,y,z).gray}}}//100,100 = resoltution, can be
adjusted accordingly
    smooth
    translate <-1/2,0,-1/2> scale <20,3,20>
  }
  pigment{rgb 1}
}
//END

-tgq


Post a reply to this message

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