Berechnung der Flächennormale in OpenCASCADE

English Deutsch

OCCUtils stellt ein bequemes Utility zur Berechnung der Normale einer Fläche (dargestellt durch einen GeomAdaptor_Surface) in OpenCASCADE bereit:

surface_normal_example.cpp
#include <occutils/Surface.hxx>

using namespace OCCUtils;

GeomAdaptor_Surface surf = /* ... */;

gp_Ax1 surfaceNormal = Surface::Normal(surf);

// ...oder einfach die Richtung erhalten
gp_Dir surfaceDirection = Surface::NormalDirection(surf);

Diese Funktion berechnet den Normalenvektor an spezifischen U/V-Koordinaten, die standardmäßig (0,0) sind. Du kannst auch benutzerdefinierte U/V-Koordinaten angeben:

surface_normal_example.cpp
gp_Ax1 normal = Surface::Normal(surf, 1.0 /* u */, -4.5 /* v */);

Falls du OCCUtils nicht verwenden kannst und es manuell tun musst, so kannst du es tun:

surface_normal_manual.cpp
#include <GeomLProp_SLProps.hxx>

GeomLProp_SLProps props(surf.Surface(), u, v, 1 /* max 1 derivation */, precision);
gp_Ax1 axis(props.Value(), props.Normal());

props.Value() gibt den Punkt auf der Fläche an den angegebenen U/V-Koordinaten zurück.


Check out similar posts by category: C/C++, OpenCASCADE