Part: add method TopoShape::isPlanar()
This commit is contained in:
@@ -107,6 +107,7 @@
|
||||
# include <GeomFill_SectionLaw.hxx>
|
||||
# include <GeomFill_Sweep.hxx>
|
||||
# include <GeomLib.hxx>
|
||||
# include <GeomLib_IsPlanarSurface.hxx>
|
||||
# include <gp_Circ.hxx>
|
||||
# include <gp_Pln.hxx>
|
||||
# include <GProp_GProps.hxx>
|
||||
@@ -4189,6 +4190,27 @@ bool TopoShape::isInfinite() const
|
||||
}
|
||||
}
|
||||
|
||||
bool TopoShape::isPlanar(double tol) const
|
||||
{
|
||||
if (_Shape.IsNull() || _Shape.ShapeType() != TopAbs_FACE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BRepAdaptor_Surface adapt(TopoDS::Face(_Shape));
|
||||
if (adapt.GetType() == GeomAbs_Plane) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TopLoc_Location loc;
|
||||
Handle(Geom_Surface) surf = BRep_Tool::Surface(TopoDS::Face(_Shape), loc);
|
||||
if (surf.IsNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GeomLib_IsPlanarSurface check(surf, tol);
|
||||
return check.IsPlanar();
|
||||
}
|
||||
|
||||
bool TopoShape::isCoplanar(const TopoShape &other, double tol) const {
|
||||
if(isNull() || other.isNull())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user