POV-Ray : Newsgroups : povray.newusers : object parameters : Re: object parameters Server Time
24 Apr 2024 02:10:40 EDT (-0400)
  Re: object parameters  
From: Bald Eagle
Date: 15 Feb 2023 14:40:00
Message: <web.63ed34f2dae7e3791f9dae3025979125@news.povray.org>
"seNex" <nomail@nomail> wrote:

> thanks for the quick reply. The underlying problem is, I wanted to track the
> center of the sphere after applying transformations to it. It seems to me from
> the documentation, that there is no way to apply transformations to the vector,
> but only to objects.

Well, that's not completely true.
I have asked this question before, and here's what you can do:

#include "transforms.inc"
// Translate a "point"
#declare Translate = transform { translate { <x, y, z> } }
#declare NewPoint = vtransform (OldPoint, Translate);

And you can do that with any transformation.

Now, that's not very convenient when you want to just have the information
"attached" to the sphere, but I think I've found a way to do that.   POV-Ray
does not complain when you create a box {} with the two diagonal corners being
the same vector.

So, you can probably just write a little macro that applies whatever
transformations to your sphere, but also applies the transformations to the
zero-dimensional "box".  But you do it in a way where you don't just transform
the box, you redefine the old box as the box with the transform applied.

like:  #declare Box = vtransform (Box, Translate);

Then you can use min_extent and max_extent to get the coordinates of the point.
It's convoluted, but it gets the job done.

- BE



snippets:

#declare Box = box {1, 1}
#declare Min = min_extent (Box);
#declare Max = max_extent (Box);

// {Be sure to include debug.inc file!}

#debug concat( "Min = ", vstr(3, Min, ", ", 3, 0), " \n")
#debug concat( "Max = ", vstr(3, Max, ", ", 3, 0), " \n")


Post a reply to this message

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