POV-Ray : Newsgroups : povray.general : Twist an isosurface Server Time
31 Jul 2024 20:22:52 EDT (-0400)
  Twist an isosurface (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: dave vanhorn
Subject: Re: Twist an isosurface
Date: 19 Dec 2006 20:22:09
Message: <45889041$1@news.povray.org>
#ifndef (SolidHeart)
    #ifndef (TwistHeart)
     // Original untwisted version
     #declare Heart_Function = function { f_torus 
(y-pow(abs(x),Sharpness)*Bend, z*1, x, 0.8,0.1) }
    #else
      //Twisted version
      #declare K = 1; //Not sure where to set this yet, try 1.0
      #declare f = function {K*y}
      #declare Twist_x = function(x,y,z,f) //<-- Errors here with "expected 
parameter identifier, function identifier found instead"
                         {x * cos (f (y)) + z * sin (f (y))}

      #declare Twist_z = function(x,y,z,f)
                         {(-x * sin (f (y)) + z * cos (f (y))}

      #declare Heart_Function = function { f_torus (y-pow(abs(x * cos (f 
(y)) + z * sin (f (y))),Sharpness)*Bend,
                                                   (-x * sin (f (y)) + z * 
cos (f (y))*1),
                                                   (x * cos (f (y)) + z * 
sin (f (y))),
                                                   0.8,0.1) }
    #end
  #else
    #declare Heart_Function = function { f_sphere 
(y-pow(abs(x),Sharpness)*Bend, z*2, x, 0.6    ) }
  #end


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Twist an isosurface
Date: 20 Dec 2006 07:07:09
Message: <4589276d$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dave vanhorn wrote:
>       #declare Twist_x = function(x,y,z,f) //<-- Errors here with "expected 
> parameter identifier, function identifier found instead"

	Replace this line with:
#declare Twist_x = function(x, y, z)

	You can't pass a function identifier as a parameter to another
function, but you don't need to to be able to call it (huh, does
that sentence make sense?).

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeb### [at] freefr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeb### [at] jabberfr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFiSdtd0kWM4JG3k8RAonfAJ91MyMpKoIaopYBBFFfHQ3B8jLriwCgklTx
yztdKmeOg8vou6y2VdCXH4E=
=vYKm
-----END PGP SIGNATURE-----


Post a reply to this message

From: dave vanhorn
Subject: Re: Twist an isosurface
Date: 20 Dec 2006 09:29:09
Message: <458948b5$1@news.povray.org>
> Replace this line with:
> #declare Twist_x = function(x, y, z)
>
> You can't pass a function identifier as a parameter to another
> function, but you don't need to to be able to call it (huh, does
> that sentence make sense?).

I guess not :)  I'm still lost.  Here's the current implementation


  #ifndef (SolidHeart)
    #ifndef (TwistHeart)
      #declare Heart_Function = function { f_torus 
(y-pow(abs(x),Sharpness)*Bend, z*1, x, 0.8,0.1) }
    #else
      #declare K = 1;
      #declare f = function {K*y}
      #declare Twist_x = function (x,y,z)
                         {x * cos (f (y)) + z * sin (f (y))} <-- "Invalid 
number of parameters, 1 supplied, 3 required.

      #declare Twist_z = function (x,y,z)
                         {(-x * sin (f (y)) + z * cos (f (y))}

      #declare Heart_Function = function { f_torus 
(y-pow(abs(Twist_x),Sharpness)*Bend,
                                                   (Twist_z*2),
                                                   (Twist_x,
                                                   0.8,0.1) }
    #end
  #else
    #declare Heart_Function = function { f_sphere 
(y-pow(abs(x),Sharpness)*Bend, z*2, x, 0.6    ) }
  #end


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Twist an isosurface
Date: 20 Dec 2006 15:42:03
Message: <4589a01b@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dave vanhorn wrote:
>       #declare f = function {K*y}
>       #declare Twist_x = function (x,y,z)
>                          {x * cos (f (y)) + z * sin (f (y))} <-- "Invalid 
> number of parameters, 1 supplied, 3 required.

	The problem is in the declaration for f. Try one of the following
instead:

#declare f = function {K*x}

or

#declare f(y) = function {K*y}

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeb### [at] freefr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeb### [at] jabberfr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFiaAad0kWM4JG3k8RAqoAAKCSVOVlop8PR1C/SnG41ZPLxY9PpwCgmcYj
jZBew4IDM7tRDhN0j2gxWs0=
=pKXr
-----END PGP SIGNATURE-----


Post a reply to this message

From: dave vanhorn
Subject: Re: Twist an isosurface
Date: 20 Dec 2006 22:52:48
Message: <458a0510$1@news.povray.org>
> The problem is in the declaration for f. Try one of the following
> instead:
>
> #declare f = function {K*x}
>
> or
>
> #declare f(y) = function {K*y} <-- This one errors, wants an '=' not '('

      #declare K = 1;
      #declare f = function {K*x}
#declare Twist_x = function (x,y,z) {( ( x * cos (f(y))) + (z * sin 
(f(y))) )}
      #declare Twist_z = function (x,y,z) {( (-x * sin (f(y))) + (z * cos 
(f(y))) )}

      #declare Heart_Function = function { f_torus 
(y-pow(abs(Twist_x),Sharpness)*Bend,
                                                   Twist_z,
                                                   Twist_x,
                                                   0.8,0.1) }


Very frustrated.. :(


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Twist an isosurface
Date: 21 Dec 2006 01:19:20
Message: <458a2768$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dave vanhorn wrote:
>> The problem is in the declaration for f. Try one of the following
>> instead:
>>
>> #declare f = function {K*x}
>>
>> or
>>
>> #declare f(y) = function {K*y} <-- This one errors, wants an '=' not '('
> 
	Uh, yes sorry it should have been:

#declare f = function (y) {K*y}

>       #declare K = 1;
>       #declare f = function {K*x}
> #declare Twist_x = function (x,y,z) {( ( x * cos (f(y))) + (z * sin 
> (f(y))) )}
>       #declare Twist_z = function (x,y,z) {( (-x * sin (f(y))) + (z * cos 
> (f(y))) )}
> 
>       #declare Heart_Function = function { f_torus 
> (y-pow(abs(Twist_x),Sharpness)*Bend,
>                                                    Twist_z,
>                                                    Twist_x,
>                                                    0.8,0.1) }
> 
> 
> Very frustrated.. :(
> 
	Why? Didn't the code you just posted work?

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeb### [at] freefr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeb### [at] jabberfr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFiidld0kWM4JG3k8RAh3DAJ0dF0xytvmN7MlW5BoEXTxc/yN1tQCfc0jJ
N45qh28DOPfPJCP7b0mc+94=
=c0cs
-----END PGP SIGNATURE-----


Post a reply to this message

From: dave vanhorn
Subject: Re: Twist an isosurface
Date: 21 Dec 2006 11:30:40
Message: <458ab6b0@news.povray.org>
>> Very frustrated.. :(
>>
> Why? Didn't the code you just posted work?

Nope, it errors out, I'm not finding the error messages, or even where it's 
pointing to when it errors, to be all that helpful.


Post a reply to this message

From: virtualmeet
Subject: Re: Twist an isosurface
Date: 21 Dec 2006 22:35:00
Message: <web.458b51f9f74d0655f605ab610@news.povray.org>
"dave vanhorn" <mic### [at] gmailcom> wrote:
> >> Very frustrated.. :(
> >>
> > Why? Didn't the code you just posted work?
>
> Nope, it errors out, I'm not finding the error messages, or even where it's
> pointing to when it errors, to be all that helpful.
Hi,
Perhaps K3DSurf can help since it can generate formulas for twisted
isosurfaces from an original one. You can then "see" the result before
using the generated twisted iso in your code. Supported deformations are
twisting and scaling for isosurfaces and parametric surfaces.
Cheers,
Taha


Post a reply to this message

From: Thomas de Groot
Subject: Re: Twist an isosurface
Date: 22 Dec 2006 03:35:31
Message: <458b98d3@news.povray.org>
I have tweaked a bit some parts, but this works as it should:

#declare Bend=0.5;
#declare Sharpness=0.8;
#declare SolidHeart = 0;
#declare TwistHeart = 1;

 #if (!SolidHeart)
    #if (!TwistHeart)
     // Original untwisted version
     #declare Heart_Function =
       function { f_torus (y-pow(abs(x),Sharpness)*Bend, z*1, x, 0.8,0.1) }
    #else
      //Twisted version
      #declare K = 1; //twist angle
      #declare f = function (y){K*y}
      #declare Twist_x = function (x,y,z){( x*cos(f(y)) + z*sin(f(y)))}
      #declare Twist_z = function (x,y,z){(-x*sin(f(y)) + z*cos(f(y)))}

      #declare Heart_Function =
        function { f_torus (y-pow(abs(Twist_x(x,y,z)),Sharpness)*Bend, 
Twist_z(x,y,z)*1,Twist_x(x,y,z), 0.8,0.1) }
    #end
  #else
    #declare Heart_Function = function { f_sphere 
(y-pow(abs(x),Sharpness)*Bend, z*2, x, 0.6    ) }
  #end


Thomas


Post a reply to this message

From: dave vanhorn
Subject: Re: Twist an isosurface
Date: 22 Dec 2006 15:12:50
Message: <458c3c42$1@news.povray.org>
"Thomas de Groot" <t.d### [at] internlDOTnet> wrote in message 
news:458b98d3@news.povray.org...
>I have tweaked a bit some parts, but this works as it should:

I see!  Thanks so much.  I was fumbling in the dark there.


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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