POV-Ray : Newsgroups : povray.object-collection : Is this the right group to discuss details of an object in the collection? : Re: Is this the right group to discuss details of an object in the collecti= Server Time
16 Jun 2024 10:19:26 EDT (-0400)
  Re: Is this the right group to discuss details of an object in the collecti=  
From: Leef me
Date: 8 Nov 2007 02:35:01
Message: <web.4732b8c8e76f755f892adb1d0@news.povray.org>
Here's my reworked scroll code. I wanted to focus on determining and
understanding why I get the text on both sides of the scroll and why the weird
pattern appears on the flat portion of the scroll.

+kff10 will rotate the camera so you can see both sides of the scroll.

Thanks in advance to all who can help me understand what's going wrong, and how
to fix this.

     You will need the include file from "Scroll    Version: chrisb 1.0"
     look here       http://lib.povray.org/searchcollection/index.php

Leef_me


#include "colors.inc"
#include "math.inc"
#include "Scroll_array2mesh2.inc"


camera {
      perspective
      location <-0.2,0.3,-2> look_at 0.1
      rotate y*-30
      //rotate y*-30
//      rotate y*-30
      rotate y*90*clock
      translate y*-.5
}

light_source { <-10,4,-4> color rgb 1}
light_source { <0,4,-5> color rgb 1}

light_source { <10,-7,-10> color rgb 1}

light_source { <5,0,-5> color rgb 1}

light_source {   <-.5,0,0> color White   }
light_source {   <.5,0,0> color White    }


#local SW2 =  .80;        // Scroll_width

#local Scroll_R = 0.1015;

#local Scroll_I = -540;
#local Scroll_X = Scroll_R*cosd(Scroll_I);
#local Scroll_Y = Scroll_R*sind(Scroll_I);
#local Scroll_Z = 0;


// The coordinates of the mesh2 nodes are written into an array
#local Scroll_Array = array [1000][2];

// First do a spiral at one end
#local Scroll_I = -540;
#local Scroll_I = 200;      // set start and ending degrees same to disable
spiral
#local Scroll_ArrayIndex = 0;
#local Scroll_R = 0.05;


#while (Scroll_I<200)
  #local Scroll_X = Scroll_R*cosd(Scroll_I);
  #local Scroll_Y = Scroll_R*sind(Scroll_I);
  #local Scroll_Z = 0;
  #local Scroll_Array[Scroll_ArrayIndex][0] =
<Scroll_X,Scroll_Y+0.3,Scroll_Z-SW2>;
  #local Scroll_Array[Scroll_ArrayIndex][1] =
<Scroll_X,Scroll_Y+0.3,Scroll_Z+SW2>;
  #local Scroll_R = Scroll_R*1.01;     // Add 1 percent to the radius each time
  #local Scroll_I = Scroll_I + 10;
  #local Scroll_ArrayIndex = Scroll_ArrayIndex + 1;
#end


#local Scroll_flt = .3;           // this is the flat area of the scroll
#while (Scroll_flt>-.8)

  #local Scroll_Array[Scroll_ArrayIndex][0] =
<Scroll_X,Scroll_Y+Scroll_flt,Scroll_Z-SW2>;
  #local Scroll_Array[Scroll_ArrayIndex][1] =
<Scroll_X,Scroll_Y+Scroll_flt,Scroll_Z+SW2>;

  #local Scroll_ArrayIndex = Scroll_ArrayIndex + 1;
  #local Scroll_flt = Scroll_flt-.02;

#end

// Then add a spiral at the other end
//#local Scroll_I = Scroll_I-10;
#local Scroll_I1 = Scroll_I+720;
#local Scroll_I1 = Scroll_I+0;
                    // set start and ending degrees same to disable spiral
#while (Scroll_I<Scroll_I1)
  #local Scroll_X = Scroll_R*cosd(Scroll_I);
  #local Scroll_Y = Scroll_R*sind(Scroll_I);
  #local Scroll_Z = 0;
  #local Scroll_Array[Scroll_ArrayIndex][0] =
<Scroll_X,Scroll_Y+Scroll_flt,Scroll_Z-SW2>;
  #local Scroll_Array[Scroll_ArrayIndex][1] =
<Scroll_X,Scroll_Y+Scroll_flt,Scroll_Z+SW2>;
  #local Scroll_R = Scroll_R*0.99;
                     // Remove 1 percent from the radius each time
  #local Scroll_I = Scroll_I + 10;
  #local Scroll_ArrayIndex = Scroll_ArrayIndex + 1;
#end


#declare my_text=
text{
  ttf"arialbd.ttf"      "This is a test"    1,0

  translate -z/2
       // suggested by fellow pover Samuel Benge  Date: 21 Oct 2007 20:39:07
       // Re: Simple 2D text on a cylinder's surface
  scale .2
  //rotate <0,0,90>

                 // translation allows placement of text on the surface

//  translate<-.7,0,0>
            // when the rotation is 90, then these parameters are y,x,z
}
            // when the rotation is 0, then these parameters are x,y,z


#if(1)

// Call a function to generate a mesh2 object from the array
#local Scroll_DummyArray  = array [Scroll_ArrayIndex][2];
#local Scroll_Verbose = 0;

object {Scroll_Mesh2FromArray(Scroll_Array, Scroll_DummyArray,
Scroll_ArrayIndex, 2, 0)

    uv_mapping
      texture {                     // one side has background and text

#if(0)

  pigment { color rgb Pink }

#else

      pigment{
        pigment_pattern{
          object{my_text 0,1}
          }
        pigment_map{
            [0 color Yellow]
            [1 color Blue]
        }
      }
#end
    }
    interior_texture {             // the other side has another background
#if(1)

  pigment { color rgb Pink }

#else

      pigment{
        pigment_pattern{
          object{my_text 0,1}
          }
        pigment_map{
            [0 color Red]
            [1 color White]
        }
      }
#end
    }
    rotate y*-45
    rotate y*180*clock             // look at both sides of the disc
}


#end


sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}


Post a reply to this message

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