POV-Ray : Newsgroups : povray.general : Isosurface, box with transformations : Re: Isosurface, box with transformations Server Time
3 Aug 2024 20:17:19 EDT (-0400)
  Re: Isosurface, box with transformations  
From: Christopher James Huff
Date: 23 Oct 2003 20:14:53
Message: <cjameshuff-A21381.20124523102003@netplex.aussie.org>
In article <3f967141@news.povray.org>,
 "StephenS" <ssh### [at] echelonca> wrote:

> Is there a better way to add the transformations to the individual shapes in
> the isosurface.

Well, there's a better way of representing the transformations in the 
first place. Declare a transform function with the inverse of the 
transforms:

#declare TransFn =
function {
    transform {
        ...your transforms...
        invert
    }
}

isosurface {
    function {
        f_isosurface_box(
            TransFn(x, y, z).x,
            TransFn(x, y, z).y,
            TransFn(x, y, z).z
        )
    }
    ...

Of course, this is less efficient than it could be, since you can't 
declare variables or handle vectors, but it's certainly easier to handle 
and more efficient at handling lots of transformations. You could write 
macros to create separate functions for the x, y, and z coordinates 
which might be more efficient...

#macro XTransFn(Trans)
    #local TransFn = function {transform {Trans}}
    #local C0 = TransFn(0, 0, 0);
    #local CX = TransFn(1, 0, 0) - C0;
    #local CY = TransFn(0, 1, 0) - C0;
    #local CZ = TransFn(0, 0, 1) - C0;
    function {x*CX.x + y*CY.x + z*CZ.x + C0.x}
#end

And similarly for y and z...a smarter macro could remove zero terms to 
speed calculation. This macro would be used like this:

#declare f_RotateX = XTransFn(transform {rotate ...})

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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