POV-Ray : Newsgroups : povray.newusers : isosurfaces problem (hello Mike) : Re: isosurfaces problem (hello Mike) Server Time
29 Jul 2024 20:27:59 EDT (-0400)
  Re: isosurfaces problem (hello Mike)  
From: Mike Williams
Date: 26 Feb 2005 08:29:29
Message: <kg9qHOAqmHICFwF5@econym.demon.co.uk>
Wasn't it Mike Williams who wrote:
>
>Wasn't it kurtz le pirate who wrote:
>>hello,
>>
>>i want to model cable with 2 parts : cylindrical and part of torus.

Upon further experimentation, I found a much easier way to do it.
You still need to flip the axes, but you could do that in the cableTorus
definition and keep only the single cableFunction definition.

The new trick is to use "f_th(x,y,z)*MajorRadius" in the cableTorus
variable substitution instead of just "f_th(x,y,z)". Multiplying by
MajorRadius increases the number of helical turns and things don't go
horribly wrong this way. 

So the whole thing now looks like this:

//hello,

//i want to model cable with 2 parts : cylindrical and part of torus.

//for cylindrical, i have no problem. code i use is :


#version 3.6;

global_settings {assumed_gamma 1.0}

camera {location  <0,0,-50> look_at <0,80,0>}
background {rgb 1}
light_source {<0, 100, -30> color rgb 1}
#include "functions.inc"


#declare p1 = 8;    // number of helixes 
#declare p2 = 0.25; // number of turns per unit length 
#declare p3 = 1.75; // minor radius
#declare p4 = 1.50; // major radius
#declare p5 = 1.00; // shape parameter
#declare p6 = 1;    // cross section type -> circle
#declare p7 = 0;    // cross section rotation angle

#declare containerSize = 3.2;
#declare maxGradiantValue = 2;
#declare cableLen = 80.00;
#declare MajorRadius = 80.00;

#declare cableFunction = function { 
        f_helix1(x, y, z, p1, p2, p3, p4,p5, p6, p7) }

#declare cableCyl = isosurface {
  function { cableFunction(x,y,z) }
  contained_by { 
    box { <+containerSize, 0.00, +containerSize>
         <-containerSize, -cableLen, -containerSize>   }
    }
  max_gradient maxGradiantValue
  }

#declare maxGradiantValue = 6;

#declare cableTorus = isosurface {
  function { cableFunction(f_r(x,y,z)-MajorRadius, 
        f_th(x,y,z)*MajorRadius, y) }
  contained_by { 
    sphere { 0,MajorRadius*1.2 }
    }
  max_gradient maxGradiantValue
  rotate 90*x 
}

intersection {
   object {cableTorus}
   box {<0,-MajorRadius*1.2,-MajorRadius*1.2>
        <MajorRadius,MajorRadius*1.2,MajorRadius*1.2>}
   pigment {rgb 1}
}

object {cableCyl pigment {rgb 1} rotate- z*90 translate y*MajorRadius }



-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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