POV-Ray : Newsgroups : povray.general : Twist an isosurface Server Time
31 Jul 2024 18:17:37 EDT (-0400)
  Twist an isosurface (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: dave vanhorn
Subject: Twist an isosurface
Date: 19 Dec 2006 00:03:17
Message: <45877295$1@news.povray.org>
Is there any way to apply a linear twist to an isosurface?

What I'm after is to twist the heart iso, by about 30 degrees, (+/- 15) 
along the Y axis.


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Twist an isosurface
Date: 19 Dec 2006 03:26:08
Message: <4587a220$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dave vanhorn wrote:
> Is there any way to apply a linear twist to an isosurface?
> 
> What I'm after is to twist the heart iso, by about 30 degrees, (+/- 15) 
> along the Y axis.
> 
> 
	Replace x by (x * cos (f (y)) + z * sin (f (y))
	Replace z by (-x * sin (f (y)) + z * cos (f (y))

	Where f is a function that defines the way you want the surface to
twist (the simplest being K*y for some constant K).

		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)

iD4DBQFFh6Idd0kWM4JG3k8RAvd0AJiagT8lHXsA0eBixWRAozGS8TawAJ4oBbo1
4ZEwfkyQZMASWwlP5vDOqQ==
=T0fP
-----END PGP SIGNATURE-----


Post a reply to this message

From: Warp
Subject: Re: Twist an isosurface
Date: 19 Dec 2006 03:54:00
Message: <4587a8a8@news.povray.org>

>         Replace x by (x * cos (f (y)) + z * sin (f (y))
>         Replace z by (-x * sin (f (y)) + z * cos (f (y))

  Instead of replacing them, wouldn't it be simpler to call the function
with those parameters?

-- 
                                                          - Warp


Post a reply to this message

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

Goto Latest 10 Messages Next 3 Messages >>>

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