POV-Ray : Newsgroups : povray.advanced-users : Getting data out of a mesh2 : Re: Getting data out of a mesh2 Server Time
6 Oct 2024 13:48:06 EDT (-0400)
  Re: Getting data out of a mesh2  
From: Tor Olav Kristensen
Date: 21 Feb 2007 19:14:57
Message: <45dce081$1@news.povray.org>
David Wallace wrote:
...
> Is there a variant of ReorientCenter that takes 6 points, 3 from one 
> triangle and three from the other, that will line up the first triangle 
> to exactly fit the other?
> 
> #macro ReorientTriangle(p1,p2,p3,p4,p5,p6)
>   #local tr1 = transform { matrix <p1.x,p1.y,p1.z, p2.x,p2.y,p2.z, 
> p3.x,p3.y,p3.z, 0,0,0> inverse }
>   #local tr2 = transform { matrix <p4.x,p4.y,p4.z, p5.x,p5.y,p5.z, 
> p6.x,p6.y,p6.z, 0,0,0> }
>   transform tr1
>   transform tr2
> #end
...
> I tested this and got an unexpected result... the fourth point in the 
> tetrahedron is way off course while the first three points are spot on. 
>  I need a set of translations and rotations that have the normals facing 
> each other, the face centers and first points matching.
> 
> Ideas are welcome.

This thread might be relevant for you:

http://news.povray.org/povray.text.tutorials/thread/%3C3D9B843D.E5392CD0%40hotmail.com%3E/
http://tinyurl.com/2h3kge
"How to transform a triangle into another"
Posted by me 2nd October 2002 to povray.text.tutorials

IIRC the Triangle2Triangle_Trans() macro should preserve
normals to the triangle.

(If you try that macro, remember to apply the corrections
in my follow-up post 12 minutes later.)

You'll also find a macro there that will transform a
tetrahedron into another: Pyramid2Pyramid_Trans()

-- 
Tor Olav
http://subcube.com


Post a reply to this message

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