Gerald Lasser Wrote:Now I though of doing a small script that "bends" the sticker along the edges that the parts provide. For the Santa Fe thsi would be the outer surface of the 6005.datGerald

Here's the $10,000 question: what will your program do if the sticker cannot be placed on the part without a wrinkle or bend?

For the case where you'd want to apply a sticker (e.g. a rectangular sticker around a curved top surface or curved arch top) there exists a good 'wrap' to make this happen.

But what about a part like 86500.dat (Dome 4x4 Smooth)? A sticker on the top would in real life be a wrinkled mess; the planar sticker can't cover the top well.

Or what about the front of the Maersk engine? There is a sticker covering a series of cheese slopes. In real life it works pretty well, but a computer program might be fooled by the small vertical edge of the cheese slope which interrupts the implied smooth surface.

The problem with coding this (as I see it) is that LDraw does not provide -guarantees- about the connectivity of a mesh. Even for a case that can work right (e.g. 6192.dat Brick 2x4 with curved top) the file format does not guarantee that the top smooth surface can be identified as continuous without gaps. There may even be small caps that must be covered with rounding due to problems with part authoring and rounding in the matrices of the primitives.

If I had to code this I think I would (I suppose) look at something like this:

http://www.cs.jhu.edu/~misha/Fall09/Levy02.pdf

Least Conformal Squares is one of the common ways that 3-d programs provide texture maps to arbitrary surfaces. I -think- that if the surface is good for stickering (e.g our curved tops) the UV map should have no distortion. The nice thing about an algorithm like this is that, if the sticker can't lay perfectly flat, it gets it as close as it can, so you don't have to deal with total algorithm failures due to rounding errors.

Once you have a "UV" map (a 2-d mapping of the sticker's X and Y space) over the part, you can then, for each triangle in the 3-d mesh, locate its place over the sticker, cut out a series of sub-triangles in the sticker, and place them in 3-d space. Because each triangle in the real 3-d part is (by definition :-) planar, applying the set of planar sticker sub-triangles doesn't require anything complicated.

Uh, I hope this isn't too discouraging. Unfortunately wrapping planar labels around arbitrary 3-d surfaces is complicated. Perhaps there could be some way to simplify the problem, e.g. have the user specify the cross-section of the curved surface the sticker will be placed on, then apply it. This would let you work from mathematical input data that is much more suited for your purpose than "triangle soup".

cheers

ben