Berechnung der Oberfläche von TopoDS_Face in OpenCASCADE
English
Deutsch
Um die Oberfläche eines TopoDS_Face in OpenCASCADE zu berechnen, verwende einfach BRepGProp::SurfaceProperties und rufe .Mass() auf dem resultierenden GProp_GProps-Objekt auf:
surface_area_example.cpp
GProp_GProps gprops;
BRepGProp::SurfaceProperties(face, gprops); // Speichert Ergebnisse in gprops
double area = gprops.Mass();Alternatively, you can use my OCCUtils library which also also providers a lot of other utility functions:
surface_area_header_example.cpp
#include <occutils/Surface.hxx>
using namespace OCCUtils;
double Surface::Area(const TopoDS_Shape& face);Beispiel:
surface_area_usage_example.cpp
#include <occutils/Surface.hxx>
using namespace OCCUtils;
// ...
double area = Surface::Area(myFace);
// ...
Check out similar posts by category:
C/C++, OpenCASCADE
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow