[LSC] LDraw coplanarity check
Travis Cobbs
tcobbs at gmail.com
Wed Nov 14 16:25:00 EST 2007
I wasn't in on the beginning of this conversation, but based on what I've
seen, I'd like to thrown in my two cents.
First of all, Philo is right when he points out that gaps are a problem that
isn't related to non-planar quads (other than the fact that closing gaps
often leads to non-planar quads). It seems to me that his sine calculation
is the only thing that really matters. The reason that non-planar quads are
bad is that there's no "right" way to render them. The quad is split into
two triangles at render time, and the split is arbitrary; which two
triangles to choose? If the two triangles are at different angles, this
will be visible. If the quad is planar, there's no problem. The size of
the quad has no impact on the rendering error, though.
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.
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.9to change to
0.9998.) Also, what should be considered "acceptable" here. Is 1 degree
too tight?
--Travis
On Nov 14, 2007 12:56 PM, Philo <philohome at free.fr> wrote:
> I got further on this one and made some experiments...
>
> First I tested -dist and -det from LDDP with a slightly non planar quad
> at different scales. Here are the results:
> 4 16 0 0 10 1000 0 0 1000 1000 0 0 1000 0
> 0 // -dist = 10 -det = 10000000 -sine = 0.014
> 4 16 0 0 1 100 0 0 100 100 0 0 100 0
> 0 // -dist = 1 -det = 10000 -sine = 0.014
> 4 16 0 0 0.1 10 0 0 10 10 0 0 10 0
> 0 // -dist = 0.1 -det = 10 -sine = 0.014
> 4 16 0 0 0.01 1 0 0 1 1 0 0 1 0
> 0 // -dist = 0.01 -det = 0.01 -sine = 0.014
>
> As you can see, -dist returns a value proportional to the size of the
> quad, while -det provides a value proportional to the cube of the size!!!
>
> I then crufted an Excel sheet
> (http://www.brickshelf.com/gallery/Philo/Misc/coplanarity2.xls) with the
> angular criteria I proposed, which properly provides a nice constant
> figure (-sine in the results above). I also tested the same quad in
> different position and orientation with the same result (within
> calculation precision)
>
> Tested with real life value (see bottom of excel sheet), I also get very
> consistent values, all below 10^-3 (that's a 0.06 degree angle!)
>
> > My mathematics are not so good that I fully understand what you are
> > writing. But if we measure an angle, what is about huge parts? Same
> > angle (that is good for us) but big gap in the part.
>
> I don't think this is a problem. I mean - gaps should not happen of
> course, but generally we adjust quad apexes to match neighbour surfaces
> (precisely to close gaps) and in the process get a non-planar surface.
> While gaps can be easily spotted with the eyes while reviewing parts,
> planarity needs a measurement tool.
>
> Orion, would it be difficult to implement that within LDDP? I'd like to
> be able to test the sine criteria on a larger scale with real parts.
>
> Philo
>
> _______________________________________________
> LSC mailing list
> LSC at ldraw.org
> http://five.pairlist.net/mailman/listinfo/lsc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://five.pairlist.net/pipermail/lsc/attachments/20071114/7a1bc2df/attachment.htm>
More information about the LSC
mailing list