POV-Ray : Newsgroups : povray.general : Please help with some really hard math : Re: Please help with some really hard math Server Time
11 Aug 2024 13:19:50 EDT (-0400)
  Re: Please help with some really hard math  
From: Jerry Anning
Date: 13 Jul 1999 12:41:53
Message: <378b61f8.7213444@news.povray.org>
On Tue, 13 Jul 1999 10:29:31 GMT, pet### [at] usanet (Peter Popov)
wrote:

>So here I state the problem again, more clearly. Given a closed smooth
>mesh M and a pont in space P outside the mesh, find the point(s) on M
>whose normal(s) point at P.

Here is another intuitive stab at the problem stated this way.
For each (possibly relevant) triangle of the mesh:
  If the normals of the three corners all point east of the target
point (or all point west ..., north..., above..., etc.) then that
triangle is irrelevant.
  For each remaining relevant triangle, there will be several cases:
    If all three vertices have normals pointing at the target, the
whole triangle will, so you will have to integrate over the triangle.
    If two vertices do, integrate over the line between them.
    If only one vertex does, use it.
    If no vertices have normals pointing at the target, and at least
two vertices have normals pointing into different "hemispheres" around
the target as determined above, then by continuity, there will be a
point in or on the triangle that has a normal pointing at the target.
In this case, proceed as follows:
      For each vertex of the triangle, compute a vector pointing at
the target from that point.
      Find the angle between that vector and the given normal at the
vertex (in radians).
      If it is greater than pi, subtract pi.
     Divide the result by pi.  You should have a number between zero
and one.
      Add the three numbers you just calculated together and divide
each one by the sum.  The three numbers will now sum to one, so you
have barycentric coordinates for a point on the triangle.
      Take the coordinates of each vertex (the point itself, not the
normal)  and multiply each component by the barycentric coordinate
calculated for that vertex.
      Add the transformed coordinates for each of the vertices
together componentwise.
      The result should be the coordinates of the appropriate point in
or on that triangle.

I don't have a formal proof that this will work, but give it a shot.

Jerry Anning
clem "at" dhol "dot" com


Post a reply to this message

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