POV-Ray : Newsgroups : povray.general : center of union : Re: center of union Server Time
26 Apr 2024 07:25:49 EDT (-0400)
  Re: center of union  
From: clipka
Date: 24 May 2018 13:49:41
Message: <5b06fb35$1@news.povray.org>
Am 24.05.2018 um 19:22 schrieb Kima:

> 1. How to put the center of a unioned object at <0, 0, 0>?

That's trivial: Find the center of the object, then translate it by the
negative of that center's position.

> OR
> 2. How to find the coordinates of the center of a unioned object?

That depends entirely on the unioned objects.

Also, you'd need to decide whether you want center of mass or
coordinate-wise center of max extent.

POV-Ray has no means of figuring this out automatically; with so many
different primitives supported, and some of them being arbitrarily
flexible, it is virtually impossible to come up with a generic yet exact
way to solve this problem.

In your search you may come across `min_extent()` and `max_extent()`;
note that these can be used on any object as a /rough/ estimate of the
region of space occupied by that object, but the values are not
guaranteed to be exact: `min_extent()` may return lower values
(sometimes significantly so), while `max_extent()` may return higher
values (again sometimes significantly so). The only thing guaranteed is
that the entirety of the object lies /somewhere/ within those bounds.

What you /can/ do is use `trace()` and/or `inside()` to probe the
resulting shape; but again this won't be exact for arbitrary cases.

> OR
> Is there any approach/trick to translate a unioned object (collection of several
> objects) to move to a specific point (absolute coordinates)?

That's trivial: Find the center of the object, then translate it by the
target position minus the center's position.


Yeah, I know the answers to 1. and 3. do not help you at all. The point
is, it all boils down to solving 2.


Post a reply to this message

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