How I learned to stop worrying and love Ldraw. (Subtitle: questions for programmers)


Re: How I learned to stop worrying and love Ldraw. (Subtitle: questions for programmers)
#4
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.
Unfortunately, the two algorithms work on completely separate input data, so I can't directly compare them in the real-time 3D part of LDView, and they're both what I would call non-trivial. So, to be honest, I'm not sure which is best, but my gut feeling is that the algorithm I use for POV export is better. (Having said that, I don't think it does any better on minifig faces than the other algorithm, although I haven't thoroughly investigated this.)
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: How I learned to stop worrying and love Ldraw. (Subtitle: questions for programmers) - by Travis Cobbs - 2012-12-18, 2:47

Forum Jump:


Users browsing this thread: 2 Guest(s)