POV-Ray : Newsgroups : povray.newusers : Follow the inner contour in a merge : Re: Follow the inner contour in a merge Server Time
29 Jul 2024 16:25:07 EDT (-0400)
  Re: Follow the inner contour in a merge  
From: Mike Williams
Date: 10 Aug 2005 09:49:43
Message: <HXHSqAAbGg+CFwDH@econym.demon.co.uk>
Wasn't it Oleguer Vilella who wrote:
>Hi all,
>
>First I'm going to put a small part of code:
>======================================
>merge{
>sphere { <0, 0, 0>, 1
>translate -0.5*x
>scale <1.2, 0, 0>
>}
>sphere { <0, 0, 0>, 0.5
>translate 0.7*x
>scale <1.4, 0, 0>
>}
>======================================
>After that I've the transformations, the colors and I've clipped_by with a 
>plane { z, 0} and it's empty using hollow.
>
>Now I want to put a thread following the inside part of the two spheres. The 
>only way is creating a spline and using it like a function?

Have you considered using torus sections?

If you create a torus so that R1+R2 is equal to the radius of the
sphere, apply any required rotations, translate and scale exactly like
the spherical part that it's following, then difference the other sphere
and plane. Like this



global_settings {assumed_gamma 1.0}
camera {location  <5,0,4> look_at <0.3,0,0> angle 25}
background {rgb 1}
light_source {<-30, -30, 30> color rgb 1}
light_source {<0, 0, 30> color rgb 1}

// Main shape
merge{
  sphere { <0, 0, 0>, 1
   translate -0.5*x
   scale <1.2, 1, 1>
  }
  sphere { <0, 0, 0>, 0.5
   translate 0.7*x
   scale <1.4, 1, 1>
  }
 clipped_by {plane { z, 0}}
 pigment {rgb x}
} 
  
// Threads in the large part  
#declare N=0;
#declare S=seed(123);  
difference {
  union {
    #while (N<20)  
      torus {0.98,0.02
        rotate <rand(S),rand(S),rand(S)>*360
      }
      #declare N=N+1;
    #end
    translate -0.5*x
    scale <1.2, 1, 1>
  }  
  sphere { <0, 0, 0>, 0.5
   translate 0.7*x
   scale <1.4, 1, 1>
  }
  plane {z,0 inverse}      
  pigment {rgb 1}
}

// Threads in the small part  
#declare N=0;
difference {
  union {
    #while (N<10)  
      torus {0.48,0.02
        rotate <rand(S),rand(S),rand(S)>*360
      }
      #declare N=N+1;
    #end
    translate 0.7*x
    scale <1.4, 1, 1>
  }  
  sphere { <0, 0, 0>, 1
   translate -0.5*x
   scale <1.2, 1, 1>
  }
  plane {z,0 inverse}      
  pigment {rgb 1}
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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