POV-Ray : Newsgroups : povray.programming : How normal vector computation works in Povray ? : Re: How normal vector computation works in Povray ? Server Time
1 Jul 2024 06:23:14 EDT (-0400)
  Re: How normal vector computation works in Povray ?  
From: Helix
Date: 19 May 2004 15:15:01
Message: <web.40abb16e57c01bb53cca0c610@news.povray.org>
ABX <abx### [at] abxartpl> wrote:

> In short Normal in Point P on torus surface has direction of vector which ends
> in point P and begins in nearest to P point on circle created by major rarius.
> So all you need is to normalize this vector.

Even if I normalize my N vector, it doesn't work. According to me, the
problem doesn't come from here.

Below, the source code of torus_normal():

/* SOURCE CODE BEGIN */

  /* Transform the point into the torus space. */
  MInvTransPoint(P, Inter->IPoint, Torus->Trans);

  /* Get normal from derivatives. */
  dist = sqrt(P[X] * P[X] + P[Z] * P[Z]);
  if (dist > EPSILON)
  {
    M[X] = Torus->R * P[X] / dist;
    M[Y] = 0.0;
    M[Z] = Torus->R * P[Z] / dist;
  }
  else
  {
    Make_Vector(M, 0.0, 0.0, 0.0);
  }
  VSub(N, P, M);

  /* Transform the normalt out of the torus space. */
  MTransNormal(Result, N, Torus->Trans);

  VNormalize(Result, Result);
/* SOURCE CODE END */


As you can see, the formula is totally different than mine.


Post a reply to this message

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