|
|
Wasn't it gregjohn who wrote:
>Mike Williams wrote:
>
>> You recalculate the position and normal of each point 6 times,
>> and this typo means that 3 of the 6 recalculations are slightly
>> misplaced.
>
>Oh, my. You mean five unnecessary recalculations? Sometimes I think doing
>this kind of stuff with the intellectual capacity I have is like a
>five-year-old driving a heavily loaded tractor trailer.
>
>
>Nonetheless, I am extremely grateful that you took the time to fix the code.
>And my I ask, "Source, please?" ;-) It would have great value in my
>animations as I try to make pipes: sliced & diced torii were just giving me
>too many headaches.
I didn't keep the versions with the normals sticking out, and you can
obtain the final version by applying the changes I listed.
>But seriously, do you think this will have any universal value as a macro--
>the sphere sweep per se is a really slow rendering.
It might be a good idea to produce something that does this, but I'd
suggest a slightly different approach. I'd use Ingo Janssen's
makemesh.inc to do the mesh creation (because it's there, and it gives
us extra stuff like uv mapping, *.obj support and file cacheing) and put
our reusable stuff into a separate "sweepmesh.inc" file.
I'd only calculate each point once, and I'd calculate the spline
direction symmetrically (i.e. by taking a small step backwards and
forwards and taking the difference, rather than just stepping forwards).
I've nearly got some code working. It works for your particular splines,
but for some simple splines the points suddenly cross over to the other
side of the tube. Each calculated point is an actual point on the
surface, but the ring of points is twisted through 180 degrees.
I guess that the problem might be something to do with the line
#declare drx1=arr0*vnormalize(vcross(vrotate(dr1,40),dr1));
which I borrowed from your code without understanding it properly. If
you have a spline that turns so that its direction (dr1) changes from
angling slightly away from the origin to angling slightly towards it I
think the vcross() suddenly points in the opposite direction.
See my current code in binaries.scene-files.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|