|
![](/i/fill.gif) |
In article <3e08a125$1@news.povray.org>,
"Thorsten Froehlich" <tho### [at] trf de> wrote:
> In article <chr### [at] netplex aussie org> ,
> Christopher James Huff <chr### [at] mac com> wrote:
>
> > this code has no effect other than screwing up my patch.
>
> So it works as designed? ;-)
Heh...
Well, it actually does do something, but it does more work than it needs
to. It swaps the vertices and then passes them to another function. I
changed it to pass them in a different order, the code is cleaner IMO
and slightly faster, though not in a place where it really matters.
Basically, replace the following in Compute_Mesh_Triangle():
Assign_Vector(T1, P1);
Assign_Vector(P1, P2);
Assign_Vector(P2, T1);
if (Smooth)
{
temp = Triangle->N2;
Triangle->N2 = Triangle->N1;
Triangle->N1 = temp;
}
}
if (Smooth)
{
// compute_smooth_triangle(Triangle, P1, P2, P3);
Triangle->Smooth = true;
}
compute_smooth_triangle(Triangle, P1, P2, P3);
With this:
if(Smooth)
{
temp = Triangle->N2;
Triangle->N2 = Triangle->N1;
Triangle->N1 = temp;
Triangle->Smooth = true;
}
compute_smooth_triangle(Triangle, P2, P1, P3);
}
else
{
if(Smooth)
Triangle->Smooth = true;
compute_smooth_triangle(Triangle, P1, P2, P3);
}
And get rid of the T1 variable. And if compute_smooth_triangle() really
does something needed for flat triangles, that should probably be pulled
out.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |