POV-Ray : Newsgroups : povray.newusers : Spline_Trans Help Please! Server Time
29 Jul 2024 02:33:47 EDT (-0400)
  Spline_Trans Help Please! (Message 1 to 2 of 2)  
From: Simon
Subject: Spline_Trans Help Please!
Date: 12 May 2007 08:26:20
Message: <4645b26c$1@news.povray.org>
Hi, I wonder if someone can point me in the right direction...

I have the following loop:

---------------------------------------------------------------------------------------
 #while(X<=18)
  box {
   <-0.2, 0, 0.05>, <0.2, 0.1, -0.05>
   pigment {
    color rgb <0.75,0.75,0.75>
   }
      #debug concat(str((X), 3, 3), "\n")
      Spline_Trans(path, (X), y, 0.1, 0.5)
   //translate path(X)
  }
  #declare X=X+0.001;
 #end
---------------------------------------------------------------------------------------

to draw a "rail" that _should_ bank with the object that's going to follow 
the rail. The Spline is defined from -2 to 20 and is a cubic_spline. If I 
use transform, I get a nice circuit, however, when I try to use 
Spline_Trans, I get:
---------------------------------------------------------------------------------------
....
1.316
1.317
1.318
File: <path>\Rollercoaster\Scene.POV  Line: 91
File Context (5 lines):
      #debug concat(str((X), 3, 3), "\n")
      Spline_Trans(path,
Parse Error: Identifier expected, incomplete function call or spline call 
found instead.
Total Scene Processing Times
  Parse Time:    0 hours  0 minutes  0 seconds (0 seconds)
  Photon Time:   0 hours  0 minutes  0 seconds (0 seconds)
  Render Time:   0 hours  0 minutes  1 seconds (1 seconds)
  Total Time:    0 hours  0 minutes  1 seconds (1 seconds)
CPU time used: kernel 0.73 seconds, user 0.50 seconds, total 1.23 seconds

POV-Ray finished
---------------------------------------------------------------------------------------

Any help greatly appreciated.

oh and my includes:
---------------------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"

---------------------------------------------------------------------------------------


Post a reply to this message

From: Tim Attwood
Subject: Re: Spline_Trans Help Please!
Date: 12 May 2007 18:01:38
Message: <46463942$1@news.povray.org>
>      Spline_Trans(path,
> Parse Error: Identifier expected, incomplete function call or spline call 
> found instead.
Calls to macros that pass a spline can occasionally
encounter this bug. Calling it repeatedly makes it certain.
(POV is trying to make multiple copies of the spline)

Check the spline_tools.inc macros I posted in p.b.sf a while back
http://news.povray.org/povray.binaries.scene-files/thread/%3C44e2e8f3@news.povray.org%3E/?ttop=240776&toff=50

This should let you extrude some shapes,  etc.
The heart of the macros is the VSpline_Trans_Path macro,
I worked around the bug by declaring Path_Spline
as a global variable...

// transforms a vector by a matrix
#macro VMatrix_Trans(vec, A, B, C, D)
   #local fn = function { transform {
      matrix < A.x, A.y, A.z,
             B.x, B.y, B.z,
             C.x, C.y, C.z,
             D.x, D.y, D.z>
             } }
   #local result = (fn(vec.x, vec.y, vec.z));
   (result)
#end

// transforms a vector along Path_Spline
#macro VSpline_Trans_Path (Vect, Time, Sky, Foresight, Banking)
   #ifndef (Path_Spline)
      #error "VSpline_Trans_Path requires Path_Spline to be #declared!\n"
   #end
   #local Location = <0,0,0>+Path_Spline(Time);
   #local LocationNext = <0,0,0>+Path_Spline(Time+Foresight);
   #local LocationPrev = <0,0,0>+Path_Spline(Time-Foresight);
   #local Forward = vnormalize(LocationNext-Location);
   #local Right   = VPerp_To_Plane(Sky,Forward);
   #local Up      = VPerp_To_Plane(Forward,Right);
   #local BankingRotation =
   degrees(atan2(
      VRotation(
         VProject_Plane((LocationNext-Location),Sky),
         VProject_Plane((Location-LocationPrev),Sky),
         Up
      )*Banking
      ,1
   ));
   #local result = vrotate(Vect, BankingRotation*z);
   #local result = VMatrix_Trans(result,Right,Up,Forward,Location);
   (result)
#end


Post a reply to this message

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