POV-Ray : Newsgroups : povray.general : 3d splines with uniform intervals ??? Server Time
5 Nov 2024 20:17:20 EST (-0500)
  3d splines with uniform intervals ??? (Message 1 to 10 of 21)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Mike E 
Subject: 3d splines with uniform intervals ???
Date: 12 Jan 2003 11:25:06
Message: <web.3e21957b8d140aa98a0521b50@news.povray.org>
Does anyone know how I can make a 3d spline in POV 3.5 that allows the
spline parameter (ie. distance along spline) to be completely evenly spaced
along the length of the spline. This was standard using the MegaPov
splines, which defined the total spline length as between 0 and 1.

It seems to me that assigning individual t-values to pts on the spline will
invariably prevent smooth motion along a spline (as in the POV example file
splinefollow.pov).

Thanks in advance.
Mike E.


Post a reply to this message

From: Warp
Subject: Re: 3d splines with uniform intervals ???
Date: 12 Jan 2003 11:39:46
Message: <3e219a52@news.povray.org>
Try the spline include file by Chris Colefax. It has a sampling method
which allows placing points at even distances along a spline.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: 3d splines with uniform intervals ???
Date: 12 Jan 2003 13:18:28
Message: <cjameshuff-4E03CC.13075812012003@netplex.aussie.org>
In article <web.3e21957b8d140aa98a0521b50@news.povray.org>,
 "Mike E." <nomail@nomail> wrote:

>  This was standard using the MegaPov
> splines, which defined the total spline length as between 0 and 1.

No it wasn't. As far as I can recall, it wasn't even the case with the 
other spline patch, the buggy one with the ugly syntax that didn't get 
into 3.5. You are probably thinking of Chris Colefax's spline include.

It would be possible to make a macro that builds a new spline with 
constant "speed" from an existing spline or from an array of points, 
though. I have done experiments with this in the past. Or it could be 
patched directly into the spline feature for convenience and speed, but 
it isn't necessary.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Peter Hertel
Subject: Re: 3d splines with uniform intervals ???
Date: 12 Jan 2003 16:48:14
Message: <3e21e29e@news.povray.org>
I found a file called "spline evenly spaced objects.pov" in my povray
directory, I think I picked it up from the newsgroups a while ago, can't
remember who made it though..
This places evenly spaced objects along a spline, but perhaps you can use it
to get an idea on how to achive what you need?

If you know, or are, the person that wrote this, please shout out loud to
give some proper credit here!

-Peter



#include "transforms.inc"
#include "shapes.inc"
#include "strings.inc"

#macro Time_To_Length_Converter(Spline,Min,Max,Accuracy)
  #local Conversion=function{spline{
    #local Last=Spline(Min);
    #local Length=0;
    #local C=Min;
    #while (C<=Max)
      #local C=min(C,Max);
      #local Point=Spline(C);
      #local Length=Length+vlength(Point-Last);
      #local Last=Point;
      C , <1,0,0>*Length
      #local C=C+Accuracy;
    #end
  }};
  function(T){Conversion(T).x}
#end

#macro Spline_With_Linear_Movement(Spline,Min,Max,Accuracy)
  spline{
    #local Last=Spline(Min);
    #local Length=0;
    #local C=Min;
    #while (C<=Max)
      #local C=min(C,Max);
      #local Point=Spline(C);
      #local Length=Length+vlength(Point-Last);
      #local Last=Point;
      Length , Point+<0,0,0>
      #local C=C+Accuracy;
    #end
  }
#end

#declare MySpline = spline {
   cubic_spline
   -1,<-1,1,0>,
   0,<0,1,0>,
   0.3, <2,0.7,-2>,
   0.6,<3,-0.8,-3>,
   0.85,<0,-0.8,-3.5>,
   1,<-1,-0.8,-3.72>,
   1.1,<-2,-0.8,-3.75>
  }

#declare MySplineLinear = Spline_With_Linear_Movement(MySpline,0,1,0.001);
#declare f_MySplineLength = Time_To_Length_Converter(MySpline,0,1,0.001);
#declare MySplineLength = f_MySplineLength(1);

#declare MyObject = cone {0 .2 <0,0,.2> 0.15 pigment{rgb 1}};

#declare Step=MySplineLength/20;

#declare All=union{
  #declare Count=0;
  #while (Count<=MySplineLength-Step)
    object {
      MyObject
      pigment { rgb <1,.3,.7>}
      Spline_Trans(MySplineLinear, Count, y, 0.1, 0.1)
    }
    #declare Count=Count+Step;
  #end
  rotate x*90
}

object{Center_Object(All,1)translate z*5}

background{1}
light_source{<0,10,-125> 1}

object {
Center_Object(
union{
#local Q = 0;
#while (Q < 1)

sphere {MySpline(Q),0.1 pigment {rgb <1,1,0>} rotate x*90}

#local Q = Q+0.02;
#end
}
,1)
translate z*5
}


Post a reply to this message

From: Mike E 
Subject: Re: 3d splines with uniform intervals ???
Date: 12 Jan 2003 23:15:04
Message: <web.3e223c736e508e7a130c700f0@news.povray.org>
Christopher James Huff wrote:
>In article <web.3e21957b8d140aa98a0521b50[at]news.povray.org>,
>
>It would be possible to make a macro that builds a new spline with
>constant "speed" from an existing spline or from an array of points,
>though. I have done experiments with this in the past. Or it could be
>patched directly into the spline feature for convenience and speed, but
>it isn't necessary.
>

I'm interested in your statement, "it isn't necessary". Is there something
simple that I am missing? How would you move something along a spline at a
constant speed? A real world example for instance - in the Pov3.5 example
file "splinefollow.pov", how could I make the planes move around that spline
at a constant speed?

Thanks for your quick response
Mike E.


Post a reply to this message

From: Christopher James Huff
Subject: Re: 3d splines with uniform intervals ???
Date: 13 Jan 2003 20:43:15
Message: <cjameshuff-99BF94.20430313012003@netplex.aussie.org>
In article <web.3e223c736e508e7a130c700f0@news.povray.org>,
 "Mike E." <nomail@nomail> wrote:

> I'm interested in your statement, "it isn't necessary". Is there something
> simple that I am missing?

I mean it doesn't require anything that isn't possible in POV.


> How would you move something along a spline at a
> constant speed? A real world example for instance - in the Pov3.5 example
> file "splinefollow.pov", how could I make the planes move around that spline
> at a constant speed?

Make a macro that creates a new spline that follows the original spline, 
but has time values calculated to keep the speed constant. Split the 
original into separate intervals, figure out the length of an interval 
and the entire spline...it really isn't difficult if you are familiar 
with coding. I'll dig out my old experiments, if I have time.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Ken
Subject: Re: 3d splines with uniform intervals ???
Date: 13 Jan 2003 21:18:01
Message: <3E237326.21C46595@pacbell.net>
Christopher James Huff wrote:
> 
> In article <web.3e223c736e508e7a130c700f0@news.povray.org>,
>  "Mike E." <nomail@nomail> wrote:
> 
> > I'm interested in your statement, "it isn't necessary". Is there something
> > simple that I am missing?
> 
> I mean it doesn't require anything that isn't possible in POV.

There are a lot of things -possible- in POV-Ray IF, you have an IQ over 200,
you know math at the quantum physics level and you can program like God, but
there are some things that it would be nice if POV-Ray could just do for you
without having to do all the mental gymnastics. What you might call program
bloat I call ease of use.

-- 
Ken Tyler


Post a reply to this message

From: Christopher James Huff
Subject: Re: 3d splines with uniform intervals ???
Date: 13 Jan 2003 21:52:09
Message: <cjameshuff-84D63F.21520613012003@netplex.aussie.org>
In article <3E237326.21C46595@pacbell.net>, Ken <tyl### [at] pacbellnet> 
wrote:

> There are a lot of things -possible- in POV-Ray IF, you have an IQ over 200,
> you know math at the quantum physics level and you can program like God, but
> there are some things that it would be nice if POV-Ray could just do for you
> without having to do all the mental gymnastics. What you might call program
> bloat I call ease of use.

It doesn't require quantum physics math or God-like programming skills, 
and I didn't call it code bloat. It would be nice if it was built-in, 
just for the increased speed, efficiency, and precision, but it is not 
impossible or even extremely difficult for someone with some coding 
experience.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Ken
Subject: Re: 3d splines with uniform intervals ???
Date: 13 Jan 2003 22:00:00
Message: <3E237CFF.A2913741@pacbell.net>
Christopher James Huff wrote:
> 
> In article <3E237326.21C46595@pacbell.net>, Ken <tyl### [at] pacbellnet>
> wrote:
> 
> > There are a lot of things -possible- in POV-Ray IF, you have an IQ over 200,
> > you know math at the quantum physics level and you can program like God, but
> > there are some things that it would be nice if POV-Ray could just do for you
> > without having to do all the mental gymnastics. What you might call program
> > bloat I call ease of use.
> 
> It doesn't require quantum physics math or God-like programming skills,
> and I didn't call it code bloat. It would be nice if it was built-in,
> just for the increased speed, efficiency, and precision, but it is not
> impossible or even extremely difficult for someone with some coding
> experience.

Is it too late for me to add a smiley to my last post?

-- 
Ken Tyler


Post a reply to this message

From: Christopher James Huff
Subject: Re: 3d splines with uniform intervals ???
Date: 13 Jan 2003 22:40:26
Message: <cjameshuff-2F3646.22402213012003@netplex.aussie.org>
In article <3E237CFF.A2913741@pacbell.net>, Ken <tyl### [at] pacbellnet> 
wrote:

> Is it too late for me to add a smiley to my last post?

Yes.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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