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:46:45 EDT (-0400)
  Re: Getting data out of a mesh2  
From: Tim Attwood
Date: 31 Jan 2007 23:09:59
Message: <45c16817$1@news.povray.org>
This should put the center of two triangles
together by moving one to the origin,
rotating with Reorient_Trans, then moving
it to the other triangles center.

#include "transforms.inc"
#macro Normal_Of_Triangle(A, B, C)
  vnormalize(vcross(B-A,C-A))
#end
#macro Center_Of_Triangle(A, B, C)
  ((A+B+C)/3)
#end
#macro Align_By_Triangles(A,B,C,D,E,F)
   translate -Center_Of_Triangle(A, B, C)
   Reorient_Trans(Normal_Of_Triangle(A, B, C),
      Normal_Of_Triangle(D, E, F))
   translate Center_Of_Triangle(D, E, F)
#end


Post a reply to this message

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