POV-Ray : Newsgroups : povray.newusers : function help Server Time
27 Nov 2024 23:39:35 EST (-0500)
  function help (Message 1 to 5 of 5)  
From: Mick Hazelgrove
Subject: function help
Date: 12 Feb 2002 04:26:22
Message: <3c68dfbe@news.povray.org>
I want to use a custom function as a  pattern in a pigment statement. Which I shall
then use to create clouds using the plane
method. What I need is the fuction for a spiral!

Mick


Post a reply to this message

From:
Subject: Re: function help
Date: 12 Feb 2002 04:49:23
Message: <30ph6u4qrcdj7jnquuo43p2dfn6ak34eob@4ax.com>
On Tue, 12 Feb 2002 09:26:18 -0000, "Mick Hazelgrove"
<mic### [at] mhazelgrovefsnetcouk> wrote:
> I want to use a custom function as a  pattern in a pigment statement.
> Which I shall then use to create clouds using the plane
> method. What I need is the fuction for a spiral!

I suppose this is not enough for you ?

#local F=function{pattern{spiral1 3}};
#local F=function{pattern{spiral2 7}};

What exactly you want control in this spiral ?
Do you want special kind of spiral ? Archimedes ? Logarithmic ? Hiperbolic ?

ABX


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: function help
Date: 12 Feb 2002 05:20:53
Message: <3c68ec85@news.povray.org>
No they don't produce the pattern I need - I need several spirals, spiral arms all
radiating out from the center point. I need
control over the tightness of the spirals and the number of arms.

Mick


> On Tue, 12 Feb 2002 09:26:18 -0000, "Mick Hazelgrove"
> <mic### [at] mhazelgrovefsnetcouk> wrote:
> > I want to use a custom function as a  pattern in a pigment statement.
> > Which I shall then use to create clouds using the plane
> > method. What I need is the fuction for a spiral!
>
> I suppose this is not enough for you ?
>
> #local F=function{pattern{spiral1 3}};
> #local F=function{pattern{spiral2 7}};
>
> What exactly you want control in this spiral ?
> Do you want special kind of spiral ? Archimedes ? Logarithmic ? Hiperbolic ?
>
> ABX


Post a reply to this message

From:
Subject: Re: function help
Date: 12 Feb 2002 06:32:45
Message: <efrh6u0866ofda0qlah7uqb21vmpc9dvq6@4ax.com>
On Tue, 12 Feb 2002 10:18:54 -0000, "Mick Hazelgrove"
<mic### [at] mhazelgrovefsnetcouk> wrote:
> No they don't produce the pattern I need - I need several spirals,
> spiral arms all radiating out from the center point. I need
> control over the tightness of the spirals and the number of arms.

I see. I think I can help you.

Let's create scene for testing

#include "math.inc"
plane{-z 0
  pigment{/* ... */}
  translate z*2
}
light_source{-100*z 1}
// camera default

/* ... */ is a place we will put stuff of spiral. Put next things into this
place and render each step.

Let's create not twisted pattern showing angle around origin.

    function{(atan2(x,y))/(2*pi)}

Then let's limit it to specified angle. All we need is to adjust value of
angle around origin to value of pattern in <0,1> range. Values outside range
should be clipped. We need parameter angle to adjust width of spiral area.
This could look this way:

    #local Angle=90;
    function{
      clip(
        adj_range2(
          atan2(abs(x),y),
          0,radians(Angle)/2,
          1,0
        ),
        0,1
      )
    }

Now wee need to add twisting. We have to rotate our fan according to distance
to origin. So we need additional parameter to describe rotation at first unit
radius.

    #local Angle=10;
    #local Rotate=90;
    #local Fan=function{
      clip(
        adj_range2(
          atan2(abs(x),y),
          0,radians(Angle)/2,
          1,0
        ),
        0,1
      )
    }
    #local Rot_Z=function(x,y,z,A)
        {Fan(x*cos(A)+y*sin(A),-x*sin(A)+y*cos(A),z)}
    function{Rot_Z(x,y,z,radians(Rotate)*f_r(x,y,z))}

Now we have ready stuff macro to create one-arm spiral with width of arm and
speed of twisting controlled by parameters. All you need now is to create
several arms (with different twisting and width), adjust, and combine as one
function. Also it could be worth to add initial rotation for arm. So here is
final sample scene.

//START
#version 3.5
#include "functions.inc"
#include "math.inc"
#macro Arm(Angle,Rotate,Init_Rotate)
  #local Fan=function{
    clip(
      adj_range2(
        atan2(abs(x),y),
        0,radians(Angle)/2,
        1,0
      ),
      0,1
    )
  }
  #local Rot_Z=function(x,y,z,A)
     {Fan(x*cos(A)+y*sin(A),-x*sin(A)+y*cos(A),z)}
  function{Rot_Z(x,y,z,radians(Init_Rotate)+radians(Rotate)*f_r(x,y,z))}
#end
plane{-z 0
  pigment{
    #local F1=Arm(5,50,0);
    #local F2=Arm(10,70,90);
    #local F3=Arm(20,90,180);
    #local F4=Arm(40,110,270);
    function{max(F1(x,y,z),F2(x,y,z),F3(x,y,z),F4(x,y,z))}
  }
  translate z*2
}
light_source{-100*z 1}
// END

I hope you like it.

ABX


Post a reply to this message

From: Warp
Subject: Re: function help
Date: 12 Feb 2002 07:51:04
Message: <3c690fb8@news.povray.org>
Mick Hazelgrove <mic### [at] mhazelgrovefsnetcouk> wrote:
: control over the tightness of the spirals and the number of arms.

  And how does spiral1 not fulfill these requirements?

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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