POV-Ray : Newsgroups : povray.newusers : Help with spline & sphere_sweep Server Time
19 Apr 2024 23:51:36 EDT (-0400)
  Help with spline & sphere_sweep (Message 1 to 10 of 10)  
From: Bald Eagle
Subject: Help with spline & sphere_sweep
Date: 31 Jul 2014 20:00:01
Message: <web.53dad7abf072be945e7df57c0@news.povray.org>
I've got a sphere sweep with a cubic spline that plots out the outline of half a
propeller blade, and now I want to find a way to "fill in" the space from the
two ends to the loop-back point.

I figured I could start from the midpoint of the two ends, and fan out along the
spline with cylinders, but I'm not sure how to handle the spline, determine its
"length", or return the interpolated values.

Can I plug a spline into a sphere sweep, since it looks like the data structures
are different?
Can I do something with an array to straighten this out?
Trace function?

Trying to search and read documentation and forum text didn't really seem to
give me the sort of thing I'm looking for.

Maybe I ought to go with a mesh object, but I've never used them before, and I'd
rather stick with the few things I know if at all possible.

Thanks!


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with spline & sphere_sweep
Date: 31 Jul 2014 22:05:01
Message: <web.53daf5a59e0d00ba5e7df57c0@news.povray.org>
Well, I found this:

http://www.scivit.com/gb/Text/SphereSweep/sweep1.html

Which let me redefine my sphere sweep using an array.  (yay)

Now I'm trying to build a spline by cycling through the array - though either my
syntax is terrible, or I'm trying to something that isn't possible.

The idea with the whole "Tip" flag is that once I've cycled out to the tip of
the propeller (5 units), when I start to cycle back towards the hub, I keep
incrementing the XValue variable with my little equation.

Then I can use Rune's Spline_Trans to move along the automagically generated
spline and fan out my "filling" cylinders.   Which will perhaps become blob
cylinders.  Or something else entirely.

========================================

#declare PropSpline = spline {
  cubic_spline
  PropArraySize,
 #declare Loop = 0;
 #declare Tip = false;
 #while  (Loop < PropArraySize)
  //            Spline_Trans(Spline, Time, SkyVector, ForeSight, Banking):
  #local Vector = RadiusArray [Loop];
  #local XValue = Vector.x;
  #if (XValue = -5)
   #declare Tip = true;
  #end

  #if (Tip)
  5+(5-abs(XValue)), Vector
  #else
  abs(XValue), Vector
  #end

 #declare Loop = Loop + 1;
 #end
 }

#declare CylLoop = 0;
#while (CylLoop < 1)
 object{ cylinder {<0, Mid, 0>, Spline_Trans(PropSpline, Loop, y, 0.1, 0.0),
Thin texture {Propeller_Tex} }
 #declare CylLoop = CylLoop+1;
#end


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with spline & sphere_sweep
Date: 31 Jul 2014 23:20:01
Message: <web.53db06339e0d00ba5e7df57c0@news.povray.org>
OK, so after much doodling around with the SDL and arrays,
I determined that I could create another array with the loop, instead of trying
to generate a spline directly.  Then I could define the spline using:

     #declare PropSpline = spline { PropSplineArray [PropArraySize-1] [0],
      PropSplineArray [PropArraySize-1] [1] }

The problem NOW is (because there's _always another problem) that the
Spline_Transform macro is choking on what I'm passing it.  It looks like I've
got the proper number of arguments... ?

I'm thinking that should be an easy problem for the animators out there to help
me through...

New SDL:
==================================================

#declare PropSplineArray = array [PropArraySize] [2]

 #declare Loop = 0;
 #declare Tip = false;
 #while  (Loop < PropArraySize)
  //            Spline_Trans(Spline, Time, SkyVector, ForeSight, Banking):
  #local Vector = RadiusArray [Loop];
  #local XValue = Vector.x;
  #if (XValue = -5)
   #declare Tip = true;
  #end

  #if (Tip)
  #declare PropSplineArray [Loop] [0] = 5+(5-abs(XValue));
  #declare PropSplineArray [Loop] [1] = Vector;
  #else
  #declare PropSplineArray [Loop] [0] =abs(XValue);
  #declare PropSplineArray [Loop] [1] = Vector;
  #end

 #declare Loop = Loop + 1;
 #end

#declare PropSplineArraySize = dimension_size (PropSplineArray, 1);
#debug concat ("PropSplineArraySize: ", str(PropSplineArraySize, 3,1), "\n" )
#debug "==============================================\n"


#declare PropSpline = spline { PropSplineArray [PropArraySize-1] [0],
PropSplineArray [PropArraySize-1] [1] }

#declare CylLoop = 0;
#while (CylLoop < 1)
 object{ cylinder {<0, Mid, 0>, Spline_Trans(PropSpline, Loop, y, 0.1, 0.1),
Thin texture {Propeller_Tex} }
 #declare CylLoop = CylLoop+1;
#end


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with spline & sphere_sweep
Date: 1 Aug 2014 00:15:00
Message: <web.53db13829e0d00ba5e7df57c0@news.povray.org>
OK - I fixed the SDL so that the whole thing runs and renders, but the problem I
have now is that for some reason I'm not able to read the data out of the arrays
I've created.

It's weird, because the loop in the macro that plots out the sphere sweep works
just fine, but then all subsequent attempts to do exactly the same thing fail -
I get 0 for my array values.

What should I be looking for here?

(BTW - how do I directly output a vector to the debug stream?)


Post a reply to this message

From: Le Forgeron
Subject: Re: Help with spline & sphere_sweep
Date: 1 Aug 2014 08:02:42
Message: <53db81e2$1@news.povray.org>
On 01/08/2014 06:11, Bald Eagle wrote:
> OK - I fixed the SDL so that the whole thing runs and renders, but the problem I
> have now is that for some reason I'm not able to read the data out of the arrays
> I've created.
> 
> It's weird, because the loop in the macro that plots out the sphere sweep works
> just fine, but then all subsequent attempts to do exactly the same thing fail -
> I get 0 for my array values.

the #declare PropSpline in previous post look bogus. Did you fix it ?

> 
> What should I be looking for here?
> 
> (BTW - how do I directly output a vector to the debug stream?)
> 
> 
#debug concat("My vector : <",vstr(3,VectorToOuput,",",4,4),">")


-- 
IQ of crossposters with FU: 100 / (number of groups)
IQ of crossposters without FU: 100 / (1 + number of groups)
IQ of multiposters: 100 / ( (number of groups) * (number of groups))


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with spline & sphere_sweep
Date: 1 Aug 2014 09:50:01
Message: <web.53db9a229e0d00ba5e7df57c0@news.povray.org>
I got some sleep, and somewhere between the top of the coffee mug and the bottom
of the coffee mug, I was able to see a few things I was doing wrong with arrays
and referencing components in the array, as well as a few things I should have
seen hours earlier, and got my spline generated from the array.

This of course made an entire block of completely unnecessary code moot.

But the cylinders now more or less get fanned out across the surface of the
propeller, and maybe now I'll start playing around with a better way to get a
filling of the space.


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with spline & sphere_sweep
Date: 1 Aug 2014 17:20:01
Message: <web.53dc04399e0d00ba5e7df57c0@news.povray.org>
Posted some renders of odd behaviour in p.b.i


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with spline & sphere_sweep
Date: 3 Aug 2014 14:20:00
Message: <web.53de7cbf9e0d00ba5e7df57c0@news.povray.org>
I fixed the problem with the sphere sweep and the spline that I generated from
the array.  They are now in register.

Is there a way to find out what equation POV-Ray uses to interpolate the points
on the spline?


Post a reply to this message

From: Le Forgeron
Subject: Re: Help with spline & sphere_sweep
Date: 4 Aug 2014 12:39:10
Message: <53dfb72e$1@news.povray.org>
On 03/08/2014 20:17, Bald Eagle wrote:
> I fixed the problem with the sphere sweep and the spline that I generated from
> the array.  They are now in register.
> 
> Is there a way to find out what equation POV-Ray uses to interpolate the points
> on the spline?

The cubic spline of povray is just the classical cubic spline, just
consider each dimension separately.

http://mathworld.wolfram.com/CubicSpline.html


-- 
IQ of crossposters with FU: 100 / (number of groups)
IQ of crossposters without FU: 100 / (1 + number of groups)
IQ of multiposters: 100 / ( (number of groups) * (number of groups))


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with spline & sphere_sweep
Date: 4 Aug 2014 19:50:00
Message: <web.53e01bca9e0d00ba5e7df57c0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:

> The cubic spline of povray is just the classical cubic spline, just
> consider each dimension separately.
>
> http://mathworld.wolfram.com/CubicSpline.html


Thanks again.
For many of us without a long and continued mathematical background, "classical"
cubic spline, "easily solved", and "matrix"  don't really go together.

I found this in one of my other travels, hope it helps someone else too.
http://newtonexcelbach.wordpress.com/2009/07/02/cubic-splines/


Post a reply to this message

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