POV-Ray : Newsgroups : povray.binaries.scene-files : Rope Macro Server Time
29 Mar 2024 01:40:46 EDT (-0400)
  Rope Macro (Message 1 to 1 of 1)  
From: R  Suzuki
Subject: Rope Macro
Date: 22 Jan 2002 04:49:44
Message: <3c4d35b8@news.povray.org>
Hi,

Attached is the macro for ropes and twisted wires.
This macro uses f_helix1 and f_helical_torus isosurfaces in v3.5.
The below code is an example.  I will post the image in p.b.i.
This is a beta version.  Comments are welcome.

R. Suzuki

// Persistence of Vision Ray Tracer 3.5 (beta 10) Scene Description File
// Desc: Example of Rope Macro ver0.5
//       Time for trace:  179 sec for 640x480 NoAA on 600MHz Celeron
// Date: 01/22/2002
// Auth: Ryoichi Suzuki  < r-s### [at] aistgojp >
// Note: This may not work properly in some cases due to the spline bug 
//           in beta 10.
//
#version 3.5;
#include "colors.inc"
#include "woods.inc"
#include "rope.inc"
#include "metals.inc"

#declare AREA_LIGHT= off;

#declare NMax=20;    

#declare MySpline =
  spline {
    cubic_spline
    -.2, <-1,-0.2,-1>
    0.00, <0.25,0.0,-0.5>
    0.20, <-0.75,0.1,1>
    0.30, <-1.15,0.12,0>
    0.40, <-0.75,0,-1>
    0.60, <0.1,-0.3,0.70>
    0.80, <-0.5,0.3,0.8>
    1.00, <-1.5, -0.4, -0.5>
    1.20, <-2,0.3,-2>
  }

  Rope_Spline(
        MySpline, //Spline Identifier
        NMax,     //Number of sampling points
        4,        //Number of threads
        1,        //Period 
        0.16,     //Radius of the rope
        0.05,     //String radius
        5.0,      //Max arc radius
        Rope_N_Color(4) +Rope_Trans(x*-1)
  )

#declare _Rope_CMap= 
     color_map { [0.0 rgb <0.7,0.7,0.7>] [0.2 rgb <0.7,0.3,0.0>]
                 [0.4 rgb <0.7,0.7,0.3>] [0.6 rgb <0.4,0.7,0.2>]
                 [0.8 rgb <0.5,0.2,0.4>][1 rgb <0.7,0.7,0.7>]}

  Rope_Spline(MySpline, NMax
              15, -2, 0.15, 0.01, 2.0, Rope_N_Color(5)+Rope_Texture_No(1)
                  +Rope_Trans(<1,0.3,-0.2>)  ) 


  #declare Tex1= texture{T_Wood21 scale 0.2}

  Rope_Spline(MySpline, NMax
              10, 1.5, 0.12, 0.018, 10.0, 
                  +Rope_R_Rope(0.1) +Rope_Texture_No(2) +Rope_Rot(x*65) 
                  +Rope_Trans(<0,0.3,-0.2>) +Rope_Texture(Tex1) )

  Rope_Spline(MySpline, NMax
                6, -1.5, 0.08, 0.018, 10.0, Rope_Previous) 
                                    
  Rope_Spline(MySpline, NMax
                0, -1.5, 0.02, 0.00, 10.0, Rope_Previous) 

  #declare Tex1= texture{T_Chrome_2D}
  #declare Ar=array[6]{x-z*0.4,x+z,-x+z,-x-z,x-z,x+z}
  object{
    Rope_Fixed_Rc(Ar, 6-2, 
                5, -1.0, 0.25, 0.12, 0.6,  
                Rope_Obj(true)+Rope_Trans(<-0.5,0,0>)
               +Rope_Rot(<0,0,0>)+Rope_Texture(Tex1)
    ) 
    scale 1.7 translate y*-1.1
  }
  

//---------------------------------------------------------------------------

camera {location  <0.0, 3.0, -4.0>*6  direction 7.2*z
        right x*image_width/image_height  look_at <-1.2, -0.2, 0> }

sky_sphere {
  pigment { gradient y
    color_map {
       [0 rgb <0.6,0.7,0.85>] 
       [0.5 rgb <0.2,0.3,0.5>] 
       [1 rgb <0.6,0.7,0.85>]}
  }
}

light_source { 0  color rgb 2.3 translate <-20, 30, -30>*2
  #if (AREA_LIGHT)
    area_light x*10, y*10, 2, 2  adaptive 1  jitter      
  #end
}


Post a reply to this message


Attachments:
Download 'us-ascii' (14 KB)

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