Thu, 02/01/2024 - 23:31
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...
}
}
Fri, 02/02/2024 - 00:07
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.
Fri, 02/02/2024 - 01:42
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.
Fri, 02/02/2024 - 10:48
Thanks for reply!
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: