POV-Ray : Newsgroups : povray.binaries.animations : Which ship would you rather ride in? : Re: Which ship would you rather ride in? Server Time
19 Jul 2024 17:20:45 EDT (-0400)
  Re: Which ship would you rather ride in?  
From: Tor Olav Kristensen
Date: 7 Jan 2003 21:41:03
Message: <Xns92FD25F245CE9torolavk@204.213.191.226>
"Greg M. Johnson" <gregj:-)565### [at] aolcom> wrote in
news:3e1ad518$1@news.povray.org: 

> You're purely correct for a turn.  You're right about needing to
> roll your own macro.
> 
> But when you're beyond a region with any considerable "curvature to
> the path"-- I said once you'd completed the turn--  I'd assert you
> always want zero roll.
> 
> Interesting Q:  Is there a way to compute instantaneous "sphere of
> curvature" on a plain ol' pov 35. spline?
...

I don't know what you really mean by "sphere of
curvature". But I guess that you are want to find
the radius of the curve at a specific point along
a spline.

You can solve that problem numerically by
finding two other points, on the spline, close
to the point that you would like to find the
curvature for.

You could for example find these points by
choosing one T-value a little below the T-value
for the point in question, and one T-value a
little above. 

When you have these 3 points, and if they are
not co-linear, then there is only one cirlce
in 3D-space that will "pass through" them all.
And this circle is possible find analytically.

In this post you'll win find a macro I made
that does that job:

http://news.povray.org/povray.general/17701/114420
A reply I made to Mark M. Wilson's thread
"general geometry question" 21. Aug. 2001 to
povray.general.

This post may also be relevant. (Same thread)
http://news.povray.org/povray.general/17701/114421/


// Define problem
#declare t0 = 1.56;
#declare p0 = YourSpline(t0);
#declare H = 1e-5;
#declare p1 = YourSpline(t0 + H);
#declare p2 = YourSpline(t0 - H);

// Call macro to solve problem
#declare pCtr = <0, 0, 0>;
#declare Rad = 0;
#declare vN = <0, 0, 0>;
CircleTouches3Points(p0, p1, p2, pCtr, Rad, vN)


After the macro call, Rad will contain the
radius of the circle that "goes through"
these 3 points. pCtr and vN will also contain
info that may be useful.

Note that if the points are co-linear then:

vlength(vcross(p1 - p0, p2 - 0)) = 0

I.e. the radius will be infinite, and the
macro will fail if called with these points
as inputs. (So you better test for this first.)

Here is an image that shows how these circles
would be for different points along a spline:
http://news.povray.org/povray.binaries.images/12141/


This is just my "first thoughts" about this
problem. There are most likely other more
correct and/or simpler methods available.


Tor Olav


P.S. If you meant to find the sphere that
"fits best" beneath your curve at the 
point YourSpline(t0), then here's a
suggestion for some code that I think will
work:

// Define problem
#declare t0 = 1.56;
#declare H = 1e-5;
#declare pA = YourSpline(t0 - H*2);
#declare pB = YourSpline(t0 - H);
#declare pC = YourSpline(t0 + H);
#declare pD = YourSpline(t0 + H*2);

// Call macro to solve problem
#declare pCtr = <0, 0, 0>;
#declare Rad = 0;
SphereTouches4Points(pA, pB, pC, pD, pCtr, Rad)
// This macro can be found in mentioned post.


Remember to check for co-planarity before
calling this macro. I.e. check if:

vdot(pB - pA, vcross(pC - pA, pD - pA)) = 0


Post a reply to this message

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