POV-Ray : Newsgroups : povray.newusers : single point on spline and a vector: comparison : Re: single point on spline and a vector: comparison Server Time
29 Jul 2024 04:27:52 EDT (-0400)
  Re: single point on spline and a vector: comparison  
From: Charles C
Date: 2 Nov 2006 16:30:00
Message: <web.454a621739860a3174eed8480@news.povray.org>
It's difficult to debug what's likely a syntax error when looking at psuedo
code.  So not getting into that, what line of actual code is showing the
error?

On the another note, for each defined point where are you storing the
"value" which says how far along it is on the spline?  I deal with splines
in arrays of 4D vectors rather than 3 so that the same vector that holds
the 3D points will also hold the "value" position for each point.
Unfortunately this means that when converting it to a spline it looks
something like this for each value of the array:

#local Tempfloat=The_Array[ctr].t;
Tempfloat,  <The_Array[ctr].x, The_Array[ctr].y, The_Array[ctr].z>

Using the Tempfloat variable was a workaround - Pov-Ray didn't like
The_Array[ctr].t directly in the spline statement.

> And I ask: Why is splinepath(at_one_moment) no vector? What did I wrong?

Have you tried something like the following?
#debug concat(" x = ", str(splinepath(clock_counter).x,5,5),
              " y = ", str(splinepath(clock_counter).y,5,5),
              " z = ", str(splinepath(clock_counter).z,5,5),
              " ")

Hope something here is useful... :)
Charles


marabou <not### [at] availableyet> wrote:
> hello,
> for some reason I want to check if one point at spline-creation time is
> equal to one point in an array.
> More concrete:
> There is an array[] of vectors which holds points of one future spline.
> A macro creates a spline from it. While this macro creates spline I wish to
> compare if actual processed point hits one predefined point from array[x].
>
> pseudo-code:
> >>>>>>>>>>>>>>>>>>>>>>>>
> // define spline
> #declare splinepoints = array[]{<x,y,z>,...}
>
> // create spline
> #declare splinepath = spline{cubic_spline #while...}
>
> // draw balls on splinepath
> #macro happyspline(splinepath)
>         #while (clock_counter <= maxpoint)
>                 sphere {
>                         splinepath(clock_counter), radius
>                 }
>                 // the comparison, which fails:
>                 #if ( splinepath(clock_counter) = splinepoints[10] )
>                         "HIT"
>                 #end
>                 clock_counter += anystep
>         #end //while
> #end //macro
> <<<<<<<<<<<<<<<<<<<<<<<<<
>
> Then comes a parse error: "Float expected but vector or color expression
> found."
> And I ask: Why is splinepath(at_one_moment) no vector? What did I wrong?


Post a reply to this message

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