|
|
Jochen Lippert wrote:
>>There was recently some mention of improved bounding for sphere_sweeps
>>(the words "heirarchal bounding" caught my attention), but that's an
>>unofficial patch that's being worked on. For the time being, just be
>
>
> The idea behind this is to put each segment of the sweep into its own
> bounding box. Much less space wasted, much faster calculations
> hopefully.
Ah... I see. Yes, this sounds like a sensible approach given the
nature of the object.
> You can have the same effect with manual bounding, but it's
> hard to figure out the correct boxes, as you seem to have noticed. :)
> [...]
> That's always good. :) A simple solution for b-splines is to put every
> four consecutive spheres of the sweep description into a box. The
> sweep can't be outside of this box. Same goes for linear sweep and two
> consecutive spheres. Cubic (Catmull-Rom) sweeps are much harder to
> track, though.
Hmmm... this makes me idly ponder: until such time as there is
heirarchal bounding, perhaps one could use a macro to make
sphere_sweeps. This macro would take an array of control points and
build not one sweep but rather a lot of single segment sphere_sweeps,
duplicating control points at the appropriate places so that the ends
of the each segment smoothly connected to the next. Auto-bounding would
work it's magic on each individual segment instead of the whole group,
and the speed up effect might be comparable (?)
Don't know how much of a difference this would make in practice, but
this is an example...
// A utility macro called in Multisweep (below)
#macro _MultipleRadii(Num,RArray,This)
#if (Num>1)
RArray[This]
#else
RArray[0]
#end
#end
// SplineType is a string, Nodes and Radii are arrays. Note, if you
// want only a uniform radius, declare one element in the Radii array.
// This would be more convenient that having to type a lot of values
// when you only want one throughout.
// Tolerance and material are a float and declared material as you'd
// expect.
#macro MultiSweep(SplineType,Nodes,Radii,Tolerance,Material)
#ifndef(STRINGS_INC_TEMP)
#include "strings.inc"
#end
#local ThisNode = 0;
#local NodeCount = dimension_size(Nodes,1);
#local RadCount = dimension_size(Radii,1);
#while (ThisNode < NodeCount-3)
sphere_sweep {
Parse_String(SplineType)
#if (strcmp(SplineType,"linear_spline")!=0)
4,
#else
2,
#end
Nodes[ThisNode],
_MultipleRadii(RadCount,Radii,ThisNode)
Nodes[ThisNode+1],
_MultipleRadii(RadCount,Radii,ThisNode+1)
#if (strcmp(SplineType,"linear_spline")!=0)
Nodes[ThisNode+2],
_MultipleRadii(RadCount,Radii,ThisNode+2)
Nodes[ThisNode+3],
_MultipleRadii(RadCount,Radii,ThisNode+3)
#end
tolerance Tolerance
material { Material }
}
#local ThisNode = ThisNode +1;
#end
#end //Start_MultiSweep
--
@C[$F];
The Silver Tome :: http://www.silvertome.com
"You may sing to my cat if you like..."
Post a reply to this message
|
|