POV-Ray : Newsgroups : povray.general : modeling question Server Time
29 Nov 2024 11:32:52 EST (-0500)
  modeling question (Message 1 to 5 of 5)  
From: Anthony D  Baye
Subject: modeling question
Date: 19 Nov 2005 12:42:54
Message: <437f641e$1@news.povray.org>
Can anybody suggest a method by which a partially unrolled scroll might 
be created Parametrically?  I've been trying to create a CSG scroll, but 
I'm about at my wits' end with the Trig functions.

If anybody can help with this, it would be greatly appreciated.

Regards,

A.D.B


Post a reply to this message

From: Mike Williams
Subject: Re: modeling question
Date: 19 Nov 2005 15:39:27
Message: <ZGnudAAj14fDFwsc@econym.demon.co.uk>
Wasn't it Anthony D. Baye who wrote:
>Can anybody suggest a method by which a partially unrolled scroll might 
>be created Parametrically?  I've been trying to create a CSG scroll, but 
>I'm about at my wits' end with the Trig functions.
>
>If anybody can help with this, it would be greatly appreciated.

I managed to come up with this. I've used Ingo Janssen's Param.inc rather than
real parametrics, for speed.

Get param.inc from http://members.home.nl/seedseven/

I had hoped to be able to use natural or cubic splines, and thus get a smooth
curve in the middle section, but they always seem to end up with ugly kinks
where the paper starts to curl.



global_settings {assumed_gamma 1.0}

#declare R1=0.2;        //inner radius right end
#declare R2=1;          //outer radius right end
#declare R3=0.1;        //inner radius left end
#declare R4=1.5;        //outer radius left end
#declare DX=3;          //length of straight bit
#declare F1 = 17;       //frequency of right end only a few magic values work
#declare F2 = 43;       //frequency of left end only a few magic values work


camera { location  <-5, 3, -10> look_at <-DX/2,0,0> angle 28}
light_source {<-100,200,-500> colour rgb 1}

#declare S = function {
   spline {
     linear_spline
     // right end
     #declare T=0;
     #while (T<0.5)
       #declare X=cos(T*F1)*((R1*(0.5-T))+(R2*T));
       #declare Y=sin(T*F1)*((R1*(0.5-T))+(R2*T));
       T, <X,Y>,
       #declare T=T+0.002;
     #end
     // left end
     #while (T<1)
       #declare X=sin(T*F2)*((R4*(1-T))+(R3*(T-0.5))) - DX;
       #declare Y=cos(T*F2)*((R4*(1-T))+(R3*(T-0.5)));
       T, <X,Y>,
       #declare T=T+0.002;
     #end
   }
 }


#declare Fx  = function(u,v) {S(u).x}
#declare Fy  = function(u,v) {S(u).y}
#declare Fz  = function(u,v) {v}

#include "param.inc"

object {Parametric(Fx,Fy,Fz,<0,-2>,<1,2>,400,2,"")
        pigment {rgb 1}
}


Post a reply to this message

From: Chris B
Subject: Re: modeling question
Date: 19 Nov 2005 16:13:23
Message: <437f9573@news.povray.org>
"Anthony D. Baye" <Sha### [at] hotmailcom> wrote in message 
news:437f641e$1@news.povray.org...
> Can anybody suggest a method by which a partially unrolled scroll might
> be created Parametrically?  I've been trying to create a CSG scroll, but
> I'm about at my wits' end with the Trig functions.
>
> If anybody can help with this, it would be greatly appreciated.
>
> Regards,
>
> A.D.B

Here's an alternative one:
It uses a different mesh generator (array2mesh2.inc attached) and is less 
parameterised than Mike's. It also rolls the bottom up in the opposite 
direction.


camera {location <-0.2,0.3,-0.5> look_at 0.1}
light_source { <-10,4,-4> color rgb 1}
light_source { <-10,-7,-40> color rgb 1}
#include "math.inc"
#include "array2mesh2.inc"

#local ScrollArray = array [1000][2];

#local I = 0;
#local ArrayIndex = 0;
#local R = 0.015;
#while (I<900)
  #local X = R*cosd(I);
  #local Y = R*sind(I);
  #local Z = 0;
  #local ScrollArray[ArrayIndex][0] = <X+0.15,Y+0.3,Z-0.15>;
  #local ScrollArray[ArrayIndex][1] = <X+0.15,Y+0.3,Z+0.15>;
  #local R = R*1.01;     // Add 1 percent to the radius each time
  #local I = I + 10;
  #local ArrayIndex = ArrayIndex + 1;
#end

#local ScrollArray[ArrayIndex][0] = <X+0.135,Y+0.25,Z-0.15>;
#local ScrollArray[ArrayIndex][1] = <X+0.135,Y+0.25,Z+0.15>;
#local ArrayIndex = ArrayIndex + 1;

#local ScrollArray[ArrayIndex][0] = <X+0.115,Y+0.2,Z-0.15>;
#local ScrollArray[ArrayIndex][1] = <X+0.115,Y+0.2,Z+0.15>;
#local ArrayIndex = ArrayIndex + 1;

#local ScrollArray[ArrayIndex][0] = <X+0.065,Y+0.1,Z-0.15>;
#local ScrollArray[ArrayIndex][1] = <X+0.065,Y+0.1,Z+0.15>;
#local ArrayIndex = ArrayIndex + 1;

#local ScrollArray[ArrayIndex][0] = <X+0.035,Y+0.05,Z-0.15>;
#local ScrollArray[ArrayIndex][1] = <X+0.035,Y+0.05,Z+0.15>;
#local ArrayIndex = ArrayIndex + 1;

#local I = I-40;
#while (I<1800)
  #local X = R*cosd(I);
  #local Y = R*sind(I);
  #local Z = 0;
  #local ScrollArray[ArrayIndex][0] = <X,Y,Z-0.15>;
  #local ScrollArray[ArrayIndex][1] = <X,Y,Z+0.15>;
  #local R = R*0.99;     // Add 1 percent to the radius each time
  #local I = I + 10;
  #local ArrayIndex = ArrayIndex + 1;
#end

#local DummyArray  = array [ArrayIndex][2];
#local ppVerbose = 0;

object {ppMesh2FromArray(ScrollArray, DummyArray, ArrayIndex, 2, 0) pigment 
{color rgb <1,1,0.9>} }


Post a reply to this message


Attachments:
Download 'array2mesh2.inc.txt' (7 KB)

From: Mike Williams
Subject: Re: modeling question
Date: 19 Nov 2005 20:26:47
Message: <+7VcBAAU$8fDFwqv@econym.demon.co.uk>
Wasn't it Mike Williams who wrote:

>#declare F1 = 17;       //frequency of right end only a few magic values work
>#declare F2 = 43;       //frequency of left end only a few magic values work

The magic values for F1 are about (4n+1.3)*pi and for F2 are about
(4n+1.7)*pi where n is an integer.

To get a scroll that curls in the same direction at each end, change
       #declare Y=sin(T*F1)*((R1*(0.5-T))+(R2*T));
to
       #declare Y=-sin(T*F1)*((R1*(0.5-T))+(R2*T));
and then the magic values become (4n+1)*pi and (4n+2)*pi.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: John VanSickle
Subject: Re: modeling question
Date: 20 Nov 2005 13:56:52
Message: <4380c6f4$1@news.povray.org>
Anthony D. Baye wrote:

> Can anybody suggest a method by which a partially unrolled scroll might 
> be created Parametrically?  I've been trying to create a CSG scroll, but 
> I'm about at my wits' end with the Trig functions.

Use the math to create a mesh.

Regards,
John


Post a reply to this message

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