POV-Ray : Newsgroups : povray.general : Announce: IsoCSG include file 0.2.1 : Re: Announce: IsoCSG include file 0.2.1 Server Time
29 Jul 2024 10:27:21 EDT (-0400)
  Re: Announce: IsoCSG include file 0.2.1  
From: Tor Olav Kristensen
Date: 14 Mar 2002 17:57:10
Message: <3C9129E6.373D4186@hotmail.com>
Christoph Hormann wrote:
> 
> I fixed a few problems since i posted the first version in p.b.s-f.  Also
> wrote some documentation and an add-on for the Povray 3.5 insert menu.
> 
> http://www.tu-bs.de/~y0013390/pov/ic/index.html

Christoph, I have had a look at the
code in the iso_csg.inc file.

And below are some of my suggestions
for simplifications of those macros.

I'm not sure, but from a very brief
test on my slow P100 PC at home, the
iso_csg_test02.pov file seems to
render a little bit faster with these
changes.

I have not tested all the macros below,
because I do not have patience to do
further tests with this PC (~150 PPM).

I have also added to more macros:
IC_Reorient() and IC_AxisRotate()


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#macro IC_Transform(Fn, Trans)

  #local fn_T = function { transform { Trans inverse } }

  function {
    Fn(
      fn_T(x, y, z).x,
      fn_T(x, y, z).y,
      fn_T(x, y, z).z
    )
  }

#end // macro IC_Transform 


#macro IC_Translate(Fn, pTranslate)

  IC_Transform(
    function { Fn(x, y, z) },
    transform { translate <0, 0, 0> + pTranslate }
  )

#end // macro IC_Translate


#macro IC_Scale(Fn, vScale)

  IC_Transform(
    function { Fn(x, y, z) },
    transform { scale vScale }
  )

#end // macro IC_Scale


#macro IC_Rotate(Fn, vRotate)       // Rotate Degrees

  IC_Transform(
    function { Fn(x, y, z) },
    transform { rotate <0, 0, 0> + vRotate }
  )

#end // macro IC_Rotate


#macro IC_RotateR(Fn, vRotate)      // Rotate Radians

  IC_Transform(
    function { Fn(x, y, z) },
    transform { rotate <0, 0, 0> + vRotate*180/pi }
  )

#end // macro IC_RotateR


#macro IC_Reorient(Fn, vAxis1, vAxis2)

  IC_Transform(
    function { Fn(x, y, z) },
    transform { Reorient_Trans(vAxis1, vAxis2) }
  )

#end // macro IC_Reorient


#macro IC_AxisRotate(Fn, Angle)

  IC_Transform(
    function { Fn(x, y, z) },
    transform { Axis_Rotate_Trans(vAxis, Angle) }
  )

#end // macro IC_AxisRotate


#macro IC_Matrix(Fn, Mtrx)       // not equivalent to the matrix transform!

  IC_Transform(
    function { Fn(x, y, z) },
    transform {
      matrix <
        Mtrx[0][0], Mtrx[0][1], Mtrx[0][2],
        Mtrx[1][0], Mtrx[1][1], Mtrx[1][2],
        Mtrx[2][0], Mtrx[2][1], Mtrx[2][2],
                 0,          0,          0
      >
    }
  )

#end // macro IC_Matrix

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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