POV-Ray : Newsgroups : povray.advanced-users : From sphere_sweep to parametric object Server Time
25 Nov 2024 07:33:36 EST (-0500)
  From sphere_sweep to parametric object (Message 1 to 4 of 4)  
From: Pyry
Subject: From sphere_sweep to parametric object
Date: 14 Apr 2003 09:50:11
Message: <web.3e9abc268586969c4e4f24990@news.povray.org>
I think I managed to convert a sphere_sweep to a parametric object (well
almost).
Here is an example just in case anyone is interested. I haven't finished it
yet but it should work... Warning It take's a while to parse and render!

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

//An example of converting a sphere_sweep to a parametric object by:Pyry
Pakkanen


global_settings{ assumed_gamma 1 }
#include "functions.inc"

camera{
location <0,2,-3>
look_at <0,0,0>
}
background {color rgb<0.91,0.92,0.95>}
light_source{<-100,100,-100> color rgb 1}


#declare S = function {
   spline {
     natural_spline
      0, < 1, 0, 0.0>,
    0.25, < 0, 0.25, -1>,
    0.5, < -1, 0.5, 0>,
     0.75, < 0, 0.75, 1>,
       1, < 1, 1,  0  >,

   }
 }



#declare n = 0.01; //The accuracy for the "derivation"

#declare DELTA_x = function(u) {S(u+n).x-S(u).x}
#declare DELTA_y = function(u) {S(u+n).y-S(u).y}
#declare DELTA_z = function(u) {S(u+n).z-S(u).z}

#declare PHI = function(u) {f_ph(DELTA_x(u),DELTA_y(u),DELTA_z(u))}
#declare THETA = function(u) {f_th(DELTA_x(u),DELTA_y(u),DELTA_z(u))}


#declare Radius = .2;
parametric{

#declare f_x =
function(u,v){S(u).x+cos(THETA(u))*sin(v)*Radius+sin(THETA(u))*cos(PHI(u))*cos(v)*Radius}
        function{f_x(u,v)}

#declare f_y = function(u,v){S(u).y+sin(PHI(u))*cos(v)*Radius}
        function{f_y(u,v)}

#declare f_z =
function(u,v){S(u).z+cos(THETA(u))*cos(PHI(u))*cos(v)*Radius-sin(THETA(u))*sin(v)*Radius}
        function{f_z(u,v)}

<0,0>,<1-n,2*pi> //note 2-n! DELTA_x,DELTA_y and DELTA_z would continue
beyond the spline's range. This prevents it.
contained_by{box{-pi*100,pi*100}}
max_gradient 0
accuracy 0.01
precompute 16 x,y,z
pigment{color red 1}
no_shadow
}


Post a reply to this message

From: ingo
Subject: Re: From sphere_sweep to parametric object
Date: 14 Apr 2003 10:28:33
Message: <Xns935DA809F8F84seed7@povray.org>
in news:web.3e9abc268586969c4e4f24990@news.povray.org Pyry wrote:

> Warning It take's a while to parse and render! 

For increased speed you may want to try it with my parametric include 
file, it works fine with your sweep.
http://members.home.nl/seedseven/


Post a reply to this message

From: Pyry
Subject: Re: From sphere_sweep to parametric object
Date: 14 Apr 2003 13:15:08
Message: <web.3e9aeb6e9abf51764066f1100@news.povray.org>
ingo wrote:
>
>For increased speed you may want to try it with my parametric include
>file, it works fine with your sweep.
>http://members.home.nl/seedseven/
>
Thanks! 8D
Now I can test new features a lot faster. I think the round end-caps should
be implemented now.

btw. Can I then add an inside_vector to the parametric sphere_sweep?


Post a reply to this message

From: ingo
Subject: Re: From sphere_sweep to parametric object
Date: 14 Apr 2003 14:24:41
Message: <Xns935DD012F509Fseed7@povray.org>
in news:web.3e9aeb6e9abf51764066f1100@news.povray.org Pyry wrote:

> btw. Can I then add an inside_vector to the parametric sphere_sweep?
> 

Once a mesh is closed you can add an inside vector.
When using the Parametric include you'll have to write the mesh to a file 
and then add the inside vector manually, or modify the macro so it adds it 
automaticly.

Ingo


Post a reply to this message

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