GeomLProp_SLProps sometimes doesn't calculate normals...

Hi guys! Why GeomLProp_SLProps sometimes return false from IsNormalDefined() ? It's depended on IMeshTools_Parameters? or on resolution or on derivations?

Ordinary, this happens on sharp conical 3D models.

Handle(Geom_Surface) surface = BRep_Tool::Surface(m_occtShape);
static const double resolution = 0.001;
static const int derivations = 1;
{
                gp_Pnt2d uv = triangulation->UVNode(n1);
                GeomLProp_SLProps props(surface, uv.X(), uv.Y(), derivations, resolution);
                bool hasNormal = props.IsNormalDefined();
                if (hasNormal)
                {
                    gp_Dir normal = props.Normal();
                    if (face_reversed)
                        normal = normal.Reversed();
                    m_normal[nn1] = SMDVec3D(normal.X(), normal.Y(), normal.Z());
                }
                else
                {
                    //sometimes fall there...
                }
}

Dmitrii Pasukhin's picture

Hello, GeomLProp_SLProps working with surface, there is no relating with mesh. The reason can be are not ordinary surface, not-relevant derivations or resolution. Or it can be internal bug.

Best regards, Dmitrii.

Dmitrii Pasukhin's picture

But if you want to extract Normal from mesh, you don't need to have initial geometry. The normal is a part of Tessilation or can be generated based on mesh(each triangle).

Best regards, Dmitrii.

Caleb Smith's picture

Thanks for reply!

The normal is a part of Tessilation or can be generated based on mesh(each triangle).

Yes, but I need exactly smoothed normals, otherwise I will get a disgusting quality granular image like this :)

This bug with GeomLProp_SLProps appears at a point on the tip of thin cones and as a result, in my CAD, I write the values (0.0, 0.0, 0.0) as a normal and, accordingly, in this place I can't normally paint the model in shaders: