|
![](/i/fill.gif) |
ABX <abx### [at] abx art pl> 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
|
![](/i/fill.gif) |