POV-Ray : Newsgroups : povray.binaries.images : B-DNA : Re: B-DNA - testing the macro Server Time 3 Mar 2024 18:21:05 EST (-0500)
 Re: B-DNA - testing the macro
 From: Thomas de Groot Date: 10 Feb 2024 03:21:08 Message: <65c731f4\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#65c731f4%241%40news.povray.org",
"headline": "Re: B-DNA - testing the macro",
"dateCreated": "2024-02-10T08:21:08+00:00",
"datePublished": "2024-02-10T08:21:08+00:00",
"author": {
"@type": "Person",
"name": "Thomas de Groot"
}
}
Op 9-2-2024 om 14:24 schreef Bald Eagle:
> The other thing that might not be immediately obvious, but will help in the
> overall understanding of the macro's general use is that you only need to
> identify 3 points in/on an object in order to line it up with another
> instantiation of itself.
>
> Anything.  Triangles, cubes, meshes, parametrics, splines, point clouds, or even
> entire included scenes.
>
Yes, that is the fantastical approach of the macro. And it is so easy in
use!

> Let's say you're modeling something in pieces, and you have a spot on a CSG
> object where you need to place the next piece.  It needs to fit in some specific
> alignment, but it's always easier to model things near the origin, lying flat on
> a plane, etc.
>
> What you can do is take the points on the csg object that you modeled, and
> concatenate all of the transforms that you used to put the object containing
> that point where it currently is.  Apply that transform to an <x, y, z> vector
> using vtransform, and you have the exact coordinates of those points.
>
> Now you can take one of those points and place it on the origin, and either with
> math or macros arrange the other two points to lie flat on the plane.  Get those
> 3 coordinates.
>
> Knowing that the triangle on the plane will now fit perfectly into/onto your csg
> object, you can model your piece, and then use Reorient_Triangle to just move it
> where it needs to go.
>
> Likely we could use a macro that will just grab that csg triangle and move it to
> the plane at the origin and return the 3 coordinates as a tuple.
>
I had not yet thought that far, but that would be a logical use of the
macro. Something to experiment with. It might solve some issues I was
struggling with in my LogoPlanet scene recently.

--
Thomas
```