POV-Ray : Newsgroups : povray.binaries.images : B-DNA : Re: B-DNA - testing the macro Server Time 3 Mar 2024 17:33:36 EST (-0500)
 Re: B-DNA - testing the macro
 From: Bald Eagle Date: 9 Feb 2024 08:25:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.65c6278b139a83601f9dae3025979125%40news.povray.org",
"headline": "Re: B-DNA - testing the macro",
"dateCreated": "2024-02-09T13:25:00+00:00",
"datePublished": "2024-02-09T13:25:00+00:00",
"author": {
"@type": "Person",
"name": "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.

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.

- BW
```

Attachments: