POV-Ray : Newsgroups : povray.binaries.images : Thightening an iso? : Re: Thightening an iso? Server Time
14 Aug 2024 03:17:25 EDT (-0400)
  Re: Thightening an iso?  
From: Tor Olav Kristensen
Date: 27 Dec 2002 14:35:07
Message: <web.3e0caa5e170f18127d655a8f0@news.povray.org>
Simon Lemieux wrote:
>Hi,
>  I was wondering if any of you knew how to make the following red
>isosurface into something that look more like the yellow cylinder CSG?
>ie. scaling the sinusoidal shape of the isosurface, but keeping the
>small radius it has.
....

You may try the code below.

Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Copyright 2002 by Tor Olav Kristensen
// Email: t o r _ o l a v _ k [ a t ] h o t m a i l . c o m
// http://home.no/t-o-k
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.5;

#include "functions.inc"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare IntervalFn =
  function(A, I, S) {
    mod(A - S + select(A - S, -1, 1)*I/2, I)
    - select(A - S, -1, 1)*I/2
  }

#declare yFn =
  function(x, y, z, I) { IntervalFn(y, I, I/2*atan2(z, x)/pi) }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare Rmaj = 12;
#declare Rmin = 1;
#declare Interval = 10;

isosurface {
  function { f_torus(x, yFn(x, y, z, Interval), z, Rmaj, Rmin) }
  contained_by {
    box {
      -<Rmaj + Rmin, 25, Rmaj + Rmin>,
       <Rmaj + Rmin, 25, Rmaj + Rmin>
    }
  }
//  max_gradient 10
  pigment { color rgb <1, 1, 1> }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

background { color blue 0.5 }

light_source {
  <1, 1, -1>*100
  color rgb <1, 1, 1>
}

camera {
  location <2, 0, -1>*30
  look_at 0*y
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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