POV-Ray : Newsgroups : povray.general : Object Handling for Water-Surface-System : Re: Object Handling for Water-Surface-System Server Time
4 Aug 2024 22:17:04 EDT (-0400)
  Re: Object Handling for Water-Surface-System  
From: Tor Olav Kristensen
Date: 27 Mar 2003 14:20:59
Message: <Xns934BCF339D5DBtorolavkhotmailcom@204.213.191.226>
"Tim Nikias v2.0" <tim### [at] gmxde> wrote in 
news:3e82d3e5@news.povray.org:

...
> Aside of that, as I've looked into transform.inc, it seems
> you can do object transformation. You'd just have to
> convert from regular object to your isoCSG, and then
> apply the transformation.
> Though in this case, it might be handy to have some tool
> which'll read a POV-file as input, and, if its CSG, convert
> all the difference/intersection and sphere/box etc into
> isoCSG-code, and then transform isosurfaces. This would
> be pretty costly though. An other idea might be to use
> convert a sphere to a set of data, and then apply the trans-
> formation to the data. From this you could later reconstruct
> the original sphere in its new position.
> The hard part is the conversion and the appropriate approach,
> and then returning back to csg where possible.
> And for meshes you could save the three corners, transform
> it, and then reconstruct the new triangle. Same applies to
> surface-normals in case of smooth_triangles...
...

Sorry Tim, but if all your transformations are linear,
then I think that you are making things more difficult
then they are.

Instead of converting a CSG-object to an isosurface,
apply several transformations to it and then convert
it back to a CSG object, you could just multiply all
the matrices for the transformations successively with
an identity matrix and then finally apply the resulting
transformation matrix to your CSG-object.

In POV-Ray script it is done like this:

#declare TotalTransform =
  transform {
    scale <1, 1 + Time/10, 1>
    rotate 45*Time*y
    transform { SomeOtherTransformation }
    translate <1, -2, 3>*<Time, 1, Time*Time>
//    ... and so on ...
  }

object {
  YourCSG_Object
  transform { Totaltransform }
}

(POV-Ray will do all the matrix calculations for you.)


If you need to calculate the whole animation
sequence at once, then just calculate all the
transformations and then store all of them in
an array.

Here's how you could do it:

#declare Transformations[0] =
  transform { TransformationForStep0 }

#declare Transformations[1] =
  transform {
    transform { Transformations[0] }
    TransformationForStep1
  }

#declare Transformations[2] =
  transform {
    transform { Transformations[1] }
    TransformationForStep2
  }

... And so on (e.g. in a while loop) ...


If a transformation for a step depends on the position
(point) or direction (vector) of some objects, then
just apply the transformation for the previous step to
the points/vectors (in their _initial_ "state"). You can
use vtransform() to do this.

(Note that normal vectors for a surface must be treated
differently.)


Tor Olav


Post a reply to this message

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