Hello, I am having some difficulties to get normal of face out correctly.
I select face and calculate it normal using function:
Here is picture where normals are displayed
Analysis situs seems to calculate normals right way, but I can't find function that calculates normals from source code.
Any idea how to fix this or better way to calculate normal?
STEP file of model included, if it is helpful model is assembly that is created and STEP exported from SolidWorks
-TLohi
I select face and calculate it normal using function:
Code:
inline void getPlaneNormal(const TopoDS_Face fc, gp_Dir &face_normal, gp_Pnt &pntCenter)
{
if (fc.IsNull()) return false;
BRepAdaptor_Surface surf(fc);
ShapeAnalysis_Surface sas(surf.Surface().Surface());
GProp_GProps props = GProp_GProps();
BRepGProp::LinearProperties(fc,props);
pntCenter = props.CentreOfMass();
gp_Pnt2d uv = sas.ValueOfUV(pntCenter, 0.1).Coord();
GeomLProp_SLProps curvature(surf.Surface().Surface(), uv.X(), uv.Y(), 1, 1e-6);
face_normal = curvature.Normal();
}
Analysis situs seems to calculate normals right way, but I can't find function that calculates normals from source code.
Any idea how to fix this or better way to calculate normal?
STEP file of model included, if it is helpful model is assembly that is created and STEP exported from SolidWorks
-TLohi