[LSC] LDraw coplanarity check

Philo philohome at free.fr
Wed Nov 14 17:07:37 EST 2007



> LDView's calculations for "non-flat" quads use the dot product of the

> normalized surface normals of the two triangles in the quad (using every

> combination of two triangles, actually). If that's <= 0 for any of the

> normal pairs, the quad is concave. If it's <= 0.9 for any of the normal

> pairs, LDView considers the quad to be non-flat. Unless I did the math

> wrong, that means LDView considers a quad to be flat as long as the two

> triangles are within 25 degrees of being the same. Ouch! Maybe I

> should go back and tighten that up.

>

Ouch indeed! 25 degrees is a lot...


> Can a math person confirm that? (I'm doing acos(0.9) = 25.8 degrees.

> Is this the right calculation? If so, then for 1-degree accuracy, I'd

> need 0.9 to change to 0.9998.)

I agree with your calculations. Note that the problem with cosine is
that you get very low precision on angle when it is near 0. Computing
sine like I did would be better for that.

> Also, what should be considered
> "acceptable" here. Is 1 degree too tight?

I made a quick experiment with ldview. The visibility threshold seems to
be around 0.4 degree. But that's for two side by side triangles. For a
twisted quad, even with much higher non-coplanarity I see no shading
variation (though looking at the quad from side show clearly it is not
flat !!!). A practical value seems to be about 1 degree indeed.

Philo





More information about the LSC mailing list