POV-Ray : Newsgroups : povray.animations : camera-spline behaves weird Server Time
18 Jun 2024 08:27:44 EDT (-0400)
  camera-spline behaves weird (Message 1 to 7 of 7)  
From: Marc Roth
Subject: camera-spline behaves weird
Date: 13 Feb 2004 12:55:51
Message: <402d0fa7@news.povray.org>
Hi everybody!
i'm currently working on a scene with a car driving along a street, changing
the lane and then turning left at a intersection. i tried using a
quadratic_spline, cubic_spline and a natural_spline for the cam-movement but
the problem is that all three of them don't produce an accpetable path
across the intersection. it's not like a part of a circle but has some
unneccessary movements to the left and the right in it (am i confusing you?
sorry...). so basically i need to know how to create a spline that produces
a path similar to a quarter of a circle.

    Marc


Post a reply to this message

From: ABX
Subject: Re: camera-spline behaves weird
Date: 13 Feb 2004 13:05:13
Message: <g14q20t197ugso0e550s3p246gvn721stg@4ax.com>
On Fri, 13 Feb 2004 19:00:30 +0100, "Marc Roth" <mar### [at] rothconsultcom> wrote:
> so basically i need to know how to create a spline that produces
> a path similar to a quarter of a circle.

Use something like this not tested macro. It approximates circle with linear
spline. Use Accuracy between 0 and 1

#macro QuarterOfCircleSpline(Center,Radius,Accuracy,Angle)
  #local S=spline{
    #local Counter=0;
    #while (Counter<Angle)
      Counter (vrotate(x*Radius,y*Counter)+Center)
      #local Counter=Counter+Angle*Accuracy;
    #end
    Angle (vrotate(x*Radius,y*Angle)+Center)
  };
  spline{S}
#end

Adjust further to your needs.

ABX


Post a reply to this message

From: Marc Roth
Subject: Re: camera-spline behaves weird
Date: 13 Feb 2004 21:43:21
Message: <402d8b49@news.povray.org>
ABX wrote:
> On Fri, 13 Feb 2004 19:00:30 +0100, "Marc Roth" <mar### [at] rothconsultcom> wrote:
> 
>>so basically i need to know how to create a spline that produces
>>a path similar to a quarter of a circle.
> 
> 
> Use something like this not tested macro. It approximates circle with linear
> spline. Use Accuracy between 0 and 1
> 
> #macro QuarterOfCircleSpline(Center,Radius,Accuracy,Angle)
>   #local S=spline{
>     #local Counter=0;
>     #while (Counter<Angle)
>       Counter (vrotate(x*Radius,y*Counter)+Center)
>       #local Counter=Counter+Angle*Accuracy;
>     #end
>     Angle (vrotate(x*Radius,y*Angle)+Center)
>   };
>   spline{S}
> #end
> 
> Adjust further to your needs.
> 
> ABX

Hi ABX,
thanks a lot for your answer, but i'm afraid i don't quite understand it 
as i'm not very familiar with macros. i understand that 
QuarterOfCircleSpline is a macro that creates a spline named S which 
looks like a quarter circle with a radius of Radius and the center 
Center. the accuracy is understandable as well, the smaller it is, the 
smaller are the steps in which the circle is drawn. but what is angle 
for? do i use S(clock) for the cam-movement? it doesn't seem to work 
quite right as i get an error: "Parse Error: Expected 'object or 
directive', spline found instead" in the line with spline(S).
ciao,
	Marc


Post a reply to this message

From: Mike Williams
Subject: Re: camera-spline behaves weird
Date: 14 Feb 2004 01:37:56
Message: <qSfiYGAQHcLAFwGN@econym.demon.co.uk>
Wasn't it Marc Roth who wrote:
>Hi everybody!
>i'm currently working on a scene with a car driving along a street, changing
>the lane and then turning left at a intersection. i tried using a
>quadratic_spline, cubic_spline and a natural_spline for the cam-movement but
>the problem is that all three of them don't produce an accpetable path
>across the intersection. it's not like a part of a circle but has some
>unneccessary movements to the left and the right in it (am i confusing you?
>sorry...). so basically i need to know how to create a spline that produces
>a path similar to a quarter of a circle.

Here's a spline that does a quarter circle turn

#declare MySpline = spline {
   natural_spline
    0,     <-1, 0, 0>,
    0.001, <-0.999, 0, 0>,
    0.5,   <-1+sin(pi/4),0,1-sin(pi/4)>,
    0.999, <0,0,0.999>,
    1,     < 0, 0, 1>
}

The second and fourth control point force the direction of the tangent
at the endpoint. The third control point stops it taking a shortcut.

Unfortunately, this may lose you some of the advantages of using a
spline, and you might as well drive along an actual circle.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: ABX
Subject: Re: camera-spline behaves weird
Date: 16 Feb 2004 05:55:02
Message: <688130l1ck9mep3n63u2defqlehenk4kg9@4ax.com>
On Sat, 14 Feb 2004 03:47:58 +0100, Marc Roth <mar### [at] rothconsultcom> wrote:
> but what is angle for?

Sorry, as I said it was not tested. I wrote it initialy to create only quarter
of circle but finally made macro for making arc of any angle in circle.

> do i use S(clock) for the cam-movement? it doesn't seem to work 
> quite right as i get an error: "Parse Error: Expected 'object or 
> directive', spline found instead" in the line with spline(S).

It is supposed to return spline. You have assign it to another variable and
use that variable like splines you tested previously.

ABX


Post a reply to this message

From: Marc Roth
Subject: Re: camera-spline behaves weird
Date: 18 Feb 2004 10:26:01
Message: <40338409$1@news.povray.org>
> [something about making a spline which goes a quarter of a circle]

hm, i tried something myself and it worked out. i simply looked at the 
formula for a circle which is

x^2 + y^2 = r^2

x and y are the coordinates and r is the radius of the circle. you can 
make it more flexible by changing it to

(x-a)^2 + (y-b)^2 = r^2

now it's a circle with radius r around a center with the coordinates <a,b>
if you solve this equation you get:

y = sqrt( r^2 - (x-a)^2 ) - b

this can be used rather easy in a #while loop to create the 
controlpoints for the spline.

bye,
	Marc


Post a reply to this message

From: glenn xnhase
Subject: Re: camera-spline behaves weird
Date: 16 Jun 2004 22:05:01
Message: <web.40d0fbc3ae1c7fd1e2f575410@news.povray.org>
"Marc Roth" <mar### [at] rothconsultcom> wrote:
> Hi everybody!
> i'm currently working on a scene with a car driving along a street, changing
> the lane and then turning left at a intersection. i tried using a
> quadratic_spline, cubic_spline and a natural_spline for the cam-movement but
> the problem is that all three of them don't produce an accpetable path
> across the intersection. it's not like a part of a circle but has some
> unneccessary movements to the left and the right in it (am i confusing you?
> sorry...). so basically i need to know how to create a spline that produces
> a path similar to a quarter of a circle.
>
>     Marc




Are you using colefax's spline.mcr package?  Can you provide the data points
and options used to create the spline?  Where along the path (between what
data points) does the problem occur?

I've been dealing with some spline problems that sound similar to yours.  My
data points should have described essentially straight line motion with
some rather lazy curves side to side, but spline.mcr seemed to want to add
a loop (yes, it reversed direction) in the middle of the spline.  To add to
the frustration, the loop was so squeezed in the side-to-side direction it
wasn't apparent during the spline preview.  I think part of my problem was
using data points with very irregular separation.  In the straighter
sections data points were separated by many tens of units; in the more
curved sections they were separated by only a few units.  This, I think,
allowed an opportunity for the calculated spline to loop in the large gaps.
 Adjusting the spline tension seemed to help, but I'm not sure why.  I hope
to get some help with my problem (see my recent post regarding spline
spacing), also.

Good luck!

Glenn C.


Post a reply to this message

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