POV-Ray : Newsgroups : povray.binaries.images : Isosurface doodle : Re: Isosurface doodle Server Time
17 May 2024 23:37:12 EDT (-0400)
  Re: Isosurface doodle  
From: Bald Eagle
Date: 25 Jul 2016 17:55:00
Message: <web.57968aa4ca82f27f5e7df57c0@news.povray.org>
I started with this stuff from TOK,

#declare Spacing = 10;
#declare Xspc = Spacing;
#declare Yspc = Spacing;
#declare Zspc = Spacing;

#declare HalfXspc = Xspc/2;
#declare HalfYspc = Yspc/2;
#declare HalfZspc = Zspc/2;

// returns opposite sign Halfspc except for 0.
#declare XFn = function(x) { mod(x, Xspc) - select(x, -HalfXspc, 0, HalfXspc) }
#declare YFn = function(y) { mod(y, Yspc) - select(y, -HalfYspc, 0, HalfYspc) }
#declare ZFn = function(z) { mod(z, Zspc) - select(z, -HalfZspc, 0, HalfZspc) }

added

#declare Theta = pi/6;
#declare Theta2 = -pi/6;
#declare XRotate = function { x*cos(Theta) + z*sin(Theta)}
#declare ZRotate = function { x*cos(Theta) + z*sin(Theta)}
#declare ZRotate2 = function { x*cos(Theta) + z*sin(Theta2)}

based on
https://en.wikipedia.org/wiki/Rotation_of_axes
equation 5

figured I needed new sets of equations to partition the plane based on the
rotated axes

#declare XPrimeFn = function { mod(XRotate(x, y, z), Xspc) - select(x,
-HalfXspc, 0, HalfXspc) }
//#declare YPrimeFn = function { mod(y, Yspc) - select(y, -HalfYspc, 0,
HalfYspc) }
#declare ZPrimeFn = function { mod(ZRotate(x, y, z), Zspc) - select(z,
-HalfZspc, 0, HalfZspc) }
#declare ZPrimeFn2 = function { mod(ZRotate2(x, y, z), Zspc) - select(z,
-HalfZspc, 0, HalfZspc) }




Then I use these to generate my 3 isosurfaces:
#declare GridFunction1 = function { sqrt(pow(ZFn(z),2) + pow(y,2)) - 1 }
#declare GridFunction2 = function { sqrt(pow(ZPrimeFn(x, y, z),2) + pow(y,2)) -
1 }
#declare GridFunction3 = function { sqrt(pow(ZPrimeFn2(x, y, z),2) + pow(y,2)) -
1 }


Post a reply to this message

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