POV-Ray : Newsgroups : povray.binaries.images : SpheriCoil Server Time
8 Aug 2024 06:20:18 EDT (-0400)
  SpheriCoil (Message 1 to 8 of 8)  
From: PM 2Ring
Subject: SpheriCoil
Date: 20 Sep 2005 10:25:01
Message: <web.43301a0773537101cf00e1300@news.povray.org>
Here's an isosurface that I tried to do ages ago, & couldn't get it right,
because I didn't use pi properly with f_th() & f_ph(). Here's the code to
play with:

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

// Persistence of Vision Ray Tracer Scene Description File
// File: SpheriCoil.pov
// Vers: 3.6
// Desc: Spiral Ball, using Isosurface
// Date: 2005.09.10
// Auth: PM 2Ring
//
//  -D +A0.1 +AM2 +R2
//  -F +A0.6 +AM2 +R2
//

#version 3.6;

#include "math.inc"

#declare Do_Iso=1;                 //1: do isosurface object(s), 0: do
sphere placeholders
#declare Do_Single=0;              //1: do a single object, 0: do a grid of
objects

#declare Do_Floor=1;
#declare Do_Sky=1;

global_settings {
  assumed_gamma 1.0
  //max_trace_level 10
}

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

//Centered modulus
#declare scmod = function(a,b) {mod(abs(a),2*b)-b}

//Spiral ball. Parameters. W: winding number, M: number of arms, CR:
Cylinder radius as a ratio
#macro SpheriCoil(W, M, CR)
  #local CRad = CR / W;             //Cylinder radius
  #local BRad = 1 + 2*CRad;         //Bounding radius

  #local TAN = 0.5 * M / W ;        //Tangent of angle that cylinders make
with X-axis
  #local C = 1 / f_r(0, 1, TAN);    //Cos
  #local S = C * TAN;               //Sin
  #local A = pi * S / M;            //Distance between cylinder centres

  //Shape function
  //cylinders parallel to x axis in xz plane
  #local f_Cyls = function {f_r(0, y, scmod(z,A)) - CRad}

  //rotate around y
  #local f_Spy = function{f_Cyls(0, y, C*z-S*x)}

  //wrap around sphere to get final function
  #local f_SpyBall = function{f_Spy(f_th(x,y,z), 1-f_r(x,y,z), f_ph(x,y,z))}

  //SpheriCoil
  #if(Do_Iso)
    isosurface{
      function{f_SpyBall(x,y,z)}
      contained_by {sphere{0, BRad}}
      max_gradient 40
      accuracy 5e-3
  #else
    sphere{0, BRad
  #end

    scale 1/BRad

    texture{TRainbow}

    //rotate 45*y
    rotate -45*x
  }
#end

// ---Textures-----------------------------

#declare cmRainbow =
color_map{
  [0 red 1]
  [0.166 rgb<1,1,0>]
  [0.333 green 1]
  [0.5 rgb<0,1,1>]
  [0.666 blue 1]
  [0.833 rgb<1,0,1>]
  [1 red 1]
}

#declare TRainbow =
texture{
  pigment{
    radial
    //onion scale .3 phase .75
    color_map{cmRainbow}
  }
  finish{
    specular .5 roughness 1e-3
    ambient .1 diffuse .8 reflection .1
  }
}

//---The Scene-------------------------------------

//Object(s)
#if(Do_Single)
  //A single Sphericoil
  #declare D = 3;
  #declare MX = 1;
  object{
    SpheriCoil(3, 6, .5)
    translate <0,1,1>
  }
#else
  //Make a grid of SpheriCoils
  #declare D = 3;
  #declare MX = 5;
  #declare MZ = MX;

  #declare Z=0;
  #while(Z<MZ)
    #declare X=0;
    #while(X<MX)
      object{
        SpheriCoil(Z+1, X+1, .5)
        translate <(X+.5-MX/2)*D, 1, (Z+.5-MZ/2)*D*1.5>
      }
      #declare X=X+1;
      #if(X=0)#declare X = 1;#end
    #end
    #declare Z=Z+1;
  #end
#end

//Stage
#if(Do_Sky)
  sphere {0,1 inverse
    pigment {
      function{abs(y)}
      color_map {
        [0.0 rgb <.1, .15, .5>]
        [0.6 rgb <.8,.8,1>]
        [.8 rgb 1]
        [1 rgb <1,1,.9>]
      }
    }
    finish{ambient 1 diffuse 0} //No good for radiosity!!!
    scale 125
  }
#else
  background{rgb .5}
#end

#if(Do_Floor)
  plane {
    y, -1e-3
    pigment {
      checker rgb .85, rgb 0 scale 1.5
      rotate 45*y
    }
    finish{
      ambient 0.1 diffuse 0.85
      reflection 0.175
    }
  }
#end

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

camera {
  right x*image_width/image_height up y
  direction z
  location  <0, 3.75, -6> * MX * D * .28
  look_at   -y*.5
  angle 40
}

light_source {<1,1,-2>*10 rgb 1}

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


Post a reply to this message


Attachments:
Download 'sphericoilbw0.jpg' (112 KB)

Preview of image 'sphericoilbw0.jpg'
sphericoilbw0.jpg


 

From: PM 2Ring
Subject: Re: SpheriCoil
Date: 20 Sep 2005 10:30:01
Message: <web.43301cc8ec59577fcf00e1300@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:
> Here's an isosurface that I tried to do ages ago, & couldn't get it right,

And here's a flawed one, from last December.


Post a reply to this message


Attachments:
Download 'isotuteh1.jpg' (51 KB)

Preview of image 'isotuteh1.jpg'
isotuteh1.jpg


 

From: Paolo Gibellini
Subject: Re: SpheriCoil
Date: 20 Sep 2005 12:53:35
Message: <43303e8f$1@news.povray.org>
Abstract and nice,
;-)
Paolo

> "PM 2Ring" wrote
> Here's an isosurface that I tried to do ages ago, & couldn't get it right,
> because I didn't use pi properly with f_th() & f_ph().


Post a reply to this message

From: Thomas de Groot
Subject: Re: SpheriCoil
Date: 21 Sep 2005 04:20:06
Message: <433117b6@news.povray.org>
I like that!!

Thomas


Post a reply to this message

From: Sebastian H 
Subject: Re: SpheriCoil
Date: 21 Sep 2005 08:11:46
Message: <43314e02$1@news.povray.org>
Nice One!

Sebastian


Post a reply to this message

From: Janet
Subject: Re: SpheriCoil
Date: 22 Sep 2005 18:10:01
Message: <web.43332ba0ec59577fa517c74b0@news.povray.org>
Oh, that's groovy!


Post a reply to this message

From: Stephen McAvoy
Subject: Re: SpheriCoil
Date: 22 Sep 2005 18:19:45
Message: <lfb6j1tc37qnhaq923ve5gbfum4p5runt5@4ax.com>
On Thu, 22 Sep 2005 18:09:36 EDT, "Janet" <par### [at] attnet>
wrote:

>Oh, that's groovy!
>
Groovy?

Regards
        Stephen


Post a reply to this message

From: PM 2Ring
Subject: Re: SpheriCoil
Date: 24 Sep 2005 11:05:01
Message: <web.433569e4ec59577fd120a2660@news.povray.org>
Stephen McAvoy <mca### [at] aolcom> wrote:
> On Thu, 22 Sep 2005 18:09:36 EDT, "Janet" <par### [at] attnet>
> wrote:
>
> >Oh, that's groovy!
> >
> Groovy?

Yeah, like psychedelic, man. :)

Thanks, everyone, for the compliments!


Post a reply to this message

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