Before going to patch parts definition to avoid T-J gaps, please consider the following:

LDraw part libray is made of recursive parts loading where the position of each of them is determined by a MATRIX.

Even if using the most precise mathematical approach, when you multiply a vertex position by a matrix, some kind of rounding will occour so, even the most precise vertex positioning or the best possible triangle subdivision will cause a gap!

The only way to solve this (and I personally test this with my SR 3DBuilder appl) is to perform a vertex position check at part loading to see if another vertex with the same position (plus a tollerance) has already been loaded, and, if this is the case, then the new vertex will change its coordinates to the already existing one.

This approach has many advantages:

- allows the usage of indexed primitives saving at least 60% of vertex definition

- allows a fast (even if not precise) computation of triangle normals

- comparing the value of the normal for an existing vertex with the normal for the new one let your application decide if a smoothing for the surface must be done or not (ie if the angle between normal is > 45° then avoid smoothing otherwise compute the new normal for the vertex)

The only disadvantage is loading time: I have to cache loaded parts in memory to allow quick model loading...

byes to all

Sergio

LDraw part libray is made of recursive parts loading where the position of each of them is determined by a MATRIX.

Even if using the most precise mathematical approach, when you multiply a vertex position by a matrix, some kind of rounding will occour so, even the most precise vertex positioning or the best possible triangle subdivision will cause a gap!

The only way to solve this (and I personally test this with my SR 3DBuilder appl) is to perform a vertex position check at part loading to see if another vertex with the same position (plus a tollerance) has already been loaded, and, if this is the case, then the new vertex will change its coordinates to the already existing one.

This approach has many advantages:

- allows the usage of indexed primitives saving at least 60% of vertex definition

- allows a fast (even if not precise) computation of triangle normals

- comparing the value of the normal for an existing vertex with the normal for the new one let your application decide if a smoothing for the surface must be done or not (ie if the angle between normal is > 45° then avoid smoothing otherwise compute the new normal for the vertex)

The only disadvantage is loading time: I have to cache loaded parts in memory to allow quick model loading...

byes to all

Sergio