Re: How I learned to stop worrying and love Ldraw. (Subtitle: questions for programmers)
2012-12-18, 2:47
2012-12-18, 2:47
Paul Griffin Wrote:2. Huh; I did not think about that. I can definitely think of cases where there wouldn't be conditional lines but you'd want smoothing (e.g, the interior of a funnel). Speaking of conditional lines, do you just brute force them and draw them one at a time? There's got to be a faster way to handle them...
As it happens, LDView implements two different smoothing algorithms:
- The first is as described above, and is used by the interactive 3D part of LDView. It does indeed produce very good results for most parts, but doesn't for some parts (like the minifig heads). It also requires an angle threshold, because certain geometry (for example, a sharp cone), cannot be properly smoothed, no matter what you do.
- The second is similar, but instead of using conditional lines to detect smooth surfaces, it uses edge lines to detect creases (along with an angle threshold). LDView uses this algorithm for its POV export. This is closer to a typical "smooth all adjacent faces whose difference in angle is less than x degrees" algorithm, but the edge lines give it extra data that these types of algorithms typically don't have, so the angle threshold can be set relatively high while still producing good results.