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;
|
||||
|
||||
@@ -228,6 +228,8 @@ public:
|
||||
bool findPlane(gp_Pln &pln, double tol=-1) const;
|
||||
/// Returns true if the expansion of the shape is infinite, false otherwise
|
||||
bool isInfinite() const;
|
||||
/// Checks whether the shape is a planar face
|
||||
bool isPlanar(double tol = 1.0e-7) const;
|
||||
//@}
|
||||
|
||||
/** @name Boolean operation*/
|
||||
|
||||
Reference in New Issue
Block a user