POV-Ray : Newsgroups : povray.general : How to transform and blob together iso-shapes in v3.5 Server Time
20 Nov 2024 10:31:58 EST (-0500)
  How to transform and blob together iso-shapes in v3.5 (Message 1 to 2 of 2)  
From: Tor Olav Kristensen
Subject: How to transform and blob together iso-shapes in v3.5
Date: 1 Oct 2001 16:35:10
Message: <3BB8D35B.BB527254@hotmail.com>
In POV-Ray v3.5 there is a new feature that
allows one to define transform functions.

And these functions can be used to do 
(static) transformations of iso-surface
shapes.

The advantage of doing this within the
functions for the iso-surface instead of 
adding the transformations at the end of
the iso-declaration(s) is that one can 
make the iso-shapes interact with one 
another in many fancy ways.

Below is some code to that shows how to
transform an iso-torus in two different
ways and then blob the two different 
copies together.

Also see image in povray.binaries.images

Have fun !


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Copyright 2001 by Tor Olav Kristensen
// mailto:tor### [at] hotmailcom
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =

#version 3.5; // Scene tested in v3.5 beta 4

#include "colors.inc"
#include "functions.inc" // Because it contains the f_torus() function

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

#macro TransformFunction(Fn, Transform)

  #local TT = function { transform { Transform inverse } }

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

#end // macro TransformFunction


#declare BlobbingFn = function(T, Sharpness) { 1/exp(Sharpness*T) }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Declarations of the functions for the iso-surface

#declare TorusFn = function { f_torus(x, y, z, 4.0, 0.8) }

#declare OneTransform =
transform {
  rotate 30*z
  scale <1, 1.5, 1>
  rotate -20*y
}

#declare TransformedTorusFn1 = 
TransformFunction(
  function { TorusFn(x, y, z) },
  OneTransform
)

#declare TransformedTorusFn2 = 
TransformFunction(
  function { TorusFn(x, y, z) },
  transform { translate -y }
)

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// And then assemble it all

#declare SharpNess = 10; // Also try e.g. 20

isosurface {
  function {
     1
    -BlobbingFn(TransformedTorusFn1(x, y, z), SharpNess)
    -BlobbingFn(TransformedTorusFn2(x, y, z), SharpNess)
  }
  contained_by { sphere { <0, 0, 0>, 8 } }
  max_gradient 10
  pigment { color White }
}

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

background { color Blue/2 }

light_source {
  <1, 3, -2>*100
  color White
  shadowless
}

camera {
  location <0, 1, -2>*7
  look_at <0, 0, 0>
}

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


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: How to transform and blob together iso-shapes in v3.5
Date: 1 Oct 2001 18:31:05
Message: <3BB8EE88.C7341169@hotmail.com>
Y wrote:
> 
> : Below is some code to that shows how to
> : transform an iso-torus in two different
> : ways and then blob the two different
> : copies together.
> :
> : Also see image in povray.binaries.images
> :
> : Have fun !
> :
> : Tor Olav
> 
> And when will we see your iso-shape anti-blobs ? ;)))
> Thanks ...

When I buy a new and _FAST_ computer...

=)


Tor Olav


Post a reply to this message

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