POV-Ray : Newsgroups : povray.unofficial.patches : Q: Splines in SuperPatch : Q: Splines in SuperPatch Server Time
2 Sep 2024 22:16:14 EDT (-0400)
  Q: Splines in SuperPatch  
From: ingo
Date: 12 May 1999 07:53:18
Message: <37395d9e.0@news.povray.org>
Some questions on the splines in the SuperPatch. I'm trying to create random
splines, that fit in the box{<-1,0,-0.5>,<1,7,0.5>}. These splines, wil later be
used to translate seperate objects within a stack.

The method (scene below) in use seems to work, but there is one problem:
abs(POS(I/Steps).x)>1 works fine, but abs(POS(I/Steps).z)>1 gives the error:
"Bad operands for period operator". What does it mean? How to get around this?

The floats, in front of the points of the spline, are not absolut clear to me.
What is their influence? I normaly keep them evenly spread along the spline. (Is
there more documentation and what is the original location of this part of the
patch? PatchStation seems to be out of running lately)

Generating random splines and then validating wether they fit in the box works,
but is there another way? I mean is it possible to generate the controllpoints
in sutch a way, that the resulting spline is always valid? I imagine something
like a pyramid or coneshape area, generate the controllpoint within that area
and the spline is valid.

ingo

--
Met dank aan de muze met het glazen oog.

#version 3.1;
global_settings {assumed_gamma 1.0}
light_source {
  <500, 500,-500>
  rgb 1}
camera {
  location  < 0.0, 3.5,-8.0>
  look_at   < 0.0, 3.5, 0.0>}
background{rgb 1}
plane {-z,0
  texture { pigment {
  checker colour rgbf 1 colour rgbf 0.5}}}

#macro Rmm(Min,Max,Stream)
   Max+((Min-Max)*rand(Stream))
#end // macro

#declare Sd= seed(7);

#declare C=0;
#while (C= 0)
   #declare C=1;
   #declare POS= spline{
      cubic_spline
      -1, <Rmm(-10, 10, Sd), Rmm(-20, 0, Sd), Rmm(-10, 10, Sd)>
       0, <Rmm(-0.5, 0.5, Sd), 0, Rmm(-0.25, 0.25, Sd)>
       1, <Rmm(-0.5, 0.5, Sd), 7, Rmm(-0.25, 0.25, Sd)>
       2, <Rmm(-10, 10, Sd), Rmm(7, 27, Sd), Rmm(-10, 10, Sd)>
   }
   #local I=0;
   #local Steps=25;
   #while (I<Steps+1)
      #if(abs(POS(I/Steps).x)>1 | abs(POS(I/Steps).z)>0.5)
         #local I=26;
         #declare C=0;
      #end // if
      #local I=I+1;
   #end // while
#end // while

#declare I=0;
#declare Steps=100;
#while (I<Steps+1)
   sphere {POS(I/Steps),0.1 pigment {rgb <1,0,0>}}
   #declare I=I+1;
#end // while


Post a reply to this message

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