POV-Ray : Newsgroups : povray.beta-test : Filling in T values in splines : Re: Filling in T values in splines Server Time
29 Jul 2024 22:32:18 EDT (-0400)
  Re: Filling in T values in splines  
From: Christopher James Huff
Date: 23 Feb 2002 21:46:54
Message: <chrishuff-4250AB.21464323022002@netplex.aussie.org>
In article <3c784c61@news.povray.org>,
 "Rune" <run### [at] mobilixnetdk> wrote:

> But I had forgotten that arrays do not allow abbreviating vectors as floats,
> as it is allowed almost everywhere else in POV-Ray. So the syntax is uglier
> than what I had hoped. The idea is that specified T values are multiplied
> with y, while unspecified T values are marked with an x. See below.
> 
> My question is - is the below syntax too ugly or would it be acceptable for
> a macro included in the POV-Ray distribution?

A suggestion: use macros for the entries.
#macro SE1(T, Point) y*T, Point #end
#macro SE2(Point) x, Point #end

array[7*2] {
    SE1(0, < 0, 1, 2>),
    SE2(< 1, 5, 0>),
    SE2(< 4, 1, 0>),
    SE1(0.9, < 0, 2, 1>),
    SE1(1.0, < 0, 0, 1>),
    SE2(< 6, 5, 4>),
    SE1(2.0, < 4, 3, 2>),
}

Ugh, I don't like it either. The macro name needs to be short, since it 
will be repeated so many times, but that increases the chance of name 
collision. Maybe it would be better to use file I/O to read in a spline 
file.
Using the vectors actually doesn't look that bad...'x' is pretty 
standard as a standin for "unknown", but something better could be used 
in place of 'y'...I don't think 'v' will work, POV might interpret it as 
a 2D vector. Maybe #declare T = y;? It could easily be overwritten by 
some scene variable though...
Hmm. How about this: use 4D vectors in the array. When the T value is to 
be unspecified, give it some value like -1 that will indicate that it 
needs to be interpolated. Or use 4D vectors and the present syntax, so 
you can use "NNN*t" in place of "NNN*y".

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

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