mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
@@ -42,50 +42,45 @@
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
// PLANTAGE IsOuterBound, 15-SEP-1998
|
||||
//static Standard_Integer numpb = 0;
|
||||
//=======================================================================
|
||||
//function : AdjustByPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// static Standard_Integer numpb = 0;
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis::AdjustByPeriod(const Standard_Real Val,
|
||||
const Standard_Real ToVal,
|
||||
const Standard_Real Period)
|
||||
const Standard_Real ToVal,
|
||||
const Standard_Real Period)
|
||||
{
|
||||
Standard_Real diff = Val - ToVal;
|
||||
Standard_Real D = Abs ( diff );
|
||||
Standard_Real P = Abs ( Period );
|
||||
if ( D <= 0.5 * P ) return 0.;
|
||||
if ( P < 1e-100 ) return diff;
|
||||
return ( diff >0 ? -P : P ) * floor( D / P + 0.5 );
|
||||
Standard_Real D = Abs(diff);
|
||||
Standard_Real P = Abs(Period);
|
||||
if (D <= 0.5 * P)
|
||||
return 0.;
|
||||
if (P < 1e-100)
|
||||
return diff;
|
||||
return (diff > 0 ? -P : P) * floor(D / P + 0.5);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AdjustToPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis::AdjustToPeriod(const Standard_Real Val,
|
||||
const Standard_Real ValMin,
|
||||
const Standard_Real ValMax)
|
||||
const Standard_Real ValMin,
|
||||
const Standard_Real ValMax)
|
||||
{
|
||||
return AdjustByPeriod ( Val, 0.5 * ( ValMin + ValMax ), ValMax - ValMin );
|
||||
return AdjustByPeriod(Val, 0.5 * (ValMin + ValMax), ValMax - ValMin);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis::FindBounds(const TopoDS_Shape& shape,TopoDS_Vertex& V1,TopoDS_Vertex& V2)
|
||||
void ShapeAnalysis::FindBounds(const TopoDS_Shape& shape, TopoDS_Vertex& V1, TopoDS_Vertex& V2)
|
||||
{
|
||||
V1.Nullify();
|
||||
V2.Nullify();
|
||||
ShapeAnalysis_Edge EA;
|
||||
if (shape.ShapeType() == TopAbs_WIRE) {
|
||||
if (shape.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
TopoDS_Wire W = TopoDS::Wire(shape);
|
||||
//invalid work with reversed wires replaced on TopExp
|
||||
TopExp::Vertices(W,V1,V2);
|
||||
//invalid work with reversed wires
|
||||
// invalid work with reversed wires replaced on TopExp
|
||||
TopExp::Vertices(W, V1, V2);
|
||||
// invalid work with reversed wires
|
||||
/*TopoDS_Iterator iterWire(W);
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if (iterWire.More()) {
|
||||
@@ -95,149 +90,152 @@ Standard_Real ShapeAnalysis::AdjustToPeriod(const Standard_Real Val,
|
||||
V2 = EA.LastVertex (E);
|
||||
}*/
|
||||
}
|
||||
else if (shape.ShapeType() == TopAbs_EDGE) {
|
||||
V1 = EA.FirstVertex (TopoDS::Edge (shape));
|
||||
V2 = EA.LastVertex (TopoDS::Edge (shape));
|
||||
else if (shape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
V1 = EA.FirstVertex(TopoDS::Edge(shape));
|
||||
V2 = EA.LastVertex(TopoDS::Edge(shape));
|
||||
}
|
||||
else if (shape.ShapeType() == TopAbs_VERTEX)
|
||||
V1 = V2 = TopoDS::Vertex (shape);
|
||||
V1 = V2 = TopoDS::Vertex(shape);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : ReverceSeq
|
||||
//purpose : auxiliary
|
||||
//=======================================================================
|
||||
template<class HSequence>
|
||||
static inline void ReverseSeq (HSequence& Seq)
|
||||
template <class HSequence>
|
||||
static inline void ReverseSeq(HSequence& Seq)
|
||||
{
|
||||
Seq.Reverse();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : TotCross2D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis::TotCross2D(const Handle(ShapeExtend_WireData)& sewd,
|
||||
const TopoDS_Face& aFace)
|
||||
const TopoDS_Face& aFace)
|
||||
{
|
||||
Standard_Integer i, nbc = 0;
|
||||
gp_Pnt2d fuv,luv, uv0;
|
||||
Standard_Real totcross=0;
|
||||
for(i=1; i<=sewd->NbEdges(); i++) {
|
||||
TopoDS_Edge edge = sewd->Edge(i);
|
||||
Standard_Real f2d, l2d;
|
||||
Handle(Geom2d_Curve) c2d = BRep_Tool::CurveOnSurface(edge,aFace,f2d,l2d);
|
||||
if ( !c2d.IsNull() ) {
|
||||
gp_Pnt2d fuv, luv, uv0;
|
||||
Standard_Real totcross = 0;
|
||||
for (i = 1; i <= sewd->NbEdges(); i++)
|
||||
{
|
||||
TopoDS_Edge edge = sewd->Edge(i);
|
||||
Standard_Real f2d, l2d;
|
||||
Handle(Geom2d_Curve) c2d = BRep_Tool::CurveOnSurface(edge, aFace, f2d, l2d);
|
||||
if (!c2d.IsNull())
|
||||
{
|
||||
nbc++;
|
||||
TColgp_SequenceOfPnt2d SeqPnt;
|
||||
ShapeAnalysis_Curve::GetSamplePoints (c2d, f2d, l2d, SeqPnt);
|
||||
if( edge.Orientation()==1 )
|
||||
ShapeAnalysis_Curve::GetSamplePoints(c2d, f2d, l2d, SeqPnt);
|
||||
if (edge.Orientation() == 1)
|
||||
ReverseSeq(SeqPnt);
|
||||
if(nbc==1) {
|
||||
fuv=SeqPnt.Value(1);
|
||||
uv0=fuv;
|
||||
if (nbc == 1)
|
||||
{
|
||||
fuv = SeqPnt.Value(1);
|
||||
uv0 = fuv;
|
||||
}
|
||||
Standard_Integer j=1;
|
||||
for( ; j<=SeqPnt.Length(); j++) {
|
||||
Standard_Integer j = 1;
|
||||
for (; j <= SeqPnt.Length(); j++)
|
||||
{
|
||||
luv = SeqPnt.Value(j);
|
||||
totcross += (fuv.X()-luv.X())*(fuv.Y()+luv.Y())/2;
|
||||
fuv=luv;
|
||||
totcross += (fuv.X() - luv.X()) * (fuv.Y() + luv.Y()) / 2;
|
||||
fuv = luv;
|
||||
}
|
||||
}
|
||||
}
|
||||
totcross += (fuv.X()-uv0.X())*(fuv.Y()+uv0.Y())/2;
|
||||
totcross += (fuv.X() - uv0.X()) * (fuv.Y() + uv0.Y()) / 2;
|
||||
return totcross;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ContourArea
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis::ContourArea(const TopoDS_Wire& theWire)
|
||||
//const Handle(ShapeExtend_WireData)& sewd)
|
||||
|
||||
// const Handle(ShapeExtend_WireData)& sewd)
|
||||
|
||||
{
|
||||
Standard_Integer nbc = 0;
|
||||
gp_Pnt fuv,luv, uv0;
|
||||
//Standard_Real totcross=0;
|
||||
gp_XYZ aTotal(0.,0.,0.);
|
||||
TopoDS_Iterator aIte(theWire,Standard_False);
|
||||
//for(i=1; i<=sewd->NbEdges(); i++) {
|
||||
for( ; aIte.More(); aIte.Next()) {
|
||||
TopoDS_Edge edge = TopoDS::Edge(aIte.Value()); //sewd->Edge(i);
|
||||
Standard_Real first, last;
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge,first, last);
|
||||
if ( !c3d.IsNull() ) {
|
||||
|
||||
gp_Pnt fuv, luv, uv0;
|
||||
// Standard_Real totcross=0;
|
||||
gp_XYZ aTotal(0., 0., 0.);
|
||||
TopoDS_Iterator aIte(theWire, Standard_False);
|
||||
// for(i=1; i<=sewd->NbEdges(); i++) {
|
||||
for (; aIte.More(); aIte.Next())
|
||||
{
|
||||
TopoDS_Edge edge = TopoDS::Edge(aIte.Value()); // sewd->Edge(i);
|
||||
Standard_Real first, last;
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge, first, last);
|
||||
if (!c3d.IsNull())
|
||||
{
|
||||
|
||||
TColgp_SequenceOfPnt aSeqPnt;
|
||||
if(!ShapeAnalysis_Curve::GetSamplePoints (c3d, first, last, aSeqPnt))
|
||||
if (!ShapeAnalysis_Curve::GetSamplePoints(c3d, first, last, aSeqPnt))
|
||||
continue;
|
||||
nbc++;
|
||||
if( edge.Orientation()==TopAbs_REVERSED )
|
||||
if (edge.Orientation() == TopAbs_REVERSED)
|
||||
ReverseSeq(aSeqPnt);
|
||||
if(nbc==1) {
|
||||
fuv=aSeqPnt.Value(1);
|
||||
uv0=fuv;
|
||||
if (nbc == 1)
|
||||
{
|
||||
fuv = aSeqPnt.Value(1);
|
||||
uv0 = fuv;
|
||||
}
|
||||
Standard_Integer j=1;
|
||||
for( ; j<=aSeqPnt.Length(); j++) {
|
||||
Standard_Integer j = 1;
|
||||
for (; j <= aSeqPnt.Length(); j++)
|
||||
{
|
||||
luv = aSeqPnt.Value(j);
|
||||
aTotal += luv.XYZ()^ fuv.XYZ();//
|
||||
fuv=luv;
|
||||
aTotal += luv.XYZ() ^ fuv.XYZ(); //
|
||||
fuv = luv;
|
||||
}
|
||||
}
|
||||
}
|
||||
aTotal += uv0.XYZ()^fuv.XYZ();//
|
||||
Standard_Real anArea = aTotal.Modulus()*0.5;
|
||||
aTotal += uv0.XYZ() ^ fuv.XYZ(); //
|
||||
Standard_Real anArea = aTotal.Modulus() * 0.5;
|
||||
return anArea;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsOuterBound
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis::IsOuterBound(const TopoDS_Face& face)
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis::IsOuterBound(const TopoDS_Face& face)
|
||||
{
|
||||
TopoDS_Face F = face;
|
||||
TopoDS_Wire W;
|
||||
F.Orientation(TopAbs_FORWARD);
|
||||
Standard_Integer nbw = 0;
|
||||
for (TopExp_Explorer exp(F,TopAbs_WIRE); exp.More(); exp.Next()) {
|
||||
W = TopoDS::Wire (exp.Current()); nbw ++;
|
||||
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
|
||||
{
|
||||
W = TopoDS::Wire(exp.Current());
|
||||
nbw++;
|
||||
}
|
||||
//skl 08.04.2002
|
||||
if (nbw == 1) {
|
||||
Handle(ShapeExtend_WireData) sewd = new ShapeExtend_WireData(W);
|
||||
Standard_Real totcross = TotCross2D(sewd,F);
|
||||
// skl 08.04.2002
|
||||
if (nbw == 1)
|
||||
{
|
||||
Handle(ShapeExtend_WireData) sewd = new ShapeExtend_WireData(W);
|
||||
Standard_Real totcross = TotCross2D(sewd, F);
|
||||
return (totcross >= 0);
|
||||
}
|
||||
else {
|
||||
BRepAdaptor_Surface Ads ( F, Standard_False );
|
||||
Standard_Real tol = BRep_Tool::Tolerance(F);
|
||||
Standard_Real toluv = Min ( Ads.UResolution(tol), Ads.VResolution(tol) );
|
||||
BRepTopAdaptor_FClass2d fcl (F,toluv);
|
||||
Standard_Boolean rescl = (fcl.PerformInfinitePoint () == TopAbs_OUT);
|
||||
else
|
||||
{
|
||||
BRepAdaptor_Surface Ads(F, Standard_False);
|
||||
Standard_Real tol = BRep_Tool::Tolerance(F);
|
||||
Standard_Real toluv = Min(Ads.UResolution(tol), Ads.VResolution(tol));
|
||||
BRepTopAdaptor_FClass2d fcl(F, toluv);
|
||||
Standard_Boolean rescl = (fcl.PerformInfinitePoint() == TopAbs_OUT);
|
||||
return rescl;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OuterWire
|
||||
//purpose : Returns positively oriented wire in the face.
|
||||
// function : OuterWire
|
||||
// purpose : Returns positively oriented wire in the face.
|
||||
// If there is no one - returns the last wire of the face.
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Wire ShapeAnalysis::OuterWire(const TopoDS_Face& theFace)
|
||||
TopoDS_Wire ShapeAnalysis::OuterWire(const TopoDS_Face& theFace)
|
||||
{
|
||||
TopoDS_Face aF = theFace;
|
||||
aF.Orientation (TopAbs_FORWARD);
|
||||
aF.Orientation(TopAbs_FORWARD);
|
||||
|
||||
TopExp_Explorer anIt (aF, TopAbs_WIRE);
|
||||
TopExp_Explorer anIt(aF, TopAbs_WIRE);
|
||||
while (anIt.More())
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS::Wire (anIt.Value());
|
||||
TopoDS_Wire aWire = TopoDS::Wire(anIt.Value());
|
||||
anIt.Next();
|
||||
|
||||
// if current wire is the last one, return it without analysis
|
||||
@@ -245,41 +243,43 @@ TopoDS_Wire ShapeAnalysis::OuterWire(const TopoDS_Face& theFace)
|
||||
return aWire;
|
||||
|
||||
// Check if the wire has positive area
|
||||
Handle(ShapeExtend_WireData) aSEWD = new ShapeExtend_WireData (aWire);
|
||||
Standard_Real anArea2d = ShapeAnalysis::TotCross2D (aSEWD, aF);
|
||||
Handle(ShapeExtend_WireData) aSEWD = new ShapeExtend_WireData(aWire);
|
||||
Standard_Real anArea2d = ShapeAnalysis::TotCross2D(aSEWD, aF);
|
||||
if (anArea2d >= 0.)
|
||||
return aWire;
|
||||
}
|
||||
return TopoDS_Wire();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceUVBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis::GetFaceUVBounds (const TopoDS_Face& F,
|
||||
Standard_Real& UMin, Standard_Real& UMax,
|
||||
Standard_Real& VMin, Standard_Real& VMax)
|
||||
void ShapeAnalysis::GetFaceUVBounds(const TopoDS_Face& F,
|
||||
Standard_Real& UMin,
|
||||
Standard_Real& UMax,
|
||||
Standard_Real& VMin,
|
||||
Standard_Real& VMax)
|
||||
{
|
||||
TopoDS_Face FF = F;
|
||||
FF.Orientation(TopAbs_FORWARD);
|
||||
TopExp_Explorer ex(FF,TopAbs_EDGE);
|
||||
if (!ex.More()) {
|
||||
TopExp_Explorer ex(FF, TopAbs_EDGE);
|
||||
if (!ex.More())
|
||||
{
|
||||
TopLoc_Location L;
|
||||
BRep_Tool::Surface(F,L)->Bounds(UMin,UMax,VMin,VMax);
|
||||
BRep_Tool::Surface(F, L)->Bounds(UMin, UMax, VMin, VMax);
|
||||
return;
|
||||
}
|
||||
|
||||
Bnd_Box2d B;
|
||||
ShapeAnalysis_Edge sae;
|
||||
|
||||
Bnd_Box2d B;
|
||||
ShapeAnalysis_Edge sae;
|
||||
ShapeAnalysis_Curve sac;
|
||||
for (;ex.More();ex.Next()) {
|
||||
TopoDS_Edge edge = TopoDS::Edge(ex.Current());
|
||||
for (; ex.More(); ex.Next())
|
||||
{
|
||||
TopoDS_Edge edge = TopoDS::Edge(ex.Current());
|
||||
Handle(Geom2d_Curve) c2d;
|
||||
Standard_Real f, l;
|
||||
if ( ! sae.PCurve ( edge, F, c2d, f, l, Standard_False ) ) continue;
|
||||
sac.FillBndBox ( c2d, f, l, 20, Standard_True, B );
|
||||
Standard_Real f, l;
|
||||
if (!sae.PCurve(edge, F, c2d, f, l, Standard_False))
|
||||
continue;
|
||||
sac.FillBndBox(c2d, f, l, 20, Standard_True, B);
|
||||
}
|
||||
B.Get(UMin,VMin,UMax,VMax);
|
||||
B.Get(UMin, VMin, UMax, VMax);
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ class ShapeExtend_WireData;
|
||||
class TopoDS_Shape;
|
||||
class TopoDS_Vertex;
|
||||
|
||||
|
||||
//! This package is intended to analyze geometrical objects
|
||||
//! and topological shapes. Analysis domain includes both
|
||||
//! exploring geometrical and topological properties of
|
||||
@@ -44,39 +43,42 @@ class TopoDS_Vertex;
|
||||
//! checking small faces,
|
||||
//! analyzing shape tolerances,
|
||||
//! analyzing of free bounds of the shape.
|
||||
class ShapeAnalysis
|
||||
class ShapeAnalysis
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Returns positively oriented wire in the face.
|
||||
//! If there is no such wire - returns the last wire of the face.
|
||||
Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& theFace);
|
||||
|
||||
Standard_EXPORT static TopoDS_Wire OuterWire(const TopoDS_Face& theFace);
|
||||
|
||||
//! Returns a total area of 2d wire
|
||||
Standard_EXPORT static Standard_Real TotCross2D (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& aFace);
|
||||
|
||||
Standard_EXPORT static Standard_Real TotCross2D(const Handle(ShapeExtend_WireData)& sewd,
|
||||
const TopoDS_Face& aFace);
|
||||
|
||||
//! Returns a total area of 3d wire
|
||||
Standard_EXPORT static Standard_Real ContourArea (const TopoDS_Wire& theWire);
|
||||
|
||||
Standard_EXPORT static Standard_Real ContourArea(const TopoDS_Wire& theWire);
|
||||
|
||||
//! Returns True if <F> has outer bound.
|
||||
Standard_EXPORT static Standard_Boolean IsOuterBound (const TopoDS_Face& face);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsOuterBound(const TopoDS_Face& face);
|
||||
|
||||
//! Returns a shift required to move point
|
||||
//! <Val> to the range [ToVal-Period/2,ToVal+Period/2].
|
||||
//! This shift will be the divisible by Period.
|
||||
//! Intended for adjusting parameters on periodic surfaces.
|
||||
Standard_EXPORT static Standard_Real AdjustByPeriod (const Standard_Real Val, const Standard_Real ToVal, const Standard_Real Period);
|
||||
|
||||
Standard_EXPORT static Standard_Real AdjustByPeriod(const Standard_Real Val,
|
||||
const Standard_Real ToVal,
|
||||
const Standard_Real Period);
|
||||
|
||||
//! Returns a shift required to move point
|
||||
//! <Val> to the range [ValMin,ValMax].
|
||||
//! This shift will be the divisible by Period
|
||||
//! with Period = ValMax - ValMin.
|
||||
//! Intended for adjusting parameters on periodic surfaces.
|
||||
Standard_EXPORT static Standard_Real AdjustToPeriod (const Standard_Real Val, const Standard_Real ValMin, const Standard_Real ValMax);
|
||||
|
||||
Standard_EXPORT static Standard_Real AdjustToPeriod(const Standard_Real Val,
|
||||
const Standard_Real ValMin,
|
||||
const Standard_Real ValMax);
|
||||
|
||||
//! Finds the start and end vertices of the shape
|
||||
//! Shape can be of the following type:
|
||||
//! vertex: V1 and V2 are the same and equal to <shape>,
|
||||
@@ -86,11 +88,16 @@ public:
|
||||
//! of the last edge (also see ShapeAnalysis_Edge).
|
||||
//! If wire contains no edges V1 and V2 are nullified
|
||||
//! If none of the above V1 and V2 are nullified
|
||||
Standard_EXPORT static void FindBounds (const TopoDS_Shape& shape, TopoDS_Vertex& V1, TopoDS_Vertex& V2);
|
||||
|
||||
//! Computes exact UV bounds of all wires on the face
|
||||
Standard_EXPORT static void GetFaceUVBounds (const TopoDS_Face& F, Standard_Real& Umin, Standard_Real& Umax, Standard_Real& Vmin, Standard_Real& Vmax);
|
||||
Standard_EXPORT static void FindBounds(const TopoDS_Shape& shape,
|
||||
TopoDS_Vertex& V1,
|
||||
TopoDS_Vertex& V2);
|
||||
|
||||
//! Computes exact UV bounds of all wires on the face
|
||||
Standard_EXPORT static void GetFaceUVBounds(const TopoDS_Face& F,
|
||||
Standard_Real& Umin,
|
||||
Standard_Real& Umax,
|
||||
Standard_Real& Vmin,
|
||||
Standard_Real& Vmax);
|
||||
};
|
||||
|
||||
#endif // _ShapeAnalysis_HeaderFile
|
||||
|
@@ -24,138 +24,158 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Reject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_BoxBndTreeSelector::
|
||||
Reject (const Bnd_Box& theBnd) const
|
||||
Standard_Boolean ShapeAnalysis_BoxBndTreeSelector::Reject(const Bnd_Box& theBnd) const
|
||||
{
|
||||
Standard_Boolean fch = myFBox.IsOut(theBnd);
|
||||
Standard_Boolean lch = myLBox.IsOut(theBnd);
|
||||
if (fch == Standard_False || lch == Standard_False) return Standard_False;
|
||||
if (fch == Standard_False || lch == Standard_False)
|
||||
return Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Accept
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_BoxBndTreeSelector::
|
||||
Accept (const Standard_Integer& theObj)
|
||||
Standard_Boolean ShapeAnalysis_BoxBndTreeSelector::Accept(const Standard_Integer& theObj)
|
||||
{
|
||||
if (theObj < 1 || theObj > mySeq->Length())
|
||||
throw Standard_NoSuchObject("ShapeAnalysis_BoxBndTreeSelector::Accept : no such object for current index");
|
||||
throw Standard_NoSuchObject(
|
||||
"ShapeAnalysis_BoxBndTreeSelector::Accept : no such object for current index");
|
||||
Standard_Boolean IsAccept = Standard_False;
|
||||
if (myList.Contains(theObj))
|
||||
return Standard_False;
|
||||
|
||||
enum
|
||||
{
|
||||
First = 1,
|
||||
Last = 2
|
||||
Last = 2
|
||||
};
|
||||
|
||||
TopoDS_Wire W = TopoDS::Wire (mySeq->Value (theObj));
|
||||
TopoDS_Vertex V1,V2;
|
||||
ShapeAnalysis::FindBounds (W,V1,V2);
|
||||
if(myShared){
|
||||
if (myLVertex.IsSame(V1)){
|
||||
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE1);
|
||||
IsAccept = Standard_True;
|
||||
|
||||
TopoDS_Wire W = TopoDS::Wire(mySeq->Value(theObj));
|
||||
TopoDS_Vertex V1, V2;
|
||||
ShapeAnalysis::FindBounds(W, V1, V2);
|
||||
if (myShared)
|
||||
{
|
||||
if (myLVertex.IsSame(V1))
|
||||
{
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE1);
|
||||
IsAccept = Standard_True;
|
||||
myArrIndices(Last) = theObj;
|
||||
}
|
||||
else {
|
||||
if (myLVertex.IsSame(V2)){
|
||||
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE2);
|
||||
IsAccept = Standard_True;
|
||||
else
|
||||
{
|
||||
if (myLVertex.IsSame(V2))
|
||||
{
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE2);
|
||||
IsAccept = Standard_True;
|
||||
myArrIndices(Last) = theObj;
|
||||
}
|
||||
else {
|
||||
if (myFVertex.IsSame(V2)){
|
||||
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE3);
|
||||
IsAccept = Standard_True;
|
||||
else
|
||||
{
|
||||
if (myFVertex.IsSame(V2))
|
||||
{
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE3);
|
||||
IsAccept = Standard_True;
|
||||
myArrIndices(First) = theObj;
|
||||
}
|
||||
else {
|
||||
if (myFVertex.IsSame(V1)){
|
||||
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE4);
|
||||
IsAccept = Standard_True;
|
||||
else
|
||||
{
|
||||
if (myFVertex.IsSame(V1))
|
||||
{
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE4);
|
||||
IsAccept = Standard_True;
|
||||
myArrIndices(First) = theObj;
|
||||
}
|
||||
else myStatus = ShapeExtend::EncodeStatus (ShapeExtend_FAIL2);
|
||||
|
||||
|
||||
else
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_FAIL2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsAccept){
|
||||
|
||||
if (IsAccept)
|
||||
{
|
||||
SetNb(theObj);
|
||||
if(myArrIndices(Last))
|
||||
if (myArrIndices(Last))
|
||||
myStop = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
else myStop = Standard_False;
|
||||
else
|
||||
myStop = Standard_False;
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
else
|
||||
{
|
||||
gp_Pnt p1 = BRep_Tool::Pnt(V1);
|
||||
gp_Pnt p2 = BRep_Tool::Pnt(V2);
|
||||
|
||||
|
||||
Standard_Real tailhead, tailtail, headhead, headtail;
|
||||
tailhead = p1.Distance(myLPnt);
|
||||
tailtail = p2.Distance(myLPnt);
|
||||
headhead = p1.Distance(myFPnt);
|
||||
headtail = p2.Distance(myFPnt);
|
||||
Standard_Real dm1 = tailhead, dm2 = headtail;
|
||||
tailhead = p1.Distance(myLPnt);
|
||||
tailtail = p2.Distance(myLPnt);
|
||||
headhead = p1.Distance(myFPnt);
|
||||
headtail = p2.Distance(myFPnt);
|
||||
Standard_Real dm1 = tailhead, dm2 = headtail;
|
||||
Standard_Integer res1 = 0, res2 = 0;
|
||||
if (tailhead > tailtail) {res1 = 1; dm1 = tailtail;}
|
||||
if (headtail > headhead) {res2 = 1; dm2 = headhead;}
|
||||
if (tailhead > tailtail)
|
||||
{
|
||||
res1 = 1;
|
||||
dm1 = tailtail;
|
||||
}
|
||||
if (headtail > headhead)
|
||||
{
|
||||
res2 = 1;
|
||||
dm2 = headhead;
|
||||
}
|
||||
Standard_Integer result = res1;
|
||||
Standard_Real min3d;
|
||||
min3d = Min (dm1, dm2);
|
||||
Standard_Real min3d;
|
||||
min3d = Min(dm1, dm2);
|
||||
if (min3d > myMin3d)
|
||||
return Standard_False;
|
||||
|
||||
Standard_Integer minInd = (dm1 > dm2 ? First : Last );
|
||||
Standard_Integer minInd = (dm1 > dm2 ? First : Last);
|
||||
Standard_Integer maxInd = (dm1 > dm2 ? Last : First);
|
||||
myArrIndices(minInd) = theObj;
|
||||
if((min3d - myMin3d) > RealSmall())
|
||||
myArrIndices(minInd) = theObj;
|
||||
if ((min3d - myMin3d) > RealSmall())
|
||||
myArrIndices(maxInd) = 0;
|
||||
|
||||
|
||||
myMin3d = min3d;
|
||||
if (min3d > myTol)
|
||||
{
|
||||
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_FAIL2);
|
||||
return Standard_False;
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_FAIL2);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer anObj = (myArrIndices(Last) ? myArrIndices(Last) : myArrIndices(First));
|
||||
SetNb(anObj);
|
||||
|
||||
|
||||
if (min3d == 0 && minInd == Last)
|
||||
myStop = Standard_True;
|
||||
|
||||
if (dm1 > dm2)
|
||||
|
||||
if (dm1 > dm2)
|
||||
{
|
||||
dm1 = dm2;
|
||||
dm1 = dm2;
|
||||
result = res2 + 2;
|
||||
}
|
||||
if(anObj == theObj)
|
||||
if (anObj == theObj)
|
||||
{
|
||||
switch (result) {
|
||||
case 0: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE1); break;
|
||||
case 1: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE2); break;
|
||||
case 2: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE3); break;
|
||||
case 3: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE4); break;
|
||||
switch (result)
|
||||
{
|
||||
case 0:
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE1);
|
||||
break;
|
||||
case 1:
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE2);
|
||||
break;
|
||||
case 2:
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE3);
|
||||
break;
|
||||
case 3:
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_DONE4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
@@ -28,84 +28,85 @@
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
||||
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> ShapeAnalysis_BoxBndTree;
|
||||
typedef NCollection_UBTree<Standard_Integer, Bnd_Box> ShapeAnalysis_BoxBndTree;
|
||||
|
||||
class ShapeAnalysis_BoxBndTreeSelector
|
||||
: public ShapeAnalysis_BoxBndTree::Selector
|
||||
class ShapeAnalysis_BoxBndTreeSelector : public ShapeAnalysis_BoxBndTree::Selector
|
||||
{
|
||||
public:
|
||||
ShapeAnalysis_BoxBndTreeSelector
|
||||
(Handle (TopTools_HArray1OfShape) theSeq,
|
||||
Standard_Boolean theShared)
|
||||
: mySeq(theSeq), myShared(theShared), myNb(0), myTol(1e-7), myMin3d(1e-7),myArrIndices(1,2),
|
||||
myStatus(ShapeExtend::EncodeStatus (ShapeExtend_OK))
|
||||
{
|
||||
myArrIndices.Init(0);
|
||||
}
|
||||
|
||||
void DefineBoxes (const Bnd_Box& theFBox, const Bnd_Box& theLBox)
|
||||
{ myFBox = theFBox;
|
||||
myLBox = theLBox;
|
||||
myArrIndices.Init(0);
|
||||
|
||||
public:
|
||||
ShapeAnalysis_BoxBndTreeSelector(Handle(TopTools_HArray1OfShape) theSeq,
|
||||
Standard_Boolean theShared)
|
||||
: mySeq(theSeq),
|
||||
myShared(theShared),
|
||||
myNb(0),
|
||||
myTol(1e-7),
|
||||
myMin3d(1e-7),
|
||||
myArrIndices(1, 2),
|
||||
myStatus(ShapeExtend::EncodeStatus(ShapeExtend_OK))
|
||||
{
|
||||
myArrIndices.Init(0);
|
||||
}
|
||||
|
||||
void DefineVertexes (TopoDS_Vertex theVf, TopoDS_Vertex theVl)
|
||||
{ myFVertex = theVf;
|
||||
myLVertex = theVl;
|
||||
myStatus=ShapeExtend::EncodeStatus (ShapeExtend_OK);
|
||||
}
|
||||
|
||||
void DefinePnt (const gp_Pnt& theFPnt, const gp_Pnt& theLPnt)
|
||||
{ myFPnt = theFPnt;
|
||||
myLPnt = theLPnt;
|
||||
myStatus =ShapeExtend::EncodeStatus (ShapeExtend_OK);
|
||||
}
|
||||
|
||||
Standard_Integer GetNb ()
|
||||
{ return myNb; }
|
||||
|
||||
void SetNb (Standard_Integer theNb)
|
||||
{ myNb = theNb; }
|
||||
|
||||
void LoadList(Standard_Integer elem)
|
||||
{ myList.Add(elem); }
|
||||
|
||||
void SetStop ()
|
||||
{ myStop = Standard_False; }
|
||||
|
||||
void SetTolerance (Standard_Real theTol)
|
||||
{
|
||||
myTol = theTol;
|
||||
myMin3d = theTol;
|
||||
myStatus=ShapeExtend::EncodeStatus (ShapeExtend_OK);
|
||||
}
|
||||
void DefineBoxes(const Bnd_Box& theFBox, const Bnd_Box& theLBox)
|
||||
{
|
||||
myFBox = theFBox;
|
||||
myLBox = theLBox;
|
||||
myArrIndices.Init(0);
|
||||
}
|
||||
|
||||
Standard_Boolean ContWire(Standard_Integer nbWire)
|
||||
{ return myList.Contains(nbWire); }
|
||||
|
||||
inline Standard_Boolean LastCheckStatus (const ShapeExtend_Status theStatus) const
|
||||
{ return ShapeExtend::DecodeStatus ( myStatus, theStatus ); }
|
||||
|
||||
Standard_Boolean Reject (const Bnd_Box& theBnd) const;
|
||||
Standard_Boolean Accept (const Standard_Integer &);
|
||||
|
||||
private:
|
||||
Bnd_Box myFBox;
|
||||
Bnd_Box myLBox;
|
||||
Handle (TopTools_HArray1OfShape) mySeq;
|
||||
Standard_Boolean myShared;
|
||||
Standard_Integer myNb;
|
||||
TopoDS_Vertex myFVertex;
|
||||
TopoDS_Vertex myLVertex;
|
||||
gp_Pnt myFPnt;
|
||||
gp_Pnt myLPnt;
|
||||
TColStd_MapOfInteger myList;
|
||||
Standard_Real myTol;
|
||||
Standard_Real myMin3d;
|
||||
TColStd_Array1OfInteger myArrIndices;
|
||||
Standard_Integer myStatus;
|
||||
void DefineVertexes(TopoDS_Vertex theVf, TopoDS_Vertex theVl)
|
||||
{
|
||||
myFVertex = theVf;
|
||||
myLVertex = theVl;
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_OK);
|
||||
}
|
||||
|
||||
void DefinePnt(const gp_Pnt& theFPnt, const gp_Pnt& theLPnt)
|
||||
{
|
||||
myFPnt = theFPnt;
|
||||
myLPnt = theLPnt;
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_OK);
|
||||
}
|
||||
|
||||
Standard_Integer GetNb() { return myNb; }
|
||||
|
||||
void SetNb(Standard_Integer theNb) { myNb = theNb; }
|
||||
|
||||
void LoadList(Standard_Integer elem) { myList.Add(elem); }
|
||||
|
||||
void SetStop() { myStop = Standard_False; }
|
||||
|
||||
void SetTolerance(Standard_Real theTol)
|
||||
{
|
||||
myTol = theTol;
|
||||
myMin3d = theTol;
|
||||
myStatus = ShapeExtend::EncodeStatus(ShapeExtend_OK);
|
||||
}
|
||||
|
||||
Standard_Boolean ContWire(Standard_Integer nbWire) { return myList.Contains(nbWire); }
|
||||
|
||||
inline Standard_Boolean LastCheckStatus(const ShapeExtend_Status theStatus) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatus, theStatus);
|
||||
}
|
||||
|
||||
Standard_Boolean Reject(const Bnd_Box& theBnd) const;
|
||||
Standard_Boolean Accept(const Standard_Integer&);
|
||||
|
||||
private:
|
||||
Bnd_Box myFBox;
|
||||
Bnd_Box myLBox;
|
||||
Handle(TopTools_HArray1OfShape) mySeq;
|
||||
Standard_Boolean myShared;
|
||||
Standard_Integer myNb;
|
||||
TopoDS_Vertex myFVertex;
|
||||
TopoDS_Vertex myLVertex;
|
||||
gp_Pnt myFPnt;
|
||||
gp_Pnt myLPnt;
|
||||
TColStd_MapOfInteger myList;
|
||||
Standard_Real myTol;
|
||||
Standard_Real myMin3d;
|
||||
TColStd_Array1OfInteger myArrIndices;
|
||||
Standard_Integer myStatus;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -44,126 +44,133 @@ class Geom_Surface;
|
||||
//! This class provides operators for analysis surfaces and curves of shapes
|
||||
//! in order to find out more simple geometry entities, which could replace
|
||||
//! existing complex (for example, BSpline) geometry objects with given tolerance.
|
||||
class ShapeAnalysis_CanonicalRecognition
|
||||
class ShapeAnalysis_CanonicalRecognition
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_CanonicalRecognition();
|
||||
|
||||
|
||||
//! constructor with shape initialisation
|
||||
Standard_EXPORT ShapeAnalysis_CanonicalRecognition(const TopoDS_Shape& theShape);
|
||||
|
||||
//! Sets shape
|
||||
Standard_EXPORT void SetShape(const TopoDS_Shape& theShape);
|
||||
|
||||
|
||||
//! Returns input shape
|
||||
const TopoDS_Shape& GetShape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
const TopoDS_Shape& GetShape() const { return myShape; }
|
||||
|
||||
//! Returns deviation between input geometry entity and analytical entity
|
||||
Standard_Real GetGap() const
|
||||
{
|
||||
return myGap;
|
||||
}
|
||||
Standard_Real GetGap() const { return myGap; }
|
||||
|
||||
//! Returns status of operation.
|
||||
//! Current meaning of possible values of status:
|
||||
//! -1 - algorithm is not initalazed by shape
|
||||
//! 0 - no errors
|
||||
//! 1 - error during any operation (usually - because of wrong input data)
|
||||
//! Any operation (calling any methods like IsPlane(...), ...) can be performed
|
||||
//! when current staue is equal 0.
|
||||
//! Any operation (calling any methods like IsPlane(...), ...) can be performed
|
||||
//! when current staue is equal 0.
|
||||
//! If after any operation status != 0, it is necessary to set it 0 by method ClearStatus()
|
||||
//! before calling other operation.
|
||||
Standard_Integer GetStatus() const
|
||||
{
|
||||
return myStatus;
|
||||
}
|
||||
Standard_Integer GetStatus() const { return myStatus; }
|
||||
|
||||
//! Returns status to be equal 0.
|
||||
void ClearStatus()
|
||||
{
|
||||
myStatus = 0;
|
||||
}
|
||||
void ClearStatus() { myStatus = 0; }
|
||||
|
||||
//! Returns true if the underlined surface can be represent by plane with tolerance theTol
|
||||
//! and sets in thePln the result plane.
|
||||
//! and sets in thePln the result plane.
|
||||
Standard_EXPORT Standard_Boolean IsPlane(const Standard_Real theTol, gp_Pln& thePln);
|
||||
|
||||
//! Returns true if the underlined surface can be represent by cylindrical one with tolerance theTol
|
||||
//! and sets in theCyl the result cylinrical surface.
|
||||
//! Returns true if the underlined surface can be represent by cylindrical one with tolerance
|
||||
//! theTol and sets in theCyl the result cylinrical surface.
|
||||
Standard_EXPORT Standard_Boolean IsCylinder(const Standard_Real theTol, gp_Cylinder& theCyl);
|
||||
|
||||
//! Returns true if the underlined surface can be represent by conical one with tolerance theTol
|
||||
//! and sets in theCone the result conical surface.
|
||||
//! and sets in theCone the result conical surface.
|
||||
Standard_EXPORT Standard_Boolean IsCone(const Standard_Real theTol, gp_Cone& theCone);
|
||||
|
||||
//! Returns true if the underlined surface can be represent by spherical one with tolerance theTol
|
||||
//! and sets in theSphere the result spherical surface.
|
||||
//! and sets in theSphere the result spherical surface.
|
||||
Standard_EXPORT Standard_Boolean IsSphere(const Standard_Real theTol, gp_Sphere& theSphere);
|
||||
|
||||
//! Returns true if the underlined curve can be represent by line with tolerance theTol
|
||||
//! and sets in theLin the result line.
|
||||
//! and sets in theLin the result line.
|
||||
Standard_EXPORT Standard_Boolean IsLine(const Standard_Real theTol, gp_Lin& theLin);
|
||||
|
||||
//! Returns true if the underlined curve can be represent by circle with tolerance theTol
|
||||
//! and sets in theCirc the result circle.
|
||||
//! and sets in theCirc the result circle.
|
||||
Standard_EXPORT Standard_Boolean IsCircle(const Standard_Real theTol, gp_Circ& theCirc);
|
||||
|
||||
//! Returns true if the underlined curve can be represent by ellipse with tolerance theTol
|
||||
//! and sets in theCirc the result ellipse.
|
||||
//! and sets in theCirc the result ellipse.
|
||||
Standard_EXPORT Standard_Boolean IsEllipse(const Standard_Real theTol, gp_Elips& theElips);
|
||||
|
||||
|
||||
private:
|
||||
Standard_Boolean IsElementarySurf(const GeomAbs_SurfaceType theTarget, const Standard_Real theTol,
|
||||
gp_Ax3& thePos, TColStd_Array1OfReal& theParams);
|
||||
Standard_Boolean IsElementarySurf(const GeomAbs_SurfaceType theTarget,
|
||||
const Standard_Real theTol,
|
||||
gp_Ax3& thePos,
|
||||
TColStd_Array1OfReal& theParams);
|
||||
|
||||
Standard_Boolean IsConic(const GeomAbs_CurveType theTarget, const Standard_Real theTol,
|
||||
gp_Ax2& thePos, TColStd_Array1OfReal& theParams);
|
||||
Standard_Boolean IsConic(const GeomAbs_CurveType theTarget,
|
||||
const Standard_Real theTol,
|
||||
gp_Ax2& thePos,
|
||||
TColStd_Array1OfReal& theParams);
|
||||
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Face& theFace, const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
|
||||
Standard_Real& theGap, Standard_Integer& theStatus);
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Face& theFace,
|
||||
const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType,
|
||||
const GeomAbs_SurfaceType theTarget,
|
||||
Standard_Real& theGap,
|
||||
Standard_Integer& theStatus);
|
||||
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Shell& theShell, const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
|
||||
Standard_Real& theGap, Standard_Integer& theStatus);
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Shell& theShell,
|
||||
const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType,
|
||||
const GeomAbs_SurfaceType theTarget,
|
||||
Standard_Real& theGap,
|
||||
Standard_Integer& theStatus);
|
||||
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Edge& theEdge, const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
|
||||
gp_Ax3& thePos, TColStd_Array1OfReal& theParams,
|
||||
Standard_Real& theGap, Standard_Integer& theStatus);
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Edge& theEdge,
|
||||
const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType,
|
||||
const GeomAbs_SurfaceType theTarget,
|
||||
gp_Ax3& thePos,
|
||||
TColStd_Array1OfReal& theParams,
|
||||
Standard_Real& theGap,
|
||||
Standard_Integer& theStatus);
|
||||
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Wire& theWire, const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType, const GeomAbs_SurfaceType theTarget,
|
||||
gp_Ax3& thePos, TColStd_Array1OfReal& theParams,
|
||||
Standard_Real& theGap, Standard_Integer& theStatus);
|
||||
static Handle(Geom_Surface) GetSurface(const TopoDS_Wire& theWire,
|
||||
const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType,
|
||||
const GeomAbs_SurfaceType theTarget,
|
||||
gp_Ax3& thePos,
|
||||
TColStd_Array1OfReal& theParams,
|
||||
Standard_Real& theGap,
|
||||
Standard_Integer& theStatus);
|
||||
|
||||
static Handle(Geom_Curve) GetCurve(const TopoDS_Edge& theEdge, const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType, const GeomAbs_CurveType theTarget,
|
||||
Standard_Real& theGap, Standard_Integer& theStatus);
|
||||
static Handle(Geom_Curve) GetCurve(const TopoDS_Edge& theEdge,
|
||||
const Standard_Real theTol,
|
||||
const GeomConvert_ConvType theType,
|
||||
const GeomAbs_CurveType theTarget,
|
||||
Standard_Real& theGap,
|
||||
Standard_Integer& theStatus);
|
||||
|
||||
static Standard_Boolean GetSurfaceByLS(const TopoDS_Wire& theWire, const Standard_Real theTol,
|
||||
const GeomAbs_SurfaceType theTarget,
|
||||
gp_Ax3& thePos, TColStd_Array1OfReal& theParams,
|
||||
Standard_Real& theGap, Standard_Integer& theStatus);
|
||||
static Standard_Boolean GetSurfaceByLS(const TopoDS_Wire& theWire,
|
||||
const Standard_Real theTol,
|
||||
const GeomAbs_SurfaceType theTarget,
|
||||
gp_Ax3& thePos,
|
||||
TColStd_Array1OfReal& theParams,
|
||||
Standard_Real& theGap,
|
||||
Standard_Integer& theStatus);
|
||||
|
||||
void Init(const TopoDS_Shape& theShape);
|
||||
|
||||
private:
|
||||
|
||||
TopoDS_Shape myShape;
|
||||
TopoDS_Shape myShape;
|
||||
TopAbs_ShapeEnum mySType;
|
||||
Standard_Real myGap;
|
||||
Standard_Real myGap;
|
||||
Standard_Integer myStatus;
|
||||
|
||||
};
|
||||
|
||||
#endif // _ShapeAnalysis_CanonicalRecognition_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -37,13 +37,11 @@ class TopoDS_Compound;
|
||||
#endif
|
||||
|
||||
//! Analysis of the face size
|
||||
class ShapeAnalysis_CheckSmallFace
|
||||
class ShapeAnalysis_CheckSmallFace
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates an empty tool
|
||||
//! Checks a Shape i.e. each of its faces, records checks as
|
||||
//! diagnostics in the <infos>
|
||||
@@ -56,7 +54,7 @@ public:
|
||||
//! Enchains various checks on a face
|
||||
//! inshell : to compute more information, relevant to topology
|
||||
Standard_EXPORT ShapeAnalysis_CheckSmallFace();
|
||||
|
||||
|
||||
//! Checks if a Face is as a Spot
|
||||
//! Returns 0 if not, 1 if yes, 2 if yes and all vertices are the
|
||||
//! same
|
||||
@@ -65,37 +63,52 @@ public:
|
||||
//! If a Face is a Spot, its location is returned in <spot>, and
|
||||
//! <spotol> returns an equivalent tolerance, which is computed as
|
||||
//! half of max dimension of min-max box of the face
|
||||
Standard_EXPORT Standard_Integer IsSpotFace (const TopoDS_Face& F, gp_Pnt& spot, Standard_Real& spotol, const Standard_Real tol = -1.0) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer IsSpotFace(const TopoDS_Face& F,
|
||||
gp_Pnt& spot,
|
||||
Standard_Real& spotol,
|
||||
const Standard_Real tol = -1.0) const;
|
||||
|
||||
//! Acts as IsSpotFace, but records in <infos> a diagnostic
|
||||
//! "SpotFace" with the Pnt as value (data "Location")
|
||||
Standard_EXPORT Standard_Boolean CheckSpotFace (const TopoDS_Face& F, const Standard_Real tol = -1.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSpotFace(const TopoDS_Face& F,
|
||||
const Standard_Real tol = -1.0);
|
||||
|
||||
//! Checks if a Face lies on a Surface which is a strip
|
||||
//! So the Face is a strip. But a Face may be a strip elsewhere ..
|
||||
//!
|
||||
//! A given value <tol> may be given to check max width
|
||||
//! By default, considers the tolerance zone of its edges
|
||||
//! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
|
||||
Standard_EXPORT Standard_Boolean IsStripSupport (const TopoDS_Face& F, const Standard_Real tol = -1.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsStripSupport(const TopoDS_Face& F,
|
||||
const Standard_Real tol = -1.0);
|
||||
|
||||
//! Checks if two edges define a strip, i.e. distance maxi below
|
||||
//! tolerance, given or some of those of E1 and E2
|
||||
Standard_EXPORT Standard_Boolean CheckStripEdges (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckStripEdges(const TopoDS_Edge& E1,
|
||||
const TopoDS_Edge& E2,
|
||||
const Standard_Real tol,
|
||||
Standard_Real& dmax) const;
|
||||
|
||||
//! Searches for two and only two edges up tolerance
|
||||
//! Returns True if OK, false if not 2 edges
|
||||
//! If True, returns the two edges and their maximum distance
|
||||
Standard_EXPORT Standard_Boolean FindStripEdges (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax);
|
||||
|
||||
Standard_EXPORT Standard_Boolean FindStripEdges(const TopoDS_Face& F,
|
||||
TopoDS_Edge& E1,
|
||||
TopoDS_Edge& E2,
|
||||
const Standard_Real tol,
|
||||
Standard_Real& dmax);
|
||||
|
||||
//! Checks if a Face is a single strip, i.e. brings two great
|
||||
//! edges which are confused on their whole length, possible other
|
||||
//! edges are small or null length
|
||||
//!
|
||||
//! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
|
||||
//! Records diagnostic in info if it is a single strip
|
||||
Standard_EXPORT Standard_Boolean CheckSingleStrip (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSingleStrip(const TopoDS_Face& F,
|
||||
TopoDS_Edge& E1,
|
||||
TopoDS_Edge& E2,
|
||||
const Standard_Real tol = -1.0);
|
||||
|
||||
//! Checks if a Face is as a Strip
|
||||
//! Returns 0 if not or non determined, 1 if in U, 2 if in V
|
||||
//! By default, considers the tolerance zone of its edges
|
||||
@@ -105,16 +118,23 @@ public:
|
||||
//! lists of edges. These lists are recorded in diagnostic
|
||||
//! Diagnostic "StripFace" brings data "Direction" (U or V),
|
||||
//! "List1" , "List2" (if they could be computed)
|
||||
Standard_EXPORT Standard_Boolean CheckStripFace (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckStripFace(const TopoDS_Face& F,
|
||||
TopoDS_Edge& E1,
|
||||
TopoDS_Edge& E2,
|
||||
const Standard_Real tol = -1.0);
|
||||
|
||||
//! Checks if a Face brings vertices which split it, either
|
||||
//! confused with non adjacent vertices, or confused with their
|
||||
//! projection on non adjacent edges
|
||||
//! Returns the count of found splitting vertices
|
||||
//! Each vertex then brings a diagnostic "SplittingVertex",
|
||||
//! with data : "Face" for the face, "Edge" for the split edge
|
||||
Standard_EXPORT Standard_Integer CheckSplittingVertices (const TopoDS_Face& F, TopTools_DataMapOfShapeListOfShape& MapEdges, ShapeAnalysis_DataMapOfShapeListOfReal& MapParam, TopoDS_Compound& theAllVert);
|
||||
|
||||
Standard_EXPORT Standard_Integer
|
||||
CheckSplittingVertices(const TopoDS_Face& F,
|
||||
TopTools_DataMapOfShapeListOfShape& MapEdges,
|
||||
ShapeAnalysis_DataMapOfShapeListOfReal& MapParam,
|
||||
TopoDS_Compound& theAllVert);
|
||||
|
||||
//! Checks if a Face has a pin, which can be edited
|
||||
//! No singularity : no pin, returns 0
|
||||
//! If there is a pin, checked topics, with returned value :
|
||||
@@ -124,16 +144,26 @@ public:
|
||||
//! - 2 : stretched pin, i.e. is possible to relimit the face by
|
||||
//! another vertex, so that this vertex still gives a pin
|
||||
//! -> diagnostic "StretchedPin" with location of vertex (Pnt)
|
||||
Standard_EXPORT Standard_Boolean CheckPin (const TopoDS_Face& F, Standard_Integer& whatrow, Standard_Integer& sence);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckPin(const TopoDS_Face& F,
|
||||
Standard_Integer& whatrow,
|
||||
Standard_Integer& sence);
|
||||
|
||||
//! Checks if a Face is twisted (apart from checking Pin, i.e. it
|
||||
//! does not give information on pin, only "it is twisted")
|
||||
Standard_EXPORT Standard_Boolean CheckTwisted (const TopoDS_Face& F, Standard_Real& paramu, Standard_Real& paramv);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckPinFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& mapEdges, const Standard_Real toler = -1.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckPinEdges (const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge, const Standard_Real coef1, const Standard_Real coef2, const Standard_Real toler) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckTwisted(const TopoDS_Face& F,
|
||||
Standard_Real& paramu,
|
||||
Standard_Real& paramv);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckPinFace(const TopoDS_Face& F,
|
||||
TopTools_DataMapOfShapeShape& mapEdges,
|
||||
const Standard_Real toler = -1.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckPinEdges(const TopoDS_Edge& theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge,
|
||||
const Standard_Real coef1,
|
||||
const Standard_Real coef2,
|
||||
const Standard_Real toler) const;
|
||||
|
||||
//! Returns the status of last call to Perform()
|
||||
//! ShapeExtend_OK : face was OK, nothing done
|
||||
//! ShapeExtend_DONE1: some wires are fixed
|
||||
@@ -145,8 +175,8 @@ public:
|
||||
//! ShapeExtend_FAIL2: cannot fix orientation of wires
|
||||
//! ShapeExtend_FAIL3: cannot add missing seam
|
||||
//! ShapeExtend_FAIL4: cannot remove small area wire
|
||||
Standard_Boolean Status (const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean Status(const ShapeExtend_Status status) const;
|
||||
|
||||
//! Sets a fixed Tolerance to check small face
|
||||
//! By default, local tolerance zone is considered
|
||||
//! Sets a fixed MaxTolerance to check small face
|
||||
@@ -154,40 +184,29 @@ public:
|
||||
//! By default, local tolerance zone is considered
|
||||
//! Unset fixed tolerance, comes back to local tolerance zones
|
||||
//! Unset fixed tolerance, comes back to local tolerance zones
|
||||
void SetTolerance (const Standard_Real tol);
|
||||
|
||||
void SetTolerance(const Standard_Real tol);
|
||||
|
||||
//! Returns the tolerance to check small faces, negative value if
|
||||
//! local tolerances zones are to be considered
|
||||
Standard_Real Tolerance() const;
|
||||
|
||||
Standard_Boolean StatusSpot (const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusStrip (const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusPin (const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusTwisted (const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusSplitVert (const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusPinFace (const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusPinEdges (const ShapeExtend_Status status) const;
|
||||
Standard_Real Tolerance() const;
|
||||
|
||||
Standard_Boolean StatusSpot(const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusStrip(const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusPin(const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusTwisted(const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusSplitVert(const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusPinFace(const ShapeExtend_Status status) const;
|
||||
|
||||
Standard_Boolean StatusPinEdges(const ShapeExtend_Status status) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TopoDS_Shape myComp;
|
||||
TopoDS_Shape myComp;
|
||||
Standard_Integer myStatus;
|
||||
Standard_Integer myStatusSpot;
|
||||
Standard_Integer myStatusStrip;
|
||||
@@ -196,16 +215,9 @@ private:
|
||||
Standard_Integer myStatusSplitVert;
|
||||
Standard_Integer myStatusPinFace;
|
||||
Standard_Integer myStatusPinEdges;
|
||||
Standard_Real myPrecision;
|
||||
|
||||
|
||||
Standard_Real myPrecision;
|
||||
};
|
||||
|
||||
|
||||
#include <ShapeAnalysis_CheckSmallFace.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_CheckSmallFace_HeaderFile
|
||||
|
@@ -12,63 +12,60 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <ShapeExtend.hxx>
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::Status(const ShapeExtend_Status status) const
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::Status(const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatus, status );
|
||||
return ShapeExtend::DecodeStatus(myStatus, status);
|
||||
}
|
||||
|
||||
|
||||
inline void ShapeAnalysis_CheckSmallFace::SetTolerance(const Standard_Real tol)
|
||||
inline void ShapeAnalysis_CheckSmallFace::SetTolerance(const Standard_Real tol)
|
||||
{
|
||||
myPrecision = tol;
|
||||
|
||||
myPrecision = tol;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real ShapeAnalysis_CheckSmallFace::Tolerance() const
|
||||
inline Standard_Real ShapeAnalysis_CheckSmallFace::Tolerance() const
|
||||
{
|
||||
return myPrecision;
|
||||
return myPrecision;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusSpot(const ShapeExtend_Status status) const
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusSpot(
|
||||
const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusSpot, status );
|
||||
return ShapeExtend::DecodeStatus(myStatusSpot, status);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusStrip(const ShapeExtend_Status status) const
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusStrip(
|
||||
const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusStrip, status );
|
||||
return ShapeExtend::DecodeStatus(myStatusStrip, status);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusPin(const ShapeExtend_Status status) const
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusPin(
|
||||
const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusPin, status );
|
||||
|
||||
return ShapeExtend::DecodeStatus(myStatusPin, status);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusTwisted(const ShapeExtend_Status status) const
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusTwisted(
|
||||
const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusTwisted, status );
|
||||
|
||||
}
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusPinFace(const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusPinFace, status );
|
||||
|
||||
}
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusPinEdges(const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusPinEdges, status );
|
||||
|
||||
}
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusSplitVert(const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusSplitVert, status );
|
||||
|
||||
return ShapeExtend::DecodeStatus(myStatusTwisted, status);
|
||||
}
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusPinFace(
|
||||
const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusPinFace, status);
|
||||
}
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusPinEdges(
|
||||
const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusPinEdges, status);
|
||||
}
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_CheckSmallFace::StatusSplitVert(
|
||||
const ShapeExtend_Status status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusSplitVert, status);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -32,16 +32,13 @@ class Geom2d_Curve;
|
||||
class Bnd_Box2d;
|
||||
class gp_XYZ;
|
||||
|
||||
|
||||
//! Analyzing tool for 2d or 3d curve.
|
||||
//! Computes parameters of projected point onto a curve.
|
||||
class ShapeAnalysis_Curve
|
||||
class ShapeAnalysis_Curve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Projects a Point on a Curve.
|
||||
//! Computes the projected point and its parameter on the curve.
|
||||
//! <preci> is used as 3d precision (hence, 0 will produce
|
||||
@@ -52,8 +49,13 @@ public:
|
||||
//!
|
||||
//! Returned value is the distance between the given point and
|
||||
//! computed one.
|
||||
Standard_EXPORT Standard_Real Project (const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Real Project(const Handle(Geom_Curve)& C3D,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt& proj,
|
||||
Standard_Real& param,
|
||||
const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
//! Projects a Point on a Curve.
|
||||
//! Computes the projected point and its parameter on the curve.
|
||||
//! <preci> is used as 3d precision (hence, 0 will produce
|
||||
@@ -62,30 +64,60 @@ public:
|
||||
//!
|
||||
//! Returned value is the distance between the given point and
|
||||
//! computed one.
|
||||
Standard_EXPORT Standard_Real Project (const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Real Project(const Adaptor3d_Curve& C3D,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt& proj,
|
||||
Standard_Real& param,
|
||||
const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
//! Projects a Point on a Curve, but parameters are limited
|
||||
//! between <cf> and <cl>.
|
||||
//! The range [cf, cl] is extended with help of Adaptor3d on the
|
||||
//! basis of 3d precision <preci>.
|
||||
//! If AdjustToEnds is True, point will be adjusted to the end
|
||||
//! of the curve if distance is less than <preci>
|
||||
Standard_EXPORT Standard_Real Project (const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Real cf, const Standard_Real cl, const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Real ProjectAct (const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param) const;
|
||||
|
||||
Standard_EXPORT Standard_Real Project(const Handle(Geom_Curve)& C3D,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt& proj,
|
||||
Standard_Real& param,
|
||||
const Standard_Real cf,
|
||||
const Standard_Real cl,
|
||||
const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Real ProjectAct(const Adaptor3d_Curve& C3D,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt& proj,
|
||||
Standard_Real& param) const;
|
||||
|
||||
//! Projects a Point on a Curve using Newton method.
|
||||
//! <paramPrev> is taken as the first approximation of solution.
|
||||
//! If Newton algorithm fails the method Project() is used.
|
||||
//! If AdjustToEnds is True, point will be adjusted to the end
|
||||
//! of the curve if distance is less than <preci>
|
||||
Standard_EXPORT Standard_Real NextProject (const Standard_Real paramPrev, const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Real cf, const Standard_Real cl, const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Real
|
||||
NextProject(const Standard_Real paramPrev,
|
||||
const Handle(Geom_Curve)& C3D,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt& proj,
|
||||
Standard_Real& param,
|
||||
const Standard_Real cf,
|
||||
const Standard_Real cl,
|
||||
const Standard_Boolean AdjustToEnds = Standard_True) const;
|
||||
|
||||
//! Projects a Point on a Curve using Newton method.
|
||||
//! <paramPrev> is taken as the first approximation of solution.
|
||||
//! If Newton algorithm fails the method Project() is used.
|
||||
Standard_EXPORT Standard_Real NextProject (const Standard_Real paramPrev, const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param) const;
|
||||
|
||||
Standard_EXPORT Standard_Real NextProject(const Standard_Real paramPrev,
|
||||
const Adaptor3d_Curve& C3D,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt& proj,
|
||||
Standard_Real& param) const;
|
||||
|
||||
//! Validate parameters First and Last for the given curve
|
||||
//! in order to make them valid for creation of edge.
|
||||
//! This includes:
|
||||
@@ -95,70 +127,71 @@ public:
|
||||
//! Returns True if parameters are OK or are successfully
|
||||
//! corrected, or False if parameters cannot be corrected.
|
||||
//! In the latter case, parameters are reset to range of curve.
|
||||
Standard_EXPORT Standard_Boolean ValidateRange (const Handle(Geom_Curve)& Crv, Standard_Real& First, Standard_Real& Last, const Standard_Real prec) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean ValidateRange(const Handle(Geom_Curve)& Crv,
|
||||
Standard_Real& First,
|
||||
Standard_Real& Last,
|
||||
const Standard_Real prec) const;
|
||||
|
||||
//! Computes a boundary box on segment of curve C2d from First
|
||||
//! to Last. This is done by taking NPoints points from the
|
||||
//! curve and, if Exact is True, by searching for exact
|
||||
//! extrema. All these points are added to Box.
|
||||
Standard_EXPORT void FillBndBox (const Handle(Geom2d_Curve)& C2d, const Standard_Real First, const Standard_Real Last, const Standard_Integer NPoints, const Standard_Boolean Exact, Bnd_Box2d& Box) const;
|
||||
|
||||
Standard_EXPORT void FillBndBox(const Handle(Geom2d_Curve)& C2d,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Integer NPoints,
|
||||
const Standard_Boolean Exact,
|
||||
Bnd_Box2d& Box) const;
|
||||
|
||||
//! Defines which pcurve (C1 or C2) should be chosen for FORWARD
|
||||
//! seam edge.
|
||||
Standard_EXPORT Standard_Integer SelectForwardSeam (const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer SelectForwardSeam(const Handle(Geom2d_Curve)& C1,
|
||||
const Handle(Geom2d_Curve)& C2) const;
|
||||
|
||||
//! Checks if points are planar with given preci. If Normal has not zero
|
||||
//! modulus, checks with given normal
|
||||
Standard_EXPORT static Standard_Boolean IsPlanar (const TColgp_Array1OfPnt& pnts, gp_XYZ& Normal, const Standard_Real preci = 0);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsPlanar(const TColgp_Array1OfPnt& pnts,
|
||||
gp_XYZ& Normal,
|
||||
const Standard_Real preci = 0);
|
||||
|
||||
//! Checks if curve is planar with given preci. If Normal has not zero
|
||||
//! modulus, checks with given normal
|
||||
Standard_EXPORT static Standard_Boolean IsPlanar (const Handle(Geom_Curve)& curve, gp_XYZ& Normal, const Standard_Real preci = 0);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsPlanar(const Handle(Geom_Curve)& curve,
|
||||
gp_XYZ& Normal,
|
||||
const Standard_Real preci = 0);
|
||||
|
||||
//! Returns sample points which will serve as linearisation
|
||||
//! of the2d curve in range (first, last)
|
||||
//! The distribution of sample points is consystent with
|
||||
//! what is used by BRepTopAdaptor_FClass2d
|
||||
Standard_EXPORT static Standard_Boolean GetSamplePoints (const Handle(Geom2d_Curve)& curve, const Standard_Real first, const Standard_Real last, TColgp_SequenceOfPnt2d& seq);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean GetSamplePoints(const Handle(Geom2d_Curve)& curve,
|
||||
const Standard_Real first,
|
||||
const Standard_Real last,
|
||||
TColgp_SequenceOfPnt2d& seq);
|
||||
|
||||
//! Returns sample points which will serve as linearisation
|
||||
//! of the curve in range (first, last)
|
||||
Standard_EXPORT static Standard_Boolean GetSamplePoints (const Handle(Geom_Curve)& curve, const Standard_Real first, const Standard_Real last, TColgp_SequenceOfPnt& seq);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean GetSamplePoints(const Handle(Geom_Curve)& curve,
|
||||
const Standard_Real first,
|
||||
const Standard_Real last,
|
||||
TColgp_SequenceOfPnt& seq);
|
||||
|
||||
//! Tells if the Curve is closed with given precision.
|
||||
//! If <preci> < 0 then Precision::Confusion is used.
|
||||
Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& curve, const Standard_Real preci = -1);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsClosed(const Handle(Geom_Curve)& curve,
|
||||
const Standard_Real preci = -1);
|
||||
|
||||
//! This method was implemented as fix for changes in trimmed curve
|
||||
//! behaviour. For the moment trimmed curve returns false anyway.
|
||||
//! So it is necessary to adapt all Data exchange tools for this behaviour.
|
||||
//! Current implementation takes into account that curve may be offset.
|
||||
Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom_Curve)& curve);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsPeriodic(const Handle(Geom_Curve)& curve);
|
||||
|
||||
//! The same as for Curve3d.
|
||||
Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom2d_Curve)& curve);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Boolean IsPeriodic(const Handle(Geom2d_Curve)& curve);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_Curve_HeaderFile
|
||||
|
@@ -11,7 +11,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef ShapeAnalysis_DataMapIteratorOfDataMapOfShapeListOfReal_HeaderFile
|
||||
#define ShapeAnalysis_DataMapIteratorOfDataMapOfShapeListOfReal_HeaderFile
|
||||
|
||||
|
@@ -22,8 +22,9 @@
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape,TColStd_ListOfReal,TopTools_ShapeMapHasher> ShapeAnalysis_DataMapOfShapeListOfReal;
|
||||
typedef NCollection_DataMap<TopoDS_Shape,TColStd_ListOfReal,TopTools_ShapeMapHasher>::Iterator ShapeAnalysis_DataMapIteratorOfDataMapOfShapeListOfReal;
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape, TColStd_ListOfReal, TopTools_ShapeMapHasher>
|
||||
ShapeAnalysis_DataMapOfShapeListOfReal;
|
||||
typedef NCollection_DataMap<TopoDS_Shape, TColStd_ListOfReal, TopTools_ShapeMapHasher>::Iterator
|
||||
ShapeAnalysis_DataMapIteratorOfDataMapOfShapeListOfReal;
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -45,72 +45,108 @@ class gp_Pnt;
|
||||
//! vertices).
|
||||
//! Provides methods for analyzing geometry and topology consistency
|
||||
//! (3d and pcurve(s) consistency, their adjacency to the vertices).
|
||||
class ShapeAnalysis_Edge
|
||||
class ShapeAnalysis_Edge
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor; initialises Status to OK
|
||||
Standard_EXPORT ShapeAnalysis_Edge();
|
||||
|
||||
|
||||
//! Tells if the edge has a 3d curve
|
||||
Standard_EXPORT Standard_Boolean HasCurve3d (const TopoDS_Edge& edge) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasCurve3d(const TopoDS_Edge& edge) const;
|
||||
|
||||
//! Returns the 3d curve and bounding parameteres for the edge
|
||||
//! Returns False if no 3d curve.
|
||||
//! If <orient> is True (default), takes orientation into account:
|
||||
//! if the edge is reversed, cf and cl are toggled
|
||||
Standard_EXPORT Standard_Boolean Curve3d (const TopoDS_Edge& edge, Handle(Geom_Curve)& C3d, Standard_Real& cf, Standard_Real& cl, const Standard_Boolean orient = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Curve3d(const TopoDS_Edge& edge,
|
||||
Handle(Geom_Curve)& C3d,
|
||||
Standard_Real& cf,
|
||||
Standard_Real& cl,
|
||||
const Standard_Boolean orient = Standard_True) const;
|
||||
|
||||
//! Gives True if the edge has a 3d curve, this curve is closed,
|
||||
//! and the edge has the same vertex at start and end
|
||||
Standard_EXPORT Standard_Boolean IsClosed3d (const TopoDS_Edge& edge) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsClosed3d(const TopoDS_Edge& edge) const;
|
||||
|
||||
//! Tells if the Edge has a pcurve on the face.
|
||||
Standard_EXPORT Standard_Boolean HasPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasPCurve(const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face) const;
|
||||
|
||||
//! Tells if the edge has a pcurve on the surface (with location).
|
||||
Standard_EXPORT Standard_Boolean HasPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean PCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, Handle(Geom2d_Curve)& C2d, Standard_Real& cf, Standard_Real& cl, const Standard_Boolean orient = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasPCurve(const TopoDS_Edge& edge,
|
||||
const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean PCurve(const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face,
|
||||
Handle(Geom2d_Curve)& C2d,
|
||||
Standard_Real& cf,
|
||||
Standard_Real& cl,
|
||||
const Standard_Boolean orient = Standard_True) const;
|
||||
|
||||
//! Returns the pcurve and bounding parameteres for the edge
|
||||
//! lying on the surface.
|
||||
//! Returns False if the edge has no pcurve on this surface.
|
||||
//! If <orient> is True (default), takes orientation into account:
|
||||
//! if the edge is reversed, cf and cl are toggled
|
||||
Standard_EXPORT Standard_Boolean PCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, Handle(Geom2d_Curve)& C2d, Standard_Real& cf, Standard_Real& cl, const Standard_Boolean orient = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean BoundUV (const TopoDS_Edge& edge, const TopoDS_Face& face, gp_Pnt2d& first, gp_Pnt2d& last) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean PCurve(const TopoDS_Edge& edge,
|
||||
const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location,
|
||||
Handle(Geom2d_Curve)& C2d,
|
||||
Standard_Real& cf,
|
||||
Standard_Real& cl,
|
||||
const Standard_Boolean orient = Standard_True) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean BoundUV(const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face,
|
||||
gp_Pnt2d& first,
|
||||
gp_Pnt2d& last) const;
|
||||
|
||||
//! Returns the ends of pcurve
|
||||
//! Calls method PCurve with <orient> equal to True
|
||||
Standard_EXPORT Standard_Boolean BoundUV (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, gp_Pnt2d& first, gp_Pnt2d& last) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSeam (const TopoDS_Edge& edge, const TopoDS_Face& face) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean BoundUV(const TopoDS_Edge& edge,
|
||||
const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location,
|
||||
gp_Pnt2d& first,
|
||||
gp_Pnt2d& last) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSeam(const TopoDS_Edge& edge, const TopoDS_Face& face) const;
|
||||
|
||||
//! Returns True if the edge has two pcurves on one surface
|
||||
Standard_EXPORT Standard_Boolean IsSeam (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSeam(const TopoDS_Edge& edge,
|
||||
const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location) const;
|
||||
|
||||
//! Returns start vertex of the edge (taking edge orientation
|
||||
//! into account).
|
||||
Standard_EXPORT TopoDS_Vertex FirstVertex (const TopoDS_Edge& edge) const;
|
||||
|
||||
Standard_EXPORT TopoDS_Vertex FirstVertex(const TopoDS_Edge& edge) const;
|
||||
|
||||
//! Returns end vertex of the edge (taking edge orientation
|
||||
//! into account).
|
||||
Standard_EXPORT TopoDS_Vertex LastVertex (const TopoDS_Edge& edge) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetEndTangent2d (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Boolean atEnd, gp_Pnt2d& pos, gp_Vec2d& tang, const Standard_Real dparam = 0.0) const;
|
||||
|
||||
Standard_EXPORT TopoDS_Vertex LastVertex(const TopoDS_Edge& edge) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetEndTangent2d(const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face,
|
||||
const Standard_Boolean atEnd,
|
||||
gp_Pnt2d& pos,
|
||||
gp_Vec2d& tang,
|
||||
const Standard_Real dparam = 0.0) const;
|
||||
|
||||
//! Returns tangent of the edge pcurve at its start (if atEnd is
|
||||
//! False) or end (if True), regarding the orientation of edge.
|
||||
//! If edge is REVERSED, tangent is reversed before return.
|
||||
//! Returns True if pcurve is available and tangent is computed
|
||||
//! and is not null, else False.
|
||||
Standard_EXPORT Standard_Boolean GetEndTangent2d (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, const Standard_Boolean atEnd, gp_Pnt2d& pos, gp_Vec2d& tang, const Standard_Real dparam = 0.0) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetEndTangent2d(const TopoDS_Edge& edge,
|
||||
const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location,
|
||||
const Standard_Boolean atEnd,
|
||||
gp_Pnt2d& pos,
|
||||
gp_Vec2d& tang,
|
||||
const Standard_Real dparam = 0.0) const;
|
||||
|
||||
//! Checks the start and/or end vertex of the edge for matching
|
||||
//! with 3d curve with the given precision.
|
||||
//! <vtx> = 1 : start vertex only
|
||||
@@ -118,10 +154,15 @@ public:
|
||||
//! <vtx> = 0 : both (default)
|
||||
//! If preci < 0 the vertices are considered with their own
|
||||
//! tolerances, else with the given <preci>.
|
||||
Standard_EXPORT Standard_Boolean CheckVerticesWithCurve3d (const TopoDS_Edge& edge, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckVerticesWithPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckVerticesWithCurve3d(const TopoDS_Edge& edge,
|
||||
const Standard_Real preci = -1,
|
||||
const Standard_Integer vtx = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckVerticesWithPCurve(const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face,
|
||||
const Standard_Real preci = -1,
|
||||
const Standard_Integer vtx = 0);
|
||||
|
||||
//! Checks the start and/or end vertex of the edge for matching
|
||||
//! with pcurve with the given precision.
|
||||
//! <vtx> = 1 : start vertex
|
||||
@@ -129,35 +170,38 @@ public:
|
||||
//! <vtx> = 0 : both
|
||||
//! If preci < 0 the vertices are considered with their own
|
||||
//! tolerances, else with the given <preci>.
|
||||
Standard_EXPORT Standard_Boolean CheckVerticesWithPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckVertexTolerance (const TopoDS_Edge& edge, const TopoDS_Face& face, Standard_Real& toler1, Standard_Real& toler2);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckVerticesWithPCurve(const TopoDS_Edge& edge,
|
||||
const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location,
|
||||
const Standard_Real preci = -1,
|
||||
const Standard_Integer vtx = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckVertexTolerance(const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face,
|
||||
Standard_Real& toler1,
|
||||
Standard_Real& toler2);
|
||||
|
||||
//! Checks if it is necessary to increase tolerances of the edge
|
||||
//! vertices to comprise the ends of 3d curve and pcurve on
|
||||
//! the given face (first method) or all pcurves stored in an edge
|
||||
//! (second one)
|
||||
//! toler1 returns necessary tolerance for first vertex,
|
||||
//! toler2 returns necessary tolerance for last vertex.
|
||||
Standard_EXPORT Standard_Boolean CheckVertexTolerance (const TopoDS_Edge& edge, Standard_Real& toler1, Standard_Real& toler2);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckVertexTolerance(const TopoDS_Edge& edge,
|
||||
Standard_Real& toler1,
|
||||
Standard_Real& toler2);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve(const TopoDS_Edge& edge,
|
||||
const TopoDS_Face& face);
|
||||
|
||||
//! Checks mutual orientation of 3d curve and pcurve on the
|
||||
//! analysis of curves bounding points
|
||||
Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve(const TopoDS_Edge& edge,
|
||||
const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location);
|
||||
|
||||
//! Returns the status (in the form of True/False) of last Check
|
||||
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
|
||||
|
||||
//! Checks the edge to be SameParameter.
|
||||
//! Calculates the maximal deviation between 3d curve and each
|
||||
//! pcurve of the edge on <NbControl> equidistant points (the same
|
||||
//! algorithm as in BRepCheck; default value is 23 as in BRepCheck).
|
||||
//! This deviation is returned in <maxdev> parameter.
|
||||
//! If deviation is greater than tolerance of the edge (i.e.
|
||||
//! incorrect flag) returns False, else returns True.
|
||||
Standard_EXPORT Standard_Boolean CheckSameParameter (const TopoDS_Edge& edge, Standard_Real& maxdev, const Standard_Integer NbControl = 23);
|
||||
Standard_EXPORT Standard_Boolean Status(const ShapeExtend_Status status) const;
|
||||
|
||||
//! Checks the edge to be SameParameter.
|
||||
//! Calculates the maximal deviation between 3d curve and each
|
||||
@@ -166,47 +210,51 @@ public:
|
||||
//! This deviation is returned in <maxdev> parameter.
|
||||
//! If deviation is greater than tolerance of the edge (i.e.
|
||||
//! incorrect flag) returns False, else returns True.
|
||||
Standard_EXPORT Standard_Boolean CheckSameParameter (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace, Standard_Real& theMaxdev, const Standard_Integer theNbControl = 23);
|
||||
Standard_EXPORT Standard_Boolean CheckSameParameter(const TopoDS_Edge& edge,
|
||||
Standard_Real& maxdev,
|
||||
const Standard_Integer NbControl = 23);
|
||||
|
||||
//! Checks the edge to be SameParameter.
|
||||
//! Calculates the maximal deviation between 3d curve and each
|
||||
//! pcurve of the edge on <NbControl> equidistant points (the same
|
||||
//! algorithm as in BRepCheck; default value is 23 as in BRepCheck).
|
||||
//! This deviation is returned in <maxdev> parameter.
|
||||
//! If deviation is greater than tolerance of the edge (i.e.
|
||||
//! incorrect flag) returns False, else returns True.
|
||||
Standard_EXPORT Standard_Boolean CheckSameParameter(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Standard_Real& theMaxdev,
|
||||
const Standard_Integer theNbControl = 23);
|
||||
|
||||
//! Checks possibility for pcurve thePC to have range [theFirst, theLast] (edge range)
|
||||
//! having respect to real first, last parameters of thePC
|
||||
Standard_EXPORT Standard_Boolean CheckPCurveRange (const Standard_Real theFirst, const Standard_Real theLast,
|
||||
const Handle(Geom2d_Curve)& thePC);
|
||||
|
||||
//! having respect to real first, last parameters of thePC
|
||||
Standard_EXPORT Standard_Boolean CheckPCurveRange(const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Handle(Geom2d_Curve)& thePC);
|
||||
|
||||
//! Checks the first edge is overlapped with second edge.
|
||||
//! If distance between two edges is less then theTolOverlap
|
||||
//! edges are overlapped.
|
||||
//! theDomainDis - length of part of edges on which edges are overlapped.
|
||||
Standard_EXPORT Standard_Boolean CheckOverlapping (const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2, Standard_Real& theTolOverlap, const Standard_Real theDomainDist = 0.0);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckOverlapping(const TopoDS_Edge& theEdge1,
|
||||
const TopoDS_Edge& theEdge2,
|
||||
Standard_Real& theTolOverlap,
|
||||
const Standard_Real theDomainDist = 0.0);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myStatus;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Check points by pairs (A and A, B and B) with precisions
|
||||
//! (preci1 and preci2).
|
||||
//! P1 are the points either from 3d curve or from vertices,
|
||||
//! P2 are the points from pcurve
|
||||
Standard_EXPORT Standard_Boolean CheckPoints (const gp_Pnt& P1A, const gp_Pnt& P1B, const gp_Pnt& P2A, const gp_Pnt& P2B, const Standard_Real preci1, const Standard_Real preci2);
|
||||
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckPoints(const gp_Pnt& P1A,
|
||||
const gp_Pnt& P1B,
|
||||
const gp_Pnt& P2A,
|
||||
const gp_Pnt& P2B,
|
||||
const Standard_Real preci1,
|
||||
const Standard_Real preci2);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_Edge_HeaderFile
|
||||
|
@@ -14,18 +14,17 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <ShapeAnalysis_FreeBoundData.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ShapeAnalysis_FreeBoundData,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ShapeAnalysis_FreeBoundData, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBoundData
|
||||
//purpose : Empty constructor
|
||||
// function : ShapeAnalysis_FreeBoundData
|
||||
// purpose : Empty constructor
|
||||
//=======================================================================
|
||||
ShapeAnalysis_FreeBoundData::ShapeAnalysis_FreeBoundData()
|
||||
{
|
||||
@@ -34,8 +33,8 @@ ShapeAnalysis_FreeBoundData::ShapeAnalysis_FreeBoundData()
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBoundData
|
||||
//purpose : Creates object with contour given in the form of TopoDS_Wire
|
||||
// function : ShapeAnalysis_FreeBoundData
|
||||
// purpose : Creates object with contour given in the form of TopoDS_Wire
|
||||
//=======================================================================
|
||||
|
||||
ShapeAnalysis_FreeBoundData::ShapeAnalysis_FreeBoundData(const TopoDS_Wire& freebound)
|
||||
@@ -46,48 +45,48 @@ ShapeAnalysis_FreeBoundData::ShapeAnalysis_FreeBoundData(const TopoDS_Wire& free
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose : Clears all properties of the contour. Contour bound itself is not cleared.
|
||||
// function : Clear
|
||||
// purpose : Clears all properties of the contour. Contour bound itself is not cleared.
|
||||
//=======================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBoundData::Clear()
|
||||
{
|
||||
myArea = -1;
|
||||
myArea = -1;
|
||||
myPerimeter = -1;
|
||||
myRatio = -1;
|
||||
myWidth = -1;
|
||||
myRatio = -1;
|
||||
myWidth = -1;
|
||||
myNotches->Clear();
|
||||
myNotchesParams.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddNotch
|
||||
//purpose : Adds notch on free bound with its maximum width
|
||||
// function : AddNotch
|
||||
// purpose : Adds notch on free bound with its maximum width
|
||||
//=======================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBoundData::AddNotch(const TopoDS_Wire& notch,const Standard_Real width)
|
||||
void ShapeAnalysis_FreeBoundData::AddNotch(const TopoDS_Wire& notch, const Standard_Real width)
|
||||
{
|
||||
if (myNotchesParams.IsBound(notch)) return;
|
||||
if (myNotchesParams.IsBound(notch))
|
||||
return;
|
||||
myNotches->Append(notch);
|
||||
myNotchesParams.Bind(notch, width);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NotchWidth
|
||||
//purpose : Returns maximum width of notch specified by its rank number
|
||||
// function : NotchWidth
|
||||
// purpose : Returns maximum width of notch specified by its rank number
|
||||
// on the contour
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis_FreeBoundData::NotchWidth(const Standard_Integer index) const
|
||||
{
|
||||
TopoDS_Wire wire = TopoDS::Wire(myNotches -> Value(index));
|
||||
TopoDS_Wire wire = TopoDS::Wire(myNotches->Value(index));
|
||||
return myNotchesParams.Find(wire);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NotchWidth
|
||||
//purpose : Returns maximum width of notch specified as TopoDS_Wire
|
||||
// function : NotchWidth
|
||||
// purpose : Returns maximum width of notch specified as TopoDS_Wire
|
||||
// on the contour
|
||||
//=======================================================================
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
|
||||
class ShapeAnalysis_FreeBoundData;
|
||||
DEFINE_STANDARD_HANDLE(ShapeAnalysis_FreeBoundData, Standard_Transient)
|
||||
|
||||
@@ -50,97 +49,79 @@ class ShapeAnalysis_FreeBoundData : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_FreeBoundData();
|
||||
|
||||
|
||||
//! Creates object with contour given in the form of TopoDS_Wire
|
||||
Standard_EXPORT ShapeAnalysis_FreeBoundData(const TopoDS_Wire& freebound);
|
||||
|
||||
|
||||
//! Clears all properties of the contour.
|
||||
//! Contour bound itself is not cleared.
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
|
||||
//! Sets contour
|
||||
void SetFreeBound (const TopoDS_Wire& freebound);
|
||||
|
||||
void SetFreeBound(const TopoDS_Wire& freebound);
|
||||
|
||||
//! Sets area of the contour
|
||||
void SetArea (const Standard_Real area);
|
||||
|
||||
void SetArea(const Standard_Real area);
|
||||
|
||||
//! Sets perimeter of the contour
|
||||
void SetPerimeter (const Standard_Real perimeter);
|
||||
|
||||
void SetPerimeter(const Standard_Real perimeter);
|
||||
|
||||
//! Sets ratio of average length to average width of the contour
|
||||
void SetRatio (const Standard_Real ratio);
|
||||
|
||||
void SetRatio(const Standard_Real ratio);
|
||||
|
||||
//! Sets average width of the contour
|
||||
void SetWidth (const Standard_Real width);
|
||||
|
||||
void SetWidth(const Standard_Real width);
|
||||
|
||||
//! Adds notch on the contour with its maximum width
|
||||
Standard_EXPORT void AddNotch (const TopoDS_Wire& notch, const Standard_Real width);
|
||||
|
||||
Standard_EXPORT void AddNotch(const TopoDS_Wire& notch, const Standard_Real width);
|
||||
|
||||
//! Returns contour
|
||||
TopoDS_Wire FreeBound() const;
|
||||
|
||||
TopoDS_Wire FreeBound() const;
|
||||
|
||||
//! Returns area of the contour
|
||||
Standard_Real Area() const;
|
||||
|
||||
Standard_Real Area() const;
|
||||
|
||||
//! Returns perimeter of the contour
|
||||
Standard_Real Perimeter() const;
|
||||
|
||||
Standard_Real Perimeter() const;
|
||||
|
||||
//! Returns ratio of average length to average width of the contour
|
||||
Standard_Real Ratio() const;
|
||||
|
||||
Standard_Real Ratio() const;
|
||||
|
||||
//! Returns average width of the contour
|
||||
Standard_Real Width() const;
|
||||
|
||||
Standard_Real Width() const;
|
||||
|
||||
//! Returns number of notches on the contour
|
||||
Standard_Integer NbNotches() const;
|
||||
|
||||
Standard_Integer NbNotches() const;
|
||||
|
||||
//! Returns sequence of notches on the contour
|
||||
Handle(TopTools_HSequenceOfShape) Notches() const;
|
||||
|
||||
Handle(TopTools_HSequenceOfShape) Notches() const;
|
||||
|
||||
//! Returns notch on the contour
|
||||
TopoDS_Wire Notch (const Standard_Integer index) const;
|
||||
|
||||
TopoDS_Wire Notch(const Standard_Integer index) const;
|
||||
|
||||
//! Returns maximum width of notch specified by its rank number
|
||||
//! on the contour
|
||||
Standard_EXPORT Standard_Real NotchWidth (const Standard_Integer index) const;
|
||||
|
||||
Standard_EXPORT Standard_Real NotchWidth(const Standard_Integer index) const;
|
||||
|
||||
//! Returns maximum width of notch specified as TopoDS_Wire
|
||||
//! on the contour
|
||||
Standard_EXPORT Standard_Real NotchWidth (const TopoDS_Wire& notch) const;
|
||||
Standard_EXPORT Standard_Real NotchWidth(const TopoDS_Wire& notch) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_FreeBoundData,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_FreeBoundData, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
TopoDS_Wire myBound;
|
||||
Standard_Real myArea;
|
||||
Standard_Real myPerimeter;
|
||||
Standard_Real myRatio;
|
||||
Standard_Real myWidth;
|
||||
TopoDS_Wire myBound;
|
||||
Standard_Real myArea;
|
||||
Standard_Real myPerimeter;
|
||||
Standard_Real myRatio;
|
||||
Standard_Real myWidth;
|
||||
Handle(TopTools_HSequenceOfShape) myNotches;
|
||||
TopTools_DataMapOfShapeReal myNotchesParams;
|
||||
|
||||
|
||||
TopTools_DataMapOfShapeReal myNotchesParams;
|
||||
};
|
||||
|
||||
|
||||
#include <ShapeAnalysis_FreeBoundData.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_FreeBoundData_HeaderFile
|
||||
|
@@ -18,8 +18,8 @@
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : SetFreeBound
|
||||
//purpose : Sets contour
|
||||
// function : SetFreeBound
|
||||
// purpose : Sets contour
|
||||
//=======================================================================
|
||||
|
||||
inline void ShapeAnalysis_FreeBoundData::SetFreeBound(const TopoDS_Wire& freebound)
|
||||
@@ -28,8 +28,8 @@ inline void ShapeAnalysis_FreeBoundData::SetFreeBound(const TopoDS_Wire& freebou
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetArea
|
||||
//purpose : Sets area of the contour
|
||||
// function : SetArea
|
||||
// purpose : Sets area of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline void ShapeAnalysis_FreeBoundData::SetArea(const Standard_Real area)
|
||||
@@ -38,18 +38,18 @@ inline void ShapeAnalysis_FreeBoundData::SetArea(const Standard_Real area)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPerimeter
|
||||
//purpose : Sets perimeter of the contour
|
||||
// function : SetPerimeter
|
||||
// purpose : Sets perimeter of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline void ShapeAnalysis_FreeBoundData::SetPerimeter(const Standard_Real perimeter)
|
||||
{
|
||||
myPerimeter = perimeter;
|
||||
myPerimeter = perimeter;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRatio
|
||||
//purpose : Sets ratio of average length to average width of the contour
|
||||
// function : SetRatio
|
||||
// purpose : Sets ratio of average length to average width of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline void ShapeAnalysis_FreeBoundData::SetRatio(const Standard_Real ratio)
|
||||
@@ -58,8 +58,8 @@ inline void ShapeAnalysis_FreeBoundData::SetRatio(const Standard_Real ratio)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetWidth
|
||||
//purpose : Sets average width of the contour
|
||||
// function : SetWidth
|
||||
// purpose : Sets average width of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline void ShapeAnalysis_FreeBoundData::SetWidth(const Standard_Real width)
|
||||
@@ -68,13 +68,13 @@ inline void ShapeAnalysis_FreeBoundData::SetWidth(const Standard_Real width)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddNotch
|
||||
//purpose : Adds notch on free bound with its maximum width
|
||||
// function : AddNotch
|
||||
// purpose : Adds notch on free bound with its maximum width
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : FreeBound
|
||||
//purpose : Returns contour
|
||||
// function : FreeBound
|
||||
// purpose : Returns contour
|
||||
//=======================================================================
|
||||
|
||||
inline TopoDS_Wire ShapeAnalysis_FreeBoundData::FreeBound() const
|
||||
@@ -83,8 +83,8 @@ inline TopoDS_Wire ShapeAnalysis_FreeBoundData::FreeBound() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Area
|
||||
//purpose : Returns area of the contour
|
||||
// function : Area
|
||||
// purpose : Returns area of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_FreeBoundData::Area() const
|
||||
@@ -93,8 +93,8 @@ inline Standard_Real ShapeAnalysis_FreeBoundData::Area() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perimeter
|
||||
//purpose : Returns perimeter of the contour
|
||||
// function : Perimeter
|
||||
// purpose : Returns perimeter of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_FreeBoundData::Perimeter() const
|
||||
@@ -103,8 +103,8 @@ inline Standard_Real ShapeAnalysis_FreeBoundData::Perimeter() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Ratio
|
||||
//purpose : Returns ratio of average length to average width of the contour
|
||||
// function : Ratio
|
||||
// purpose : Returns ratio of average length to average width of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_FreeBoundData::Ratio() const
|
||||
@@ -113,8 +113,8 @@ inline Standard_Real ShapeAnalysis_FreeBoundData::Ratio() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Width
|
||||
//purpose : Returns average width of the contour
|
||||
// function : Width
|
||||
// purpose : Returns average width of the contour
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_FreeBoundData::Width() const
|
||||
@@ -123,8 +123,8 @@ inline Standard_Real ShapeAnalysis_FreeBoundData::Width() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbNotches
|
||||
//purpose : Returns number of notches on the contour
|
||||
// function : NbNotches
|
||||
// purpose : Returns number of notches on the contour
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer ShapeAnalysis_FreeBoundData::NbNotches() const
|
||||
@@ -133,8 +133,8 @@ inline Standard_Integer ShapeAnalysis_FreeBoundData::NbNotches() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Notches
|
||||
//purpose : Returns sequence of notches on the contour
|
||||
// function : Notches
|
||||
// purpose : Returns sequence of notches on the contour
|
||||
//=======================================================================
|
||||
|
||||
inline Handle(TopTools_HSequenceOfShape) ShapeAnalysis_FreeBoundData::Notches() const
|
||||
@@ -143,8 +143,8 @@ inline Handle(TopTools_HSequenceOfShape) ShapeAnalysis_FreeBoundData::Notches()
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Notch
|
||||
//purpose : Returns notch on the contour
|
||||
// function : Notch
|
||||
// purpose : Returns notch on the contour
|
||||
//=======================================================================
|
||||
|
||||
inline TopoDS_Wire ShapeAnalysis_FreeBoundData::Notch(const Standard_Integer index) const
|
||||
|
@@ -16,8 +16,8 @@
|
||||
|
||||
// Modified: Thu Sep 17 12:27:58 1998
|
||||
// 25.12.98 pdn transmission from BRepTools_Sewing to BRepBuilderAPI_Sewing
|
||||
//szv#4 S4163
|
||||
// 11.01.00 svv #1: porting on DEC
|
||||
// szv#4 S4163
|
||||
// 11.01.00 svv #1: porting on DEC
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@@ -50,171 +50,164 @@
|
||||
#include <TopTools_HArray1OfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
//ied_modif_for_compil_Nov-19-1998
|
||||
// ied_modif_for_compil_Nov-19-1998
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBounds
|
||||
//purpose : Empty constructor
|
||||
// function : ShapeAnalysis_FreeBounds
|
||||
// purpose : Empty constructor
|
||||
//=======================================================================
|
||||
ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds() {}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen) :
|
||||
myTolerance (toler), myShared (Standard_False),
|
||||
mySplitClosed (splitclosed), mySplitOpen (splitopen)
|
||||
ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
: myTolerance(toler),
|
||||
myShared(Standard_False),
|
||||
mySplitClosed(splitclosed),
|
||||
mySplitOpen(splitopen)
|
||||
{
|
||||
BRepBuilderAPI_Sewing Sew(toler, Standard_False, Standard_False);
|
||||
for (TopoDS_Iterator S (shape); S.More(); S.Next()) Sew.Add(S.Value());
|
||||
for (TopoDS_Iterator S(shape); S.More(); S.Next())
|
||||
Sew.Add(S.Value());
|
||||
Sew.Perform();
|
||||
//
|
||||
// Extract free edges.
|
||||
//
|
||||
Standard_Integer nbedge = Sew.NbFreeEdges();
|
||||
Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape;
|
||||
Standard_Integer nbedge = Sew.NbFreeEdges();
|
||||
Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape;
|
||||
Handle(TopTools_HSequenceOfShape) wires;
|
||||
TopoDS_Edge anEdge;
|
||||
for (Standard_Integer iedge = 1 ; iedge <= nbedge ; iedge++) {
|
||||
anEdge = TopoDS::Edge (Sew.FreeEdge(iedge));
|
||||
if ( !BRep_Tool::Degenerated(anEdge) ) edges->Append (anEdge);
|
||||
TopoDS_Edge anEdge;
|
||||
for (Standard_Integer iedge = 1; iedge <= nbedge; iedge++)
|
||||
{
|
||||
anEdge = TopoDS::Edge(Sew.FreeEdge(iedge));
|
||||
if (!BRep_Tool::Degenerated(anEdge))
|
||||
edges->Append(anEdge);
|
||||
}
|
||||
//
|
||||
// Chainage.
|
||||
//
|
||||
ConnectEdgesToWires (edges, toler, Standard_False, wires);
|
||||
DispatchWires (wires, myWires, myEdges);
|
||||
SplitWires ();
|
||||
|
||||
return ;
|
||||
ConnectEdgesToWires(edges, toler, Standard_False, wires);
|
||||
DispatchWires(wires, myWires, myEdges);
|
||||
SplitWires();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen,
|
||||
const Standard_Boolean checkinternaledges) :
|
||||
myTolerance (0.), myShared (Standard_True),
|
||||
mySplitClosed (splitclosed), mySplitOpen (splitopen)
|
||||
ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen,
|
||||
const Standard_Boolean checkinternaledges)
|
||||
: myTolerance(0.),
|
||||
myShared(Standard_True),
|
||||
mySplitClosed(splitclosed),
|
||||
mySplitOpen(splitopen)
|
||||
{
|
||||
TopoDS_Shell aTmpShell;
|
||||
BRep_Builder aB;
|
||||
aB.MakeShell(aTmpShell);
|
||||
for(TopExp_Explorer aExpFace(shape,TopAbs_FACE);aExpFace.More(); aExpFace.Next())
|
||||
aB.Add(aTmpShell,aExpFace.Current());
|
||||
|
||||
for (TopExp_Explorer aExpFace(shape, TopAbs_FACE); aExpFace.More(); aExpFace.Next())
|
||||
aB.Add(aTmpShell, aExpFace.Current());
|
||||
|
||||
ShapeAnalysis_Shell sas;
|
||||
sas.CheckOrientedShells (aTmpShell, Standard_True, checkinternaledges);
|
||||
|
||||
if (sas.HasFreeEdges()) {
|
||||
ShapeExtend_Explorer see;
|
||||
Handle(TopTools_HSequenceOfShape) edges = see.SeqFromCompound (sas.FreeEdges(), Standard_False);
|
||||
|
||||
sas.CheckOrientedShells(aTmpShell, Standard_True, checkinternaledges);
|
||||
|
||||
if (sas.HasFreeEdges())
|
||||
{
|
||||
ShapeExtend_Explorer see;
|
||||
Handle(TopTools_HSequenceOfShape) edges = see.SeqFromCompound(sas.FreeEdges(), Standard_False);
|
||||
|
||||
Handle(TopTools_HSequenceOfShape) wires;
|
||||
ConnectEdgesToWires (edges, Precision::Confusion(), Standard_True, wires);
|
||||
DispatchWires (wires, myWires, myEdges);
|
||||
SplitWires ();
|
||||
ConnectEdgesToWires(edges, Precision::Confusion(), Standard_True, wires);
|
||||
DispatchWires(wires, myWires, myEdges);
|
||||
SplitWires();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConnectEdgesToWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBounds::ConnectEdgesToWires(Handle(TopTools_HSequenceOfShape)& edges,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& wires)
|
||||
void ShapeAnalysis_FreeBounds::ConnectEdgesToWires(Handle(TopTools_HSequenceOfShape)& edges,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& wires)
|
||||
{
|
||||
Handle(TopTools_HSequenceOfShape) iwires = new TopTools_HSequenceOfShape;
|
||||
BRep_Builder B;
|
||||
|
||||
BRep_Builder B;
|
||||
|
||||
Standard_Integer i; // svv #1
|
||||
for (i = 1; i <= edges->Length(); i++) {
|
||||
for (i = 1; i <= edges->Length(); i++)
|
||||
{
|
||||
TopoDS_Wire wire;
|
||||
B.MakeWire (wire);
|
||||
B.Add (wire, edges->Value (i));
|
||||
iwires->Append (wire);
|
||||
B.MakeWire(wire);
|
||||
B.Add(wire, edges->Value(i));
|
||||
iwires->Append(wire);
|
||||
}
|
||||
|
||||
ConnectWiresToWires (iwires, toler, shared, wires);
|
||||
ConnectWiresToWires(iwires, toler, shared, wires);
|
||||
|
||||
for (i = 1; i <= edges->Length(); i++)
|
||||
if (iwires->Value(i).Orientation() == TopAbs_REVERSED)
|
||||
edges->ChangeValue(i).Reverse();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConnectWiresToWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBounds::ConnectWiresToWires(Handle(TopTools_HSequenceOfShape)& iwires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& owires)
|
||||
void ShapeAnalysis_FreeBounds::ConnectWiresToWires(Handle(TopTools_HSequenceOfShape)& iwires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& owires)
|
||||
{
|
||||
TopTools_DataMapOfShapeShape map;
|
||||
ConnectWiresToWires (iwires, toler, shared, owires, map);
|
||||
ConnectWiresToWires(iwires, toler, shared, owires, map);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConnectWiresToWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBounds::ConnectWiresToWires(Handle(TopTools_HSequenceOfShape)& iwires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& owires,
|
||||
TopTools_DataMapOfShapeShape& vertices)
|
||||
void ShapeAnalysis_FreeBounds::ConnectWiresToWires(Handle(TopTools_HSequenceOfShape)& iwires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& owires,
|
||||
TopTools_DataMapOfShapeShape& vertices)
|
||||
{
|
||||
if (iwires.IsNull() || !iwires->Length()) return;
|
||||
if (iwires.IsNull() || !iwires->Length())
|
||||
return;
|
||||
Handle(TopTools_HArray1OfShape) arrwires = new TopTools_HArray1OfShape(1, iwires->Length());
|
||||
//amv
|
||||
// amv
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= arrwires->Length(); i++)
|
||||
arrwires->SetValue(i, iwires->Value(i));
|
||||
owires = new TopTools_HSequenceOfShape;
|
||||
Standard_Real tolerance = Max (toler, Precision::Confusion());
|
||||
|
||||
Handle(ShapeExtend_WireData)
|
||||
sewd = new ShapeExtend_WireData (TopoDS::Wire (arrwires->Value (1)));
|
||||
owires = new TopTools_HSequenceOfShape;
|
||||
Standard_Real tolerance = Max(toler, Precision::Confusion());
|
||||
|
||||
Handle(ShapeExtend_WireData) sewd = new ShapeExtend_WireData(TopoDS::Wire(arrwires->Value(1)));
|
||||
|
||||
Standard_Boolean isUsedManifoldMode = Standard_True;
|
||||
|
||||
if((sewd->NbEdges() < 1) && (sewd->NbNonManifoldEdges() > 0))
|
||||
if ((sewd->NbEdges() < 1) && (sewd->NbNonManifoldEdges() > 0))
|
||||
{
|
||||
isUsedManifoldMode = Standard_False;
|
||||
sewd = new ShapeExtend_WireData (TopoDS::Wire (arrwires->Value (1)), Standard_True,
|
||||
isUsedManifoldMode);
|
||||
sewd =
|
||||
new ShapeExtend_WireData(TopoDS::Wire(arrwires->Value(1)), Standard_True, isUsedManifoldMode);
|
||||
}
|
||||
|
||||
Handle(ShapeAnalysis_Wire) saw = new ShapeAnalysis_Wire;
|
||||
saw->Load (sewd);
|
||||
saw->SetPrecision (tolerance);
|
||||
saw->Load(sewd);
|
||||
saw->SetPrecision(tolerance);
|
||||
|
||||
ShapeAnalysis_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
ShapeAnalysis_BoxBndTreeSelector aSel(arrwires, shared);
|
||||
ShapeAnalysis_BoxBndTree aBBTree;
|
||||
NCollection_UBTreeFiller<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
|
||||
ShapeAnalysis_BoxBndTreeSelector aSel(arrwires, shared);
|
||||
aSel.LoadList(1);
|
||||
|
||||
for (Standard_Integer inbW = 2; inbW <= arrwires->Length(); inbW++){
|
||||
TopoDS_Wire trW = TopoDS::Wire (arrwires->Value (inbW));
|
||||
Bnd_Box aBox;
|
||||
|
||||
for (Standard_Integer inbW = 2; inbW <= arrwires->Length(); inbW++)
|
||||
{
|
||||
TopoDS_Wire trW = TopoDS::Wire(arrwires->Value(inbW));
|
||||
Bnd_Box aBox;
|
||||
TopoDS_Vertex trV1, trV2;
|
||||
ShapeAnalysis::FindBounds (trW, trV1, trV2);
|
||||
ShapeAnalysis::FindBounds(trW, trV1, trV2);
|
||||
gp_Pnt trP1 = BRep_Tool::Pnt(trV1);
|
||||
gp_Pnt trP2 = BRep_Tool::Pnt(trV2);
|
||||
aBox.Set(trP1);
|
||||
@@ -225,17 +218,16 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
|
||||
aTreeFiller.Fill();
|
||||
Standard_Integer nsel;
|
||||
|
||||
ShapeAnalysis_Edge sae; //szv#4:S4163:12Mar99 moved
|
||||
Standard_Boolean done = Standard_False;
|
||||
|
||||
|
||||
ShapeAnalysis_Edge sae; // szv#4:S4163:12Mar99 moved
|
||||
Standard_Boolean done = Standard_False;
|
||||
|
||||
while (!done)
|
||||
{
|
||||
Standard_Boolean found = Standard_False, tail = Standard_False, direct = Standard_False;
|
||||
Standard_Integer lwire=0;
|
||||
Standard_Integer lwire = 0;
|
||||
aSel.SetStop();
|
||||
Bnd_Box FVBox, LVBox;
|
||||
Bnd_Box FVBox, LVBox;
|
||||
TopoDS_Vertex Vf, Vl;
|
||||
Vf = sae.FirstVertex(sewd->Edge(1));
|
||||
Vl = sae.LastVertex(sewd->Edge(sewd->NbEdges()));
|
||||
@@ -247,129 +239,130 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
FVBox.SetGap(tolerance);
|
||||
LVBox.Set(pl);
|
||||
LVBox.SetGap(tolerance);
|
||||
|
||||
|
||||
aSel.DefineBoxes(FVBox, LVBox);
|
||||
|
||||
|
||||
if (shared)
|
||||
aSel.DefineVertexes(Vf,Vl);
|
||||
aSel.DefineVertexes(Vf, Vl);
|
||||
else
|
||||
{
|
||||
aSel.DefinePnt(pf,pl);
|
||||
aSel.DefinePnt(pf, pl);
|
||||
aSel.SetTolerance(tolerance);
|
||||
}
|
||||
|
||||
|
||||
nsel = aBBTree.Select(aSel);
|
||||
|
||||
|
||||
if (nsel != 0 && !aSel.LastCheckStatus(ShapeExtend_FAIL))
|
||||
{
|
||||
found = Standard_True;
|
||||
lwire = aSel.GetNb();
|
||||
tail = aSel.LastCheckStatus (ShapeExtend_DONE1) ||
|
||||
aSel.LastCheckStatus (ShapeExtend_DONE2);
|
||||
direct = aSel.LastCheckStatus (ShapeExtend_DONE1) ||
|
||||
aSel.LastCheckStatus (ShapeExtend_DONE3);
|
||||
found = Standard_True;
|
||||
lwire = aSel.GetNb();
|
||||
tail = aSel.LastCheckStatus(ShapeExtend_DONE1) || aSel.LastCheckStatus(ShapeExtend_DONE2);
|
||||
direct = aSel.LastCheckStatus(ShapeExtend_DONE1) || aSel.LastCheckStatus(ShapeExtend_DONE3);
|
||||
aSel.LoadList(lwire);
|
||||
}
|
||||
|
||||
|
||||
if (found)
|
||||
{
|
||||
if (!direct)
|
||||
arrwires->ChangeValue(lwire).Reverse();
|
||||
|
||||
TopoDS_Wire aCurW = TopoDS::Wire (arrwires->Value (lwire));
|
||||
Handle(ShapeExtend_WireData) acurwd = new
|
||||
ShapeExtend_WireData ( TopoDS::Wire (arrwires->Value (lwire)), Standard_True, isUsedManifoldMode);
|
||||
if( !acurwd->NbEdges())
|
||||
TopoDS_Wire aCurW = TopoDS::Wire(arrwires->Value(lwire));
|
||||
Handle(ShapeExtend_WireData) acurwd =
|
||||
new ShapeExtend_WireData(TopoDS::Wire(arrwires->Value(lwire)),
|
||||
Standard_True,
|
||||
isUsedManifoldMode);
|
||||
if (!acurwd->NbEdges())
|
||||
continue;
|
||||
sewd->Add (acurwd, (tail ? 0 : 1));
|
||||
sewd->Add(acurwd, (tail ? 0 : 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
//making wire
|
||||
//1.providing connection (see ShapeFix_Wire::FixConnected())
|
||||
//Standard_Integer i; // svv #1
|
||||
// making wire
|
||||
// 1.providing connection (see ShapeFix_Wire::FixConnected())
|
||||
// Standard_Integer i; // svv #1
|
||||
for (/*Standard_Integer*/ i = 1; i <= saw->NbEdges(); i++)
|
||||
{
|
||||
if (saw->CheckConnected (i))
|
||||
if (saw->CheckConnected(i))
|
||||
{
|
||||
Standard_Integer n2 = i;
|
||||
Standard_Integer n1 = (n2 > 1 ? n2 - 1 : saw->NbEdges());
|
||||
TopoDS_Edge E1 = sewd->Edge(n1);
|
||||
TopoDS_Edge E2 = sewd->Edge(n2);
|
||||
TopoDS_Edge E1 = sewd->Edge(n1);
|
||||
TopoDS_Edge E2 = sewd->Edge(n2);
|
||||
|
||||
TopoDS_Vertex Vprev, Vfol, V; //connection vertex
|
||||
Vprev = sae.LastVertex (E1);
|
||||
Vfol = sae.FirstVertex (E2);
|
||||
TopoDS_Vertex Vprev, Vfol, V; // connection vertex
|
||||
Vprev = sae.LastVertex(E1);
|
||||
Vfol = sae.FirstVertex(E2);
|
||||
|
||||
if (saw->LastCheckStatus (ShapeExtend_DONE1)) //absolutely confused
|
||||
if (saw->LastCheckStatus(ShapeExtend_DONE1)) // absolutely confused
|
||||
V = Vprev;
|
||||
else {
|
||||
ShapeBuild_Vertex sbv;
|
||||
V = sbv.CombineVertex (Vprev, Vfol);
|
||||
else
|
||||
{
|
||||
ShapeBuild_Vertex sbv;
|
||||
V = sbv.CombineVertex(Vprev, Vfol);
|
||||
}
|
||||
vertices.Bind (Vprev, V);
|
||||
vertices.Bind (Vfol, V);
|
||||
vertices.Bind(Vprev, V);
|
||||
vertices.Bind(Vfol, V);
|
||||
|
||||
//replace vertices to a new one
|
||||
// replace vertices to a new one
|
||||
ShapeBuild_Edge sbe;
|
||||
if (saw->NbEdges() < 2)
|
||||
sewd->Set (sbe.CopyReplaceVertices (E2, V, V), n2);
|
||||
else {
|
||||
sewd->Set (sbe.CopyReplaceVertices (E2, V, TopoDS_Vertex()), n2);
|
||||
if (!saw->LastCheckStatus (ShapeExtend_DONE1))
|
||||
sewd->Set (sbe.CopyReplaceVertices (E1, TopoDS_Vertex(), V), n1);
|
||||
sewd->Set(sbe.CopyReplaceVertices(E2, V, V), n2);
|
||||
else
|
||||
{
|
||||
sewd->Set(sbe.CopyReplaceVertices(E2, V, TopoDS_Vertex()), n2);
|
||||
if (!saw->LastCheckStatus(ShapeExtend_DONE1))
|
||||
sewd->Set(sbe.CopyReplaceVertices(E1, TopoDS_Vertex(), V), n1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//2.making wire
|
||||
// 2.making wire
|
||||
TopoDS_Wire wire = sewd->Wire();
|
||||
if(isUsedManifoldMode)
|
||||
if (isUsedManifoldMode)
|
||||
{
|
||||
if (!saw->CheckConnected (1) && saw->LastCheckStatus (ShapeExtend_OK))
|
||||
wire.Closed (Standard_True);
|
||||
if (!saw->CheckConnected(1) && saw->LastCheckStatus(ShapeExtend_OK))
|
||||
wire.Closed(Standard_True);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Try to check connection by number of free vertices
|
||||
// Try to check connection by number of free vertices
|
||||
TopTools_MapOfShape vmap;
|
||||
TopoDS_Iterator it(wire);
|
||||
TopoDS_Iterator it(wire);
|
||||
|
||||
for(; it.More(); it.Next())
|
||||
for (; it.More(); it.Next())
|
||||
{
|
||||
const TopoDS_Shape& E = it.Value();
|
||||
TopoDS_Iterator ite(E, Standard_False, Standard_True);
|
||||
for(; ite.More(); ite.Next())
|
||||
TopoDS_Iterator ite(E, Standard_False, Standard_True);
|
||||
for (; ite.More(); ite.Next())
|
||||
{
|
||||
const TopoDS_Shape& V = ite.Value();
|
||||
if (V.Orientation() == TopAbs_FORWARD ||
|
||||
V.Orientation() == TopAbs_REVERSED)
|
||||
if (V.Orientation() == TopAbs_FORWARD || V.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
// add or remove in the vertex map
|
||||
if (!vmap.Add(V)) vmap.Remove(V);
|
||||
if (!vmap.Add(V))
|
||||
vmap.Remove(V);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(vmap.IsEmpty())
|
||||
if (vmap.IsEmpty())
|
||||
{
|
||||
wire.Closed(Standard_True);
|
||||
}
|
||||
}
|
||||
|
||||
owires->Append (wire);
|
||||
owires->Append(wire);
|
||||
sewd->Clear();
|
||||
sewd->ManifoldMode() = isUsedManifoldMode;
|
||||
|
||||
|
||||
// Recherche de la premier edge non traitee pour un autre wire.
|
||||
//Searching for first edge for next wire
|
||||
// Searching for first edge for next wire
|
||||
lwire = -1;
|
||||
for (/*Standard_Integer*/ i = 1 ; i <= arrwires->Length(); i++)
|
||||
for (/*Standard_Integer*/ i = 1; i <= arrwires->Length(); i++)
|
||||
{
|
||||
if (!aSel.ContWire(i))
|
||||
{
|
||||
lwire = i; //szv#4:S4163:12Mar99 optimized
|
||||
sewd->Add (TopoDS::Wire (arrwires->Value (lwire)));
|
||||
lwire = i; // szv#4:S4163:12Mar99 optimized
|
||||
sewd->Add(TopoDS::Wire(arrwires->Value(lwire)));
|
||||
aSel.LoadList(lwire);
|
||||
|
||||
if (sewd->NbEdges() > 0)
|
||||
@@ -383,185 +376,209 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
}
|
||||
}
|
||||
|
||||
for ( /*Standard_Integer*/ i = 1; i <= iwires->Length(); i++)
|
||||
for (/*Standard_Integer*/ i = 1; i <= iwires->Length(); i++)
|
||||
{
|
||||
iwires->SetValue (i, arrwires->Value(i));
|
||||
iwires->SetValue(i, arrwires->Value(i));
|
||||
}
|
||||
}
|
||||
|
||||
static void SplitWire(const TopoDS_Wire& wire,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& closed,
|
||||
Handle(TopTools_HSequenceOfShape)& open)
|
||||
static void SplitWire(const TopoDS_Wire& wire,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& closed,
|
||||
Handle(TopTools_HSequenceOfShape)& open)
|
||||
{
|
||||
closed = new TopTools_HSequenceOfShape;
|
||||
open = new TopTools_HSequenceOfShape;
|
||||
Standard_Real tolerance = Max (toler, Precision::Confusion());
|
||||
closed = new TopTools_HSequenceOfShape;
|
||||
open = new TopTools_HSequenceOfShape;
|
||||
Standard_Real tolerance = Max(toler, Precision::Confusion());
|
||||
|
||||
BRep_Builder B;
|
||||
BRep_Builder B;
|
||||
ShapeAnalysis_Edge sae;
|
||||
|
||||
Handle(ShapeExtend_WireData) sewd = new ShapeExtend_WireData (wire);
|
||||
Standard_Integer nbedges = sewd->NbEdges();
|
||||
|
||||
//ConnectedEdgeSequence - list of indices of connected edges to build a wire
|
||||
Handle(ShapeExtend_WireData) sewd = new ShapeExtend_WireData(wire);
|
||||
Standard_Integer nbedges = sewd->NbEdges();
|
||||
|
||||
// ConnectedEdgeSequence - list of indices of connected edges to build a wire
|
||||
TColStd_SequenceOfInteger ces;
|
||||
//statuses - array of flags describing the edge:
|
||||
//0-free, 1-in CES, 2-already in wire,
|
||||
//3-no closed wire can be produced starting at this edge
|
||||
TColStd_Array1OfInteger statuses (1, nbedges);
|
||||
statuses.Init (0);
|
||||
// statuses - array of flags describing the edge:
|
||||
// 0-free, 1-in CES, 2-already in wire,
|
||||
// 3-no closed wire can be produced starting at this edge
|
||||
TColStd_Array1OfInteger statuses(1, nbedges);
|
||||
statuses.Init(0);
|
||||
|
||||
//building closed wires
|
||||
// building closed wires
|
||||
Standard_Integer i; // svv #1
|
||||
for (i = 1; i <= nbedges; i++)
|
||||
if (statuses.Value (i) == 0) {
|
||||
ces.Append (i); statuses.SetValue (i, 1); //putting into CES
|
||||
if (statuses.Value(i) == 0)
|
||||
{
|
||||
ces.Append(i);
|
||||
statuses.SetValue(i, 1); // putting into CES
|
||||
Standard_Boolean SearchBackward = Standard_True;
|
||||
|
||||
for(;;) {
|
||||
Standard_Boolean found;
|
||||
TopoDS_Edge edge;
|
||||
TopoDS_Vertex lvertex;
|
||||
gp_Pnt lpoint;
|
||||
for (;;)
|
||||
{
|
||||
Standard_Boolean found;
|
||||
TopoDS_Edge edge;
|
||||
TopoDS_Vertex lvertex;
|
||||
gp_Pnt lpoint;
|
||||
|
||||
//searching for connection in ces
|
||||
if (SearchBackward) {
|
||||
SearchBackward = Standard_False;
|
||||
found = Standard_False;
|
||||
edge = sewd->Edge (ces.Last());
|
||||
lvertex = sae.LastVertex (edge);
|
||||
lpoint = BRep_Tool::Pnt (lvertex);
|
||||
Standard_Integer j; // svv #1
|
||||
for (j = ces.Length(); (j >= 1) && !found; j--) {
|
||||
TopoDS_Vertex fv = sae.FirstVertex (sewd->Edge (ces.Value (j)) );
|
||||
gp_Pnt fp = BRep_Tool::Pnt (fv);
|
||||
if ((shared && lvertex.IsSame (fv)) ||
|
||||
(!shared && lpoint.IsEqual (fp, tolerance)))
|
||||
found = Standard_True;
|
||||
}
|
||||
// searching for connection in ces
|
||||
if (SearchBackward)
|
||||
{
|
||||
SearchBackward = Standard_False;
|
||||
found = Standard_False;
|
||||
edge = sewd->Edge(ces.Last());
|
||||
lvertex = sae.LastVertex(edge);
|
||||
lpoint = BRep_Tool::Pnt(lvertex);
|
||||
Standard_Integer j; // svv #1
|
||||
for (j = ces.Length(); (j >= 1) && !found; j--)
|
||||
{
|
||||
TopoDS_Vertex fv = sae.FirstVertex(sewd->Edge(ces.Value(j)));
|
||||
gp_Pnt fp = BRep_Tool::Pnt(fv);
|
||||
if ((shared && lvertex.IsSame(fv)) || (!shared && lpoint.IsEqual(fp, tolerance)))
|
||||
found = Standard_True;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
j++;//because of decreasing last iteration
|
||||
//making closed wire
|
||||
TopoDS_Wire wire1;
|
||||
B.MakeWire (wire1);
|
||||
for (Standard_Integer cesindex = j; cesindex <= ces.Length(); cesindex++) {
|
||||
B.Add (wire1, sewd->Edge (ces.Value (cesindex)));
|
||||
statuses.SetValue (ces.Value (cesindex), 2);
|
||||
}
|
||||
wire1.Closed (Standard_True);
|
||||
closed->Append (wire1);
|
||||
ces.Remove (j, ces.Length());
|
||||
if (ces.IsEmpty()) break;
|
||||
}
|
||||
}
|
||||
|
||||
//searching for connection among free edges
|
||||
found = Standard_False;
|
||||
edge = sewd->Edge (ces.Last());
|
||||
lvertex = sae.LastVertex (edge);
|
||||
lpoint = BRep_Tool::Pnt (lvertex);
|
||||
Standard_Integer j; // svv #1
|
||||
for (j = 1; (j <= nbedges) && !found; j++)
|
||||
if (statuses.Value (j) == 0) {
|
||||
TopoDS_Vertex fv = sae.FirstVertex (sewd->Edge (j));
|
||||
gp_Pnt fp = BRep_Tool::Pnt (fv);
|
||||
if ((shared && lvertex.IsSame (fv)) ||
|
||||
(!shared && lpoint.IsEqual (fp, tolerance)))
|
||||
found = Standard_True;
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
j++; // because of decreasing last iteration
|
||||
// making closed wire
|
||||
TopoDS_Wire wire1;
|
||||
B.MakeWire(wire1);
|
||||
for (Standard_Integer cesindex = j; cesindex <= ces.Length(); cesindex++)
|
||||
{
|
||||
B.Add(wire1, sewd->Edge(ces.Value(cesindex)));
|
||||
statuses.SetValue(ces.Value(cesindex), 2);
|
||||
}
|
||||
wire1.Closed(Standard_True);
|
||||
closed->Append(wire1);
|
||||
ces.Remove(j, ces.Length());
|
||||
if (ces.IsEmpty())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
j--;//because of last iteration
|
||||
ces.Append (j); statuses.SetValue (j, 1);//putting into CES
|
||||
SearchBackward = Standard_True;
|
||||
continue;
|
||||
}
|
||||
|
||||
//no edges found - mark the branch as open (use status 3)
|
||||
statuses.SetValue (ces.Last(), 3);
|
||||
ces.Remove (ces.Length());
|
||||
if (ces.IsEmpty()) break;
|
||||
// searching for connection among free edges
|
||||
found = Standard_False;
|
||||
edge = sewd->Edge(ces.Last());
|
||||
lvertex = sae.LastVertex(edge);
|
||||
lpoint = BRep_Tool::Pnt(lvertex);
|
||||
Standard_Integer j; // svv #1
|
||||
for (j = 1; (j <= nbedges) && !found; j++)
|
||||
if (statuses.Value(j) == 0)
|
||||
{
|
||||
TopoDS_Vertex fv = sae.FirstVertex(sewd->Edge(j));
|
||||
gp_Pnt fp = BRep_Tool::Pnt(fv);
|
||||
if ((shared && lvertex.IsSame(fv)) || (!shared && lpoint.IsEqual(fp, tolerance)))
|
||||
found = Standard_True;
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
j--; // because of last iteration
|
||||
ces.Append(j);
|
||||
statuses.SetValue(j, 1); // putting into CES
|
||||
SearchBackward = Standard_True;
|
||||
continue;
|
||||
}
|
||||
|
||||
// no edges found - mark the branch as open (use status 3)
|
||||
statuses.SetValue(ces.Last(), 3);
|
||||
ces.Remove(ces.Length());
|
||||
if (ces.IsEmpty())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//building open wires
|
||||
|
||||
// building open wires
|
||||
Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape;
|
||||
for (i = 1; i <= nbedges; i++)
|
||||
if (statuses.Value (i) != 2) edges->Append (sewd->Edge(i));
|
||||
if (statuses.Value(i) != 2)
|
||||
edges->Append(sewd->Edge(i));
|
||||
|
||||
ShapeAnalysis_FreeBounds::ConnectEdgesToWires (edges, toler, shared, open);
|
||||
ShapeAnalysis_FreeBounds::ConnectEdgesToWires(edges, toler, shared, open);
|
||||
}
|
||||
|
||||
void ShapeAnalysis_FreeBounds::SplitWires(const Handle(TopTools_HSequenceOfShape)& wires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& closed,
|
||||
Handle(TopTools_HSequenceOfShape)& open)
|
||||
void ShapeAnalysis_FreeBounds::SplitWires(const Handle(TopTools_HSequenceOfShape)& wires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& closed,
|
||||
Handle(TopTools_HSequenceOfShape)& open)
|
||||
{
|
||||
closed = new TopTools_HSequenceOfShape;
|
||||
open = new TopTools_HSequenceOfShape;
|
||||
|
||||
for (Standard_Integer i = 1; i <= wires->Length(); i++) {
|
||||
for (Standard_Integer i = 1; i <= wires->Length(); i++)
|
||||
{
|
||||
Handle(TopTools_HSequenceOfShape) tmpclosed, tmpopen;
|
||||
SplitWire (TopoDS::Wire (wires->Value (i)), toler, shared, tmpclosed, tmpopen);
|
||||
closed->Append (tmpclosed);
|
||||
open->Append (tmpopen);
|
||||
SplitWire(TopoDS::Wire(wires->Value(i)), toler, shared, tmpclosed, tmpopen);
|
||||
closed->Append(tmpclosed);
|
||||
open->Append(tmpopen);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DispatchWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBounds::DispatchWires(const Handle(TopTools_HSequenceOfShape)& wires,
|
||||
TopoDS_Compound& closed,
|
||||
TopoDS_Compound& open)
|
||||
void ShapeAnalysis_FreeBounds::DispatchWires(const Handle(TopTools_HSequenceOfShape)& wires,
|
||||
TopoDS_Compound& closed,
|
||||
TopoDS_Compound& open)
|
||||
{
|
||||
BRep_Builder B;
|
||||
if (closed.IsNull()) B.MakeCompound (closed);
|
||||
if (open.IsNull()) B.MakeCompound (open);
|
||||
if (wires.IsNull()) return;
|
||||
if (closed.IsNull())
|
||||
B.MakeCompound(closed);
|
||||
if (open.IsNull())
|
||||
B.MakeCompound(open);
|
||||
if (wires.IsNull())
|
||||
return;
|
||||
|
||||
for (Standard_Integer iw = 1 ; iw <= wires->Length(); iw++)
|
||||
if ( wires->Value (iw).Closed() )
|
||||
B.Add (closed, wires->Value (iw));
|
||||
for (Standard_Integer iw = 1; iw <= wires->Length(); iw++)
|
||||
if (wires->Value(iw).Closed())
|
||||
B.Add(closed, wires->Value(iw));
|
||||
else
|
||||
B.Add (open, wires->Value (iw));
|
||||
B.Add(open, wires->Value(iw));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SplitWires
|
||||
//purpose : Splits compounds of closed (myWires) and open (myEdges) wires
|
||||
// function : SplitWires
|
||||
// purpose : Splits compounds of closed (myWires) and open (myEdges) wires
|
||||
// into small closed wires according to fields mySplitClosed and
|
||||
// mySplitOpen and rebuilds compounds
|
||||
//=======================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBounds::SplitWires()
|
||||
void ShapeAnalysis_FreeBounds::SplitWires()
|
||||
{
|
||||
if (!mySplitClosed && !mySplitOpen) return; //nothing to do
|
||||
if (!mySplitClosed && !mySplitOpen)
|
||||
return; // nothing to do
|
||||
|
||||
ShapeExtend_Explorer see;
|
||||
Handle(TopTools_HSequenceOfShape) closedwires, cw1, cw2,
|
||||
openwires, ow1, ow2;
|
||||
closedwires = see.SeqFromCompound (myWires, Standard_False);
|
||||
openwires = see.SeqFromCompound (myEdges, Standard_False);
|
||||
|
||||
if (mySplitClosed) SplitWires (closedwires, myTolerance, myShared, cw1, ow1);
|
||||
else {cw1 = closedwires; ow1 = new TopTools_HSequenceOfShape;}
|
||||
ShapeExtend_Explorer see;
|
||||
Handle(TopTools_HSequenceOfShape) closedwires, cw1, cw2, openwires, ow1, ow2;
|
||||
closedwires = see.SeqFromCompound(myWires, Standard_False);
|
||||
openwires = see.SeqFromCompound(myEdges, Standard_False);
|
||||
|
||||
if (mySplitOpen) SplitWires (openwires, myTolerance, myShared, cw2, ow2);
|
||||
else {cw2 = new TopTools_HSequenceOfShape; ow2 = openwires;}
|
||||
|
||||
closedwires = cw1; closedwires->Append (cw2);
|
||||
openwires = ow1; openwires->Append (ow2);
|
||||
if (mySplitClosed)
|
||||
SplitWires(closedwires, myTolerance, myShared, cw1, ow1);
|
||||
else
|
||||
{
|
||||
cw1 = closedwires;
|
||||
ow1 = new TopTools_HSequenceOfShape;
|
||||
}
|
||||
|
||||
//szv#4:S4163:12Mar99 SGI warns
|
||||
TopoDS_Shape compWires = see.CompoundFromSeq (closedwires);
|
||||
TopoDS_Shape compEdges = see.CompoundFromSeq (openwires);
|
||||
myWires = TopoDS::Compound (compWires);
|
||||
myEdges = TopoDS::Compound (compEdges);
|
||||
if (mySplitOpen)
|
||||
SplitWires(openwires, myTolerance, myShared, cw2, ow2);
|
||||
else
|
||||
{
|
||||
cw2 = new TopTools_HSequenceOfShape;
|
||||
ow2 = openwires;
|
||||
}
|
||||
|
||||
closedwires = cw1;
|
||||
closedwires->Append(cw2);
|
||||
openwires = ow1;
|
||||
openwires->Append(ow2);
|
||||
|
||||
// szv#4:S4163:12Mar99 SGI warns
|
||||
TopoDS_Shape compWires = see.CompoundFromSeq(closedwires);
|
||||
TopoDS_Shape compEdges = see.CompoundFromSeq(openwires);
|
||||
myWires = TopoDS::Compound(compWires);
|
||||
myEdges = TopoDS::Compound(compEdges);
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
//! This class is intended to output free bounds of the shape.
|
||||
//!
|
||||
//! Free bounds are the wires consisting of edges referenced by the faces of the shape
|
||||
@@ -55,16 +54,14 @@ class TopoDS_Shape;
|
||||
//! of wires, dispatching wires into compounds for closed and open
|
||||
//! wires.
|
||||
//! NOTE. Ends of the edge or wire mean hereafter their end vertices.
|
||||
class ShapeAnalysis_FreeBounds
|
||||
class ShapeAnalysis_FreeBounds
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_FreeBounds();
|
||||
|
||||
|
||||
//! Builds forecasting free bounds of the <shape>.
|
||||
//! <shape> should be a compound of faces.
|
||||
//! This constructor is to be used for forecasting free edges
|
||||
@@ -76,8 +73,11 @@ public:
|
||||
//! built closed wires.
|
||||
//! If <splitopen> is True extracts closed sub-wires out of
|
||||
//! built open wires.
|
||||
Standard_EXPORT ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, const Standard_Real toler, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_True);
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean splitclosed = Standard_False,
|
||||
const Standard_Boolean splitopen = Standard_True);
|
||||
|
||||
//! Builds actual free bounds of the <shape>.
|
||||
//! <shape> should be a compound of shells.
|
||||
//! This constructor is to be used for getting free edges (ones
|
||||
@@ -89,14 +89,18 @@ public:
|
||||
//! built closed wires.
|
||||
//! If <splitopen> is True extracts closed sub-wires out of
|
||||
//! built open wires.
|
||||
Standard_EXPORT ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_True, const Standard_Boolean checkinternaledges = Standard_False);
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_FreeBounds(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed = Standard_False,
|
||||
const Standard_Boolean splitopen = Standard_True,
|
||||
const Standard_Boolean checkinternaledges = Standard_False);
|
||||
|
||||
//! Returns compound of closed wires out of free edges.
|
||||
const TopoDS_Compound& GetClosedWires() const;
|
||||
|
||||
const TopoDS_Compound& GetClosedWires() const;
|
||||
|
||||
//! Returns compound of open wires out of free edges.
|
||||
const TopoDS_Compound& GetOpenWires() const;
|
||||
|
||||
const TopoDS_Compound& GetOpenWires() const;
|
||||
|
||||
//! Builds sequence of <wires> out of sequence of not sorted
|
||||
//! <edges>.
|
||||
//! Tries to build wires of maximum length. Building a wire is
|
||||
@@ -108,10 +112,16 @@ public:
|
||||
//! adjacent edges share the same vertex.
|
||||
//! If <shared> is False connection is performed only when
|
||||
//! ends of adjacent edges are at distance less than <toler>.
|
||||
Standard_EXPORT static void ConnectEdgesToWires (Handle(TopTools_HSequenceOfShape)& edges, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& wires);
|
||||
|
||||
Standard_EXPORT static void ConnectWiresToWires (Handle(TopTools_HSequenceOfShape)& iwires, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& owires);
|
||||
|
||||
Standard_EXPORT static void ConnectEdgesToWires(Handle(TopTools_HSequenceOfShape)& edges,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& wires);
|
||||
|
||||
Standard_EXPORT static void ConnectWiresToWires(Handle(TopTools_HSequenceOfShape)& iwires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& owires);
|
||||
|
||||
//! Builds sequence of <owires> out of sequence of not sorted
|
||||
//! <iwires>.
|
||||
//! Tries to build wires of maximum length. Building a wire is
|
||||
@@ -125,8 +135,12 @@ public:
|
||||
//! ends of adjacent wires are at distance less than <toler>.
|
||||
//! Map <vertices> stores the correspondence between original
|
||||
//! end vertices of the wires and new connecting vertices.
|
||||
Standard_EXPORT static void ConnectWiresToWires (Handle(TopTools_HSequenceOfShape)& iwires, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& owires, TopTools_DataMapOfShapeShape& vertices);
|
||||
|
||||
Standard_EXPORT static void ConnectWiresToWires(Handle(TopTools_HSequenceOfShape)& iwires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& owires,
|
||||
TopTools_DataMapOfShapeShape& vertices);
|
||||
|
||||
//! Extracts closed sub-wires out of <wires> and adds them
|
||||
//! to <closed>, open wires remained after extraction are put
|
||||
//! into <open>.
|
||||
@@ -134,43 +148,31 @@ public:
|
||||
//! edges share the same vertex.
|
||||
//! If <shared> is False connection is performed only when
|
||||
//! ends of the edges are at distance less than <toler>.
|
||||
Standard_EXPORT static void SplitWires (const Handle(TopTools_HSequenceOfShape)& wires, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& closed, Handle(TopTools_HSequenceOfShape)& open);
|
||||
|
||||
Standard_EXPORT static void SplitWires(const Handle(TopTools_HSequenceOfShape)& wires,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean shared,
|
||||
Handle(TopTools_HSequenceOfShape)& closed,
|
||||
Handle(TopTools_HSequenceOfShape)& open);
|
||||
|
||||
//! Dispatches sequence of <wires> into two compounds
|
||||
//! <closed> for closed wires and <open> for open wires.
|
||||
//! If a compound is not empty wires are added into it.
|
||||
Standard_EXPORT static void DispatchWires (const Handle(TopTools_HSequenceOfShape)& wires, TopoDS_Compound& closed, TopoDS_Compound& open);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static void DispatchWires(const Handle(TopTools_HSequenceOfShape)& wires,
|
||||
TopoDS_Compound& closed,
|
||||
TopoDS_Compound& open);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void SplitWires();
|
||||
|
||||
|
||||
TopoDS_Compound myWires;
|
||||
TopoDS_Compound myEdges;
|
||||
Standard_Real myTolerance;
|
||||
TopoDS_Compound myWires;
|
||||
TopoDS_Compound myEdges;
|
||||
Standard_Real myTolerance;
|
||||
Standard_Boolean myShared;
|
||||
Standard_Boolean mySplitClosed;
|
||||
Standard_Boolean mySplitOpen;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <ShapeAnalysis_FreeBounds.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_FreeBounds_HeaderFile
|
||||
|
@@ -14,11 +14,12 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// 25.12.98 pdn renaming methods GetWires and GetEdges to GetClosedWires and GetOpenWires respectively
|
||||
// 25.12.98 pdn renaming methods GetWires and GetEdges to GetClosedWires and GetOpenWires
|
||||
// respectively
|
||||
|
||||
//=======================================================================
|
||||
//function : GetClosedWires
|
||||
//purpose :
|
||||
// function : GetClosedWires
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopoDS_Compound& ShapeAnalysis_FreeBounds::GetClosedWires() const
|
||||
@@ -27,12 +28,11 @@ inline const TopoDS_Compound& ShapeAnalysis_FreeBounds::GetClosedWires() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetOpenWires
|
||||
//purpose :
|
||||
// function : GetOpenWires
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopoDS_Compound& ShapeAnalysis_FreeBounds::GetOpenWires() const
|
||||
{
|
||||
return myEdges;
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// 25.12.98 pdn renaming of ShapeAnalysis_FreeBounds and ShapeAnalysis_Wire methods
|
||||
//szv#4 S4163
|
||||
// szv#4 S4163
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
@@ -40,69 +40,74 @@
|
||||
#define NbControl 23
|
||||
|
||||
static void ContourProperties(const TopoDS_Wire& wire,
|
||||
Standard_Real& countourArea,
|
||||
Standard_Real& countourLength)
|
||||
Standard_Real& countourArea,
|
||||
Standard_Real& countourLength)
|
||||
{
|
||||
Standard_Integer nbe = 0;
|
||||
Standard_Real length = 0.0;
|
||||
gp_XYZ area(.0,.0,.0);
|
||||
gp_XYZ prev, cont;
|
||||
|
||||
for (BRepTools_WireExplorer exp(wire); exp.More(); exp.Next()) {
|
||||
Standard_Integer nbe = 0;
|
||||
Standard_Real length = 0.0;
|
||||
gp_XYZ area(.0, .0, .0);
|
||||
gp_XYZ prev, cont;
|
||||
|
||||
for (BRepTools_WireExplorer exp(wire); exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Edge& Edge = exp.Current();
|
||||
nbe++;
|
||||
|
||||
Standard_Real First, Last;
|
||||
Standard_Real First, Last;
|
||||
Handle(Geom_Curve) c3d;
|
||||
ShapeAnalysis_Edge sae;
|
||||
if (!sae.Curve3d(Edge,c3d,First,Last)) continue;
|
||||
|
||||
if (!sae.Curve3d(Edge, c3d, First, Last))
|
||||
continue;
|
||||
|
||||
Standard_Integer ibeg = 0;
|
||||
if ( nbe == 1 ) {
|
||||
if (nbe == 1)
|
||||
{
|
||||
gp_Pnt pntIni = c3d->Value(First);
|
||||
prev = pntIni.XYZ();
|
||||
cont = prev;
|
||||
ibeg = 1;
|
||||
prev = pntIni.XYZ();
|
||||
cont = prev;
|
||||
ibeg = 1;
|
||||
}
|
||||
|
||||
for ( Standard_Integer i = ibeg; i < NbControl; i++) {
|
||||
Standard_Real prm = ((NbControl-1-i)*First + i*Last)/(NbControl-1);
|
||||
gp_Pnt pntCurr = c3d->Value(prm);
|
||||
gp_XYZ curr = pntCurr.XYZ();
|
||||
gp_XYZ delta = curr - prev;
|
||||
for (Standard_Integer i = ibeg; i < NbControl; i++)
|
||||
{
|
||||
Standard_Real prm = ((NbControl - 1 - i) * First + i * Last) / (NbControl - 1);
|
||||
gp_Pnt pntCurr = c3d->Value(prm);
|
||||
gp_XYZ curr = pntCurr.XYZ();
|
||||
gp_XYZ delta = curr - prev;
|
||||
length += delta.Modulus();
|
||||
area += curr ^ prev;
|
||||
prev = curr;
|
||||
}
|
||||
}
|
||||
|
||||
area += cont ^ prev;
|
||||
countourArea = area.Modulus()/2;
|
||||
area += cont ^ prev;
|
||||
countourArea = area.Modulus() / 2;
|
||||
countourLength = length;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBoundsProperties
|
||||
//purpose : Empty constructor
|
||||
// function : ShapeAnalysis_FreeBoundsProperties
|
||||
// purpose : Empty constructor
|
||||
//=======================================================================
|
||||
|
||||
ShapeAnalysis_FreeBoundsProperties::ShapeAnalysis_FreeBoundsProperties()
|
||||
{
|
||||
myClosedFreeBounds = new ShapeAnalysis_HSequenceOfFreeBounds();
|
||||
myOpenFreeBounds = new ShapeAnalysis_HSequenceOfFreeBounds();
|
||||
myTolerance = 0.;
|
||||
myTolerance = 0.;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBoundsProperties
|
||||
//purpose : Creates the object and calls corresponding Init.
|
||||
// function : ShapeAnalysis_FreeBoundsProperties
|
||||
// purpose : Creates the object and calls corresponding Init.
|
||||
// <shape> should be a compound of faces.
|
||||
//=======================================================================
|
||||
|
||||
ShapeAnalysis_FreeBoundsProperties::ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
ShapeAnalysis_FreeBoundsProperties::ShapeAnalysis_FreeBoundsProperties(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
{
|
||||
myClosedFreeBounds = new ShapeAnalysis_HSequenceOfFreeBounds();
|
||||
myOpenFreeBounds = new ShapeAnalysis_HSequenceOfFreeBounds();
|
||||
@@ -110,57 +115,56 @@ ShapeAnalysis_FreeBoundsProperties::ShapeAnalysis_FreeBoundsProperties(const Top
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FreeBoundsProperties
|
||||
//purpose : Creates the object and calls corresponding Init.
|
||||
// function : ShapeAnalysis_FreeBoundsProperties
|
||||
// purpose : Creates the object and calls corresponding Init.
|
||||
// <shape> should be a compound of shells.
|
||||
//=======================================================================
|
||||
|
||||
ShapeAnalysis_FreeBoundsProperties::ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
ShapeAnalysis_FreeBoundsProperties::ShapeAnalysis_FreeBoundsProperties(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
{
|
||||
myClosedFreeBounds = new ShapeAnalysis_HSequenceOfFreeBounds();
|
||||
myOpenFreeBounds = new ShapeAnalysis_HSequenceOfFreeBounds();
|
||||
myTolerance =0.;
|
||||
myTolerance = 0.;
|
||||
Init(shape, splitclosed, splitopen);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose : Initializes the object with given parameters.
|
||||
// function : Init
|
||||
// purpose : Initializes the object with given parameters.
|
||||
// <shape> should be a compound of faces.
|
||||
//=======================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBoundsProperties::Init(const TopoDS_Shape& shape,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
void ShapeAnalysis_FreeBoundsProperties::Init(const TopoDS_Shape& shape,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
{
|
||||
Init(shape, splitclosed, splitopen);
|
||||
myTolerance = tolerance;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose : Initializes the object with given parameters.
|
||||
// function : Init
|
||||
// purpose : Initializes the object with given parameters.
|
||||
// <shape> should be a compound of shells.
|
||||
//=======================================================================
|
||||
|
||||
void ShapeAnalysis_FreeBoundsProperties::Init(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
void ShapeAnalysis_FreeBoundsProperties::Init(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed,
|
||||
const Standard_Boolean splitopen)
|
||||
{
|
||||
myShape = shape;
|
||||
myShape = shape;
|
||||
mySplitClosed = splitclosed;
|
||||
mySplitOpen = splitopen;
|
||||
mySplitOpen = splitopen;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Builds and analyzes free bounds of the shape.
|
||||
// First calls ShapeAnalysis_FreeBounds for building free
|
||||
// function : Perform
|
||||
// purpose : Builds and analyzes free bounds of the shape.
|
||||
// First calls ShapeAnalysis_FreeBounds for building free
|
||||
// bounds.
|
||||
// Then on each free bound computes its properties:
|
||||
// - area of the contour,
|
||||
@@ -169,76 +173,76 @@ void ShapeAnalysis_FreeBoundsProperties::Init(const TopoDS_Shape& shape,
|
||||
// - average width of contour,
|
||||
// - notches on the contour and for each notch
|
||||
// - maximum width of the notch.
|
||||
//returns: True - if no fails and free bounds are found,
|
||||
// returns: True - if no fails and free bounds are found,
|
||||
// False - if fail or no free bounds are found
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::Perform()
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::Perform()
|
||||
{
|
||||
Standard_Boolean result = Standard_False;
|
||||
result |= DispatchBounds();
|
||||
result |= CheckNotches();
|
||||
result |= CheckContours();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : DispatchBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::DispatchBounds()
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::DispatchBounds()
|
||||
{
|
||||
if (!IsLoaded()) return Standard_False;
|
||||
if (!IsLoaded())
|
||||
return Standard_False;
|
||||
|
||||
TopoDS_Compound tmpClosedBounds, tmpOpenBounds;
|
||||
if ( myTolerance > 0.) {
|
||||
if (myTolerance > 0.)
|
||||
{
|
||||
ShapeAnalysis_FreeBounds safb(myShape, myTolerance, mySplitClosed, mySplitOpen);
|
||||
tmpClosedBounds = safb.GetClosedWires();
|
||||
tmpOpenBounds = safb.GetOpenWires();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ShapeAnalysis_FreeBounds safb(myShape, mySplitClosed, mySplitOpen);
|
||||
tmpClosedBounds = safb.GetClosedWires();
|
||||
tmpOpenBounds = safb.GetOpenWires();
|
||||
}
|
||||
|
||||
ShapeExtend_Explorer shexpl;
|
||||
Handle(TopTools_HSequenceOfShape) tmpSeq = shexpl.SeqFromCompound(tmpClosedBounds,Standard_False);
|
||||
|
||||
ShapeExtend_Explorer shexpl;
|
||||
Handle(TopTools_HSequenceOfShape) tmpSeq =
|
||||
shexpl.SeqFromCompound(tmpClosedBounds, Standard_False);
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i<=tmpSeq->Length(); i++) {
|
||||
TopoDS_Wire wire = TopoDS::Wire(tmpSeq->Value(i));
|
||||
Handle(ShapeAnalysis_FreeBoundData) fbData= new ShapeAnalysis_FreeBoundData() ;
|
||||
for (i = 1; i <= tmpSeq->Length(); i++)
|
||||
{
|
||||
TopoDS_Wire wire = TopoDS::Wire(tmpSeq->Value(i));
|
||||
Handle(ShapeAnalysis_FreeBoundData) fbData = new ShapeAnalysis_FreeBoundData();
|
||||
fbData->SetFreeBound(wire);
|
||||
myClosedFreeBounds -> Append(fbData);
|
||||
}
|
||||
|
||||
Handle(TopTools_HSequenceOfShape) tmpSeq2 = shexpl.SeqFromCompound(tmpOpenBounds,Standard_False);
|
||||
for(i = 1; i<=tmpSeq2->Length(); i++) {
|
||||
TopoDS_Wire wire = TopoDS::Wire(tmpSeq2->Value(i));
|
||||
myClosedFreeBounds->Append(fbData);
|
||||
}
|
||||
|
||||
Handle(TopTools_HSequenceOfShape) tmpSeq2 = shexpl.SeqFromCompound(tmpOpenBounds, Standard_False);
|
||||
for (i = 1; i <= tmpSeq2->Length(); i++)
|
||||
{
|
||||
TopoDS_Wire wire = TopoDS::Wire(tmpSeq2->Value(i));
|
||||
Handle(ShapeAnalysis_FreeBoundData) fbData = new ShapeAnalysis_FreeBoundData;
|
||||
fbData->SetFreeBound(wire);
|
||||
myOpenFreeBounds -> Append(fbData);
|
||||
myOpenFreeBounds->Append(fbData);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckNotches
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckNotches(const Standard_Real prec)
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckNotches(const Standard_Real prec)
|
||||
{
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for(i = 1; i <= myClosedFreeBounds->Length(); i++) {
|
||||
for (i = 1; i <= myClosedFreeBounds->Length(); i++)
|
||||
{
|
||||
Handle(ShapeAnalysis_FreeBoundData) fbData = myClosedFreeBounds->Value(i);
|
||||
CheckNotches(fbData, prec);
|
||||
}
|
||||
for( i = 1; i <= myOpenFreeBounds->Length(); i++) {
|
||||
for (i = 1; i <= myOpenFreeBounds->Length(); i++)
|
||||
{
|
||||
Handle(ShapeAnalysis_FreeBoundData) fbData = myOpenFreeBounds->Value(i);
|
||||
CheckNotches(fbData, prec);
|
||||
}
|
||||
@@ -246,154 +250,157 @@ Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckNotches(const Standard
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckNotches
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckNotches(Handle(ShapeAnalysis_FreeBoundData)& fbData,
|
||||
const Standard_Real prec)
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckNotches(
|
||||
Handle(ShapeAnalysis_FreeBoundData)& fbData,
|
||||
const Standard_Real prec)
|
||||
{
|
||||
ShapeExtend_WireData swd(fbData->FreeBound());
|
||||
if (swd.NbEdges() > 1)
|
||||
for (Standard_Integer j=1; j <= swd.NbEdges(); j++) {
|
||||
TopoDS_Wire notch;
|
||||
for (Standard_Integer j = 1; j <= swd.NbEdges(); j++)
|
||||
{
|
||||
TopoDS_Wire notch;
|
||||
Standard_Real dMax;
|
||||
if (CheckNotches(fbData->FreeBound(), j, notch, dMax, prec))
|
||||
fbData->AddNotch(notch, dMax);
|
||||
fbData->AddNotch(notch, dMax);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckContours
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckContours(const Standard_Real prec)
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckContours(const Standard_Real prec)
|
||||
{
|
||||
Standard_Boolean status = Standard_False;
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for( i = 1; i <= myClosedFreeBounds->Length(); i++) {
|
||||
for (i = 1; i <= myClosedFreeBounds->Length(); i++)
|
||||
{
|
||||
Handle(ShapeAnalysis_FreeBoundData) fbData = myClosedFreeBounds->Value(i);
|
||||
status |= FillProperties(fbData,prec);
|
||||
status |= FillProperties(fbData, prec);
|
||||
}
|
||||
for ( i = 1; i <= myOpenFreeBounds->Length(); i++) {
|
||||
for (i = 1; i <= myOpenFreeBounds->Length(); i++)
|
||||
{
|
||||
Handle(ShapeAnalysis_FreeBoundData) fbData = myOpenFreeBounds->Value(i);
|
||||
status |= FillProperties(fbData,prec);
|
||||
status |= FillProperties(fbData, prec);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckNotches
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckNotches(const TopoDS_Wire& wire,
|
||||
const Standard_Integer num,
|
||||
TopoDS_Wire& notch,
|
||||
Standard_Real& distMax,
|
||||
const Standard_Real /*prec*/)
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::CheckNotches(const TopoDS_Wire& wire,
|
||||
const Standard_Integer num,
|
||||
TopoDS_Wire& notch,
|
||||
Standard_Real& distMax,
|
||||
const Standard_Real /*prec*/)
|
||||
{
|
||||
Standard_Real tol = Max ( myTolerance, Precision::Confusion());
|
||||
Standard_Real tol = Max(myTolerance, Precision::Confusion());
|
||||
Handle(ShapeExtend_WireData) wdt = new ShapeExtend_WireData(wire);
|
||||
BRep_Builder B;
|
||||
BRep_Builder B;
|
||||
B.MakeWire(notch);
|
||||
|
||||
if ( (num <= 0)||(num > wdt->NbEdges()) ) return Standard_False;
|
||||
|
||||
Standard_Integer n1 = ( num > 0 ? num : wdt->NbEdges() );
|
||||
Standard_Integer n2 = ( n1 < wdt->NbEdges() ? n1+1 : 1 );
|
||||
|
||||
|
||||
if ((num <= 0) || (num > wdt->NbEdges()))
|
||||
return Standard_False;
|
||||
|
||||
Standard_Integer n1 = (num > 0 ? num : wdt->NbEdges());
|
||||
Standard_Integer n2 = (n1 < wdt->NbEdges() ? n1 + 1 : 1);
|
||||
|
||||
TopoDS_Edge E1 = wdt->Edge(n1);
|
||||
B.Add(notch,E1);
|
||||
B.Add(notch, E1);
|
||||
|
||||
Handle(ShapeAnalysis_Wire) saw = new ShapeAnalysis_Wire;
|
||||
saw->Load(wdt);
|
||||
saw->SetPrecision(myTolerance);
|
||||
if ( saw->CheckSmall( n2, tol ) ) {
|
||||
B.Add(notch,wdt->Edge(n2));
|
||||
n2 = ( n2 < wdt->NbEdges() ? n2+1 : 1);
|
||||
if (saw->CheckSmall(n2, tol))
|
||||
{
|
||||
B.Add(notch, wdt->Edge(n2));
|
||||
n2 = (n2 < wdt->NbEdges() ? n2 + 1 : 1);
|
||||
}
|
||||
|
||||
TopoDS_Edge E2 = wdt->Edge(n2);
|
||||
B.Add(notch,E2);
|
||||
|
||||
Standard_Real First1, Last1, First2, Last2;
|
||||
B.Add(notch, E2);
|
||||
|
||||
Standard_Real First1, Last1, First2, Last2;
|
||||
Handle(Geom_Curve) c3d1, c3d2;
|
||||
ShapeAnalysis_Edge sae;
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if ( !sae.Curve3d(E1, c3d1, First1, Last1) ||
|
||||
!sae.Curve3d(E2, c3d2, First2, Last2) ) return Standard_False;
|
||||
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (!sae.Curve3d(E1, c3d1, First1, Last1) || !sae.Curve3d(E2, c3d2, First2, Last2))
|
||||
return Standard_False;
|
||||
|
||||
gp_Pnt pnt;
|
||||
gp_Vec vec1, vec2;
|
||||
c3d1->D1(Last1, pnt, vec1);
|
||||
c3d2->D1(First2,pnt, vec2);
|
||||
if ( E1.Orientation() == TopAbs_REVERSED ) vec1.Reverse();
|
||||
if ( E2.Orientation() == TopAbs_REVERSED ) vec2.Reverse();
|
||||
|
||||
Standard_Real angl = Abs( vec1.Angle(vec2));
|
||||
if (angl > 0.95*M_PI) {
|
||||
c3d2->D1(First2, pnt, vec2);
|
||||
if (E1.Orientation() == TopAbs_REVERSED)
|
||||
vec1.Reverse();
|
||||
if (E2.Orientation() == TopAbs_REVERSED)
|
||||
vec2.Reverse();
|
||||
|
||||
Standard_Real angl = Abs(vec1.Angle(vec2));
|
||||
if (angl > 0.95 * M_PI)
|
||||
{
|
||||
distMax = .0;
|
||||
for (Standard_Integer i = 0; i < NbControl; i++) {
|
||||
Standard_Real prm = ((NbControl-1-i)*First1 + i*Last1)/(NbControl-1);
|
||||
gp_Pnt pntCurr = c3d1->Value(prm);
|
||||
for (Standard_Integer i = 0; i < NbControl; i++)
|
||||
{
|
||||
Standard_Real prm = ((NbControl - 1 - i) * First1 + i * Last1) / (NbControl - 1);
|
||||
gp_Pnt pntCurr = c3d1->Value(prm);
|
||||
|
||||
Standard_Real p1, p2;
|
||||
if ( First2 < Last2 ) {
|
||||
p1 = First2;
|
||||
p2 = Last2;
|
||||
if (First2 < Last2)
|
||||
{
|
||||
p1 = First2;
|
||||
p2 = Last2;
|
||||
}
|
||||
else {
|
||||
p1 = Last2;
|
||||
p2 = First2;
|
||||
else
|
||||
{
|
||||
p1 = Last2;
|
||||
p2 = First2;
|
||||
}
|
||||
|
||||
//szv#4:S4163:12Mar99 warning
|
||||
// szv#4:S4163:12Mar99 warning
|
||||
GeomAPI_ProjectPointOnCurve ppc(pntCurr, c3d2, p1, p2);
|
||||
Standard_Real newDist = (ppc.NbPoints() ? ppc.LowerDistance() : 0);
|
||||
if ( newDist > distMax ) distMax = newDist;
|
||||
Standard_Real newDist = (ppc.NbPoints() ? ppc.LowerDistance() : 0);
|
||||
if (newDist > distMax)
|
||||
distMax = newDist;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : FillProperties
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::FillProperties(Handle(ShapeAnalysis_FreeBoundData)& fbData,
|
||||
const Standard_Real /*prec*/)
|
||||
{
|
||||
Standard_Boolean ShapeAnalysis_FreeBoundsProperties::FillProperties(
|
||||
Handle(ShapeAnalysis_FreeBoundData)& fbData,
|
||||
const Standard_Real /*prec*/)
|
||||
{
|
||||
Standard_Real area, length;
|
||||
ContourProperties(fbData->FreeBound(), area, length);
|
||||
|
||||
Standard_Real r = 0;
|
||||
Standard_Real r = 0;
|
||||
Standard_Real aver = 0;
|
||||
|
||||
if ( length != 0. ) { //szv#4:S4163:12Mar99 anti-exception
|
||||
Standard_Real k = area /(length*length); //szv#4:S4163:12Mar99
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if ( k != 0. ) { //szv#4:S4163:12Mar99 anti-exception
|
||||
Standard_Real aux = 1. - 16.*k;
|
||||
if ( aux >= 0.) {
|
||||
r = (1. + sqrt(aux))/(8.*k);
|
||||
aver = length/(2.*r);
|
||||
r -= 1.;
|
||||
if (length != 0.)
|
||||
{ // szv#4:S4163:12Mar99 anti-exception
|
||||
Standard_Real k = area / (length * length); // szv#4:S4163:12Mar99
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (k != 0.)
|
||||
{ // szv#4:S4163:12Mar99 anti-exception
|
||||
Standard_Real aux = 1. - 16. * k;
|
||||
if (aux >= 0.)
|
||||
{
|
||||
r = (1. + sqrt(aux)) / (8. * k);
|
||||
aver = length / (2. * r);
|
||||
r -= 1.;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fbData->SetArea(area);
|
||||
fbData->SetPerimeter(length);
|
||||
fbData->SetRatio(r);
|
||||
|
@@ -27,7 +27,6 @@
|
||||
class ShapeAnalysis_FreeBoundData;
|
||||
class TopoDS_Wire;
|
||||
|
||||
|
||||
//! This class is intended to calculate shape free bounds
|
||||
//! properties.
|
||||
//! This class provides the following functionalities:
|
||||
@@ -47,32 +46,42 @@ class TopoDS_Wire;
|
||||
//!
|
||||
//! Properties of each contour are stored in the data structure
|
||||
//! ShapeAnalysis_FreeBoundData.
|
||||
class ShapeAnalysis_FreeBoundsProperties
|
||||
class ShapeAnalysis_FreeBoundsProperties
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties();
|
||||
|
||||
|
||||
//! Creates the object and calls corresponding Init.
|
||||
//! <shape> should be a compound of faces.
|
||||
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Boolean splitclosed = Standard_False,
|
||||
const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
//! Creates the object and calls corresponding Init.
|
||||
//! <shape> should be a compound of shells.
|
||||
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed = Standard_False,
|
||||
const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
//! Initializes the object with given parameters.
|
||||
//! <shape> should be a compound of faces.
|
||||
Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
Standard_EXPORT void Init(const TopoDS_Shape& shape,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Boolean splitclosed = Standard_False,
|
||||
const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
//! Initializes the object with given parameters.
|
||||
//! <shape> should be a compound of shells.
|
||||
Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
Standard_EXPORT void Init(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean splitclosed = Standard_False,
|
||||
const Standard_Boolean splitopen = Standard_False);
|
||||
|
||||
//! Builds and analyzes free bounds of the shape.
|
||||
//! First calls ShapeAnalysis_FreeBounds for building free
|
||||
//! bounds.
|
||||
@@ -84,79 +93,67 @@ public:
|
||||
//! - notches on the contour and for each notch
|
||||
//! - maximum width of the notch.
|
||||
Standard_EXPORT Standard_Boolean Perform();
|
||||
|
||||
|
||||
//! Returns True if shape is loaded
|
||||
Standard_Boolean IsLoaded() const;
|
||||
|
||||
Standard_Boolean IsLoaded() const;
|
||||
|
||||
//! Returns shape
|
||||
TopoDS_Shape Shape() const;
|
||||
|
||||
TopoDS_Shape Shape() const;
|
||||
|
||||
//! Returns tolerance
|
||||
Standard_Real Tolerance() const;
|
||||
|
||||
Standard_Real Tolerance() const;
|
||||
|
||||
//! Returns number of free bounds
|
||||
Standard_Integer NbFreeBounds() const;
|
||||
|
||||
Standard_Integer NbFreeBounds() const;
|
||||
|
||||
//! Returns number of closed free bounds
|
||||
Standard_Integer NbClosedFreeBounds() const;
|
||||
|
||||
Standard_Integer NbClosedFreeBounds() const;
|
||||
|
||||
//! Returns number of open free bounds
|
||||
Standard_Integer NbOpenFreeBounds() const;
|
||||
|
||||
Standard_Integer NbOpenFreeBounds() const;
|
||||
|
||||
//! Returns all closed free bounds
|
||||
Handle(ShapeAnalysis_HSequenceOfFreeBounds) ClosedFreeBounds() const;
|
||||
|
||||
Handle(ShapeAnalysis_HSequenceOfFreeBounds) ClosedFreeBounds() const;
|
||||
|
||||
//! Returns all open free bounds
|
||||
Handle(ShapeAnalysis_HSequenceOfFreeBounds) OpenFreeBounds() const;
|
||||
|
||||
Handle(ShapeAnalysis_HSequenceOfFreeBounds) OpenFreeBounds() const;
|
||||
|
||||
//! Returns properties of closed free bound specified by its rank
|
||||
//! number
|
||||
Handle(ShapeAnalysis_FreeBoundData) ClosedFreeBound (const Standard_Integer index) const;
|
||||
|
||||
Handle(ShapeAnalysis_FreeBoundData) ClosedFreeBound(const Standard_Integer index) const;
|
||||
|
||||
//! Returns properties of open free bound specified by its rank
|
||||
//! number
|
||||
Handle(ShapeAnalysis_FreeBoundData) OpenFreeBound (const Standard_Integer index) const;
|
||||
|
||||
Handle(ShapeAnalysis_FreeBoundData) OpenFreeBound(const Standard_Integer index) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean DispatchBounds();
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckContours (const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckNotches (const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckNotches (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckNotches (const TopoDS_Wire& freebound, const Standard_Integer num, TopoDS_Wire& notch, Standard_Real& distMax, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean FillProperties (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckContours(const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckNotches(const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckNotches(Handle(ShapeAnalysis_FreeBoundData)& fbData,
|
||||
const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckNotches(const TopoDS_Wire& freebound,
|
||||
const Standard_Integer num,
|
||||
TopoDS_Wire& notch,
|
||||
Standard_Real& distMax,
|
||||
const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean FillProperties(Handle(ShapeAnalysis_FreeBoundData)& fbData,
|
||||
const Standard_Real prec = 0.0);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TopoDS_Shape myShape;
|
||||
Standard_Real myTolerance;
|
||||
Standard_Boolean mySplitClosed;
|
||||
Standard_Boolean mySplitOpen;
|
||||
TopoDS_Shape myShape;
|
||||
Standard_Real myTolerance;
|
||||
Standard_Boolean mySplitClosed;
|
||||
Standard_Boolean mySplitOpen;
|
||||
Handle(ShapeAnalysis_HSequenceOfFreeBounds) myClosedFreeBounds;
|
||||
Handle(ShapeAnalysis_HSequenceOfFreeBounds) myOpenFreeBounds;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <ShapeAnalysis_FreeBoundsProperties.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_FreeBoundsProperties_HeaderFile
|
||||
|
@@ -17,111 +17,107 @@
|
||||
#include <ShapeAnalysis_HSequenceOfFreeBounds.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose : Returns shape
|
||||
// function : Shape
|
||||
// purpose : Returns shape
|
||||
//=======================================================================
|
||||
|
||||
inline TopoDS_Shape ShapeAnalysis_FreeBoundsProperties::Shape() const
|
||||
inline TopoDS_Shape ShapeAnalysis_FreeBoundsProperties::Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsLoaded
|
||||
//purpose : Returns True if shape is loaded
|
||||
// function : IsLoaded
|
||||
// purpose : Returns True if shape is loaded
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_FreeBoundsProperties::IsLoaded() const
|
||||
inline Standard_Boolean ShapeAnalysis_FreeBoundsProperties::IsLoaded() const
|
||||
{
|
||||
return !(myShape.IsNull());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tolerance
|
||||
//purpose : Returns tolerance
|
||||
// function : Tolerance
|
||||
// purpose : Returns tolerance
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_FreeBoundsProperties::Tolerance() const
|
||||
inline Standard_Real ShapeAnalysis_FreeBoundsProperties::Tolerance() const
|
||||
{
|
||||
return myTolerance;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFreeBounds
|
||||
//purpose : Returns number of free bounds
|
||||
// function : NbFreeBounds
|
||||
// purpose : Returns number of free bounds
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer ShapeAnalysis_FreeBoundsProperties::NbFreeBounds() const
|
||||
inline Standard_Integer ShapeAnalysis_FreeBoundsProperties::NbFreeBounds() const
|
||||
{
|
||||
return (myClosedFreeBounds->Length() + myOpenFreeBounds->Length());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbClosedFreeBounds
|
||||
//purpose : Returns number of closed free bounds
|
||||
// function : NbClosedFreeBounds
|
||||
// purpose : Returns number of closed free bounds
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer ShapeAnalysis_FreeBoundsProperties::NbClosedFreeBounds() const
|
||||
inline Standard_Integer ShapeAnalysis_FreeBoundsProperties::NbClosedFreeBounds() const
|
||||
{
|
||||
return myClosedFreeBounds->Length();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbOpenFreeBounds
|
||||
//purpose : Returns number of open free bounds
|
||||
// function : NbOpenFreeBounds
|
||||
// purpose : Returns number of open free bounds
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer ShapeAnalysis_FreeBoundsProperties::NbOpenFreeBounds() const
|
||||
inline Standard_Integer ShapeAnalysis_FreeBoundsProperties::NbOpenFreeBounds() const
|
||||
{
|
||||
return myOpenFreeBounds->Length();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ClosedFreeBounds
|
||||
//purpose : Returns all closed free bounds
|
||||
// function : ClosedFreeBounds
|
||||
// purpose : Returns all closed free bounds
|
||||
//=======================================================================
|
||||
|
||||
inline Handle(ShapeAnalysis_HSequenceOfFreeBounds) ShapeAnalysis_FreeBoundsProperties::ClosedFreeBounds() const
|
||||
inline Handle(ShapeAnalysis_HSequenceOfFreeBounds) ShapeAnalysis_FreeBoundsProperties::
|
||||
ClosedFreeBounds() const
|
||||
{
|
||||
return myClosedFreeBounds;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenFreeBounds
|
||||
//purpose : Returns all open free bounds
|
||||
// function : OpenFreeBounds
|
||||
// purpose : Returns all open free bounds
|
||||
//=======================================================================
|
||||
|
||||
inline Handle(ShapeAnalysis_HSequenceOfFreeBounds) ShapeAnalysis_FreeBoundsProperties::OpenFreeBounds() const
|
||||
inline Handle(ShapeAnalysis_HSequenceOfFreeBounds) ShapeAnalysis_FreeBoundsProperties::
|
||||
OpenFreeBounds() const
|
||||
{
|
||||
return myOpenFreeBounds;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClosedFreeBound
|
||||
//purpose : Returns properties of closed free bound specified by its rank
|
||||
// function : ClosedFreeBound
|
||||
// purpose : Returns properties of closed free bound specified by its rank
|
||||
// number
|
||||
//=======================================================================
|
||||
|
||||
inline Handle(ShapeAnalysis_FreeBoundData) ShapeAnalysis_FreeBoundsProperties::ClosedFreeBound(const Standard_Integer index) const
|
||||
inline Handle(ShapeAnalysis_FreeBoundData) ShapeAnalysis_FreeBoundsProperties::ClosedFreeBound(
|
||||
const Standard_Integer index) const
|
||||
{
|
||||
return myClosedFreeBounds->Value(index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OpenFreeBound
|
||||
//purpose : Returns properties of open free bound specified by its rank
|
||||
// function : OpenFreeBound
|
||||
// purpose : Returns properties of open free bound specified by its rank
|
||||
// number
|
||||
//=======================================================================
|
||||
|
||||
inline Handle(ShapeAnalysis_FreeBoundData) ShapeAnalysis_FreeBoundsProperties::OpenFreeBound(const Standard_Integer index) const
|
||||
inline Handle(ShapeAnalysis_FreeBoundData) ShapeAnalysis_FreeBoundsProperties::OpenFreeBound(
|
||||
const Standard_Integer index) const
|
||||
{
|
||||
return myOpenFreeBounds->Value(index);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//szv#4 S4163
|
||||
// szv#4 S4163
|
||||
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
@@ -24,31 +24,30 @@
|
||||
#include <ShapeAnalysis_Geom.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : NearestPlane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_Geom::NearestPlane(const TColgp_Array1OfPnt& Pnts,
|
||||
gp_Pln& aPln, Standard_Real& Dmax)
|
||||
gp_Pln& aPln,
|
||||
Standard_Real& Dmax)
|
||||
{
|
||||
//szv#4:S4163:12Mar99 warning
|
||||
// szv#4:S4163:12Mar99 warning
|
||||
GProp_PGProps Pmat(Pnts);
|
||||
gp_Pnt g = Pmat.CentreOfMass();
|
||||
Standard_Real Xg,Yg,Zg;
|
||||
g.Coord(Xg,Yg,Zg);
|
||||
gp_Pnt g = Pmat.CentreOfMass();
|
||||
Standard_Real Xg, Yg, Zg;
|
||||
g.Coord(Xg, Yg, Zg);
|
||||
|
||||
GProp_PrincipalProps Pp = Pmat.PrincipalProperties();
|
||||
gp_Vec V1 = Pp.FirstAxisOfInertia();
|
||||
Standard_Real Xv1,Yv1,Zv1;
|
||||
V1.Coord(Xv1,Yv1,Zv1);
|
||||
gp_Vec V2 = Pp.SecondAxisOfInertia();
|
||||
Standard_Real Xv2,Yv2,Zv2;
|
||||
V2.Coord(Xv2,Yv2,Zv2);
|
||||
gp_Vec V3 = Pp.ThirdAxisOfInertia();
|
||||
Standard_Real Xv3,Yv3,Zv3;
|
||||
V3.Coord(Xv3,Yv3,Zv3);
|
||||
gp_Vec V1 = Pp.FirstAxisOfInertia();
|
||||
Standard_Real Xv1, Yv1, Zv1;
|
||||
V1.Coord(Xv1, Yv1, Zv1);
|
||||
gp_Vec V2 = Pp.SecondAxisOfInertia();
|
||||
Standard_Real Xv2, Yv2, Zv2;
|
||||
V2.Coord(Xv2, Yv2, Zv2);
|
||||
gp_Vec V3 = Pp.ThirdAxisOfInertia();
|
||||
Standard_Real Xv3, Yv3, Zv3;
|
||||
V3.Coord(Xv3, Yv3, Zv3);
|
||||
|
||||
Standard_Real D,X,Y,Z;
|
||||
Standard_Real D, X, Y, Z;
|
||||
Standard_Real Dmx1 = RealFirst();
|
||||
Standard_Real Dmn1 = RealLast();
|
||||
Standard_Real Dmx2 = RealFirst();
|
||||
@@ -58,129 +57,147 @@ Standard_Boolean ShapeAnalysis_Geom::NearestPlane(const TColgp_Array1OfPnt& Pnts
|
||||
|
||||
Standard_Integer ilow = Pnts.Lower(), iup = Pnts.Upper();
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = ilow; i <= iup; i ++) {
|
||||
Pnts(i).Coord(X,Y,Z);
|
||||
D = (X-Xg)*Xv1 +(Y-Yg)*Yv1 + (Z-Zg)*Zv1;
|
||||
if (D > Dmx1) Dmx1 = D;
|
||||
if (D < Dmn1) Dmn1 = D;
|
||||
D = (X-Xg)*Xv2 +(Y-Yg)*Yv2 + (Z-Zg)*Zv2;
|
||||
if (D > Dmx2) Dmx2 = D;
|
||||
if (D < Dmn2) Dmn2 = D;
|
||||
D = (X-Xg)*Xv3 +(Y-Yg)*Yv3 + (Z-Zg)*Zv3;
|
||||
if (D > Dmx3) Dmx3 = D;
|
||||
if (D < Dmn3) Dmn3 = D;
|
||||
for (i = ilow; i <= iup; i++)
|
||||
{
|
||||
Pnts(i).Coord(X, Y, Z);
|
||||
D = (X - Xg) * Xv1 + (Y - Yg) * Yv1 + (Z - Zg) * Zv1;
|
||||
if (D > Dmx1)
|
||||
Dmx1 = D;
|
||||
if (D < Dmn1)
|
||||
Dmn1 = D;
|
||||
D = (X - Xg) * Xv2 + (Y - Yg) * Yv2 + (Z - Zg) * Zv2;
|
||||
if (D > Dmx2)
|
||||
Dmx2 = D;
|
||||
if (D < Dmn2)
|
||||
Dmn2 = D;
|
||||
D = (X - Xg) * Xv3 + (Y - Yg) * Yv3 + (Z - Zg) * Zv3;
|
||||
if (D > Dmx3)
|
||||
Dmx3 = D;
|
||||
if (D < Dmn3)
|
||||
Dmn3 = D;
|
||||
}
|
||||
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
Standard_Real Dev1 = Dmx1-Dmn1, Dev2 = Dmx2-Dmn2, Dev3 = Dmx3-Dmn3;
|
||||
Standard_Integer It = (Dev1 < Dev2)? ((Dev1 < Dev3)? 1 : 3) : ((Dev2 < Dev3)? 2 : 3);
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
Standard_Real Dev1 = Dmx1 - Dmn1, Dev2 = Dmx2 - Dmn2, Dev3 = Dmx3 - Dmn3;
|
||||
Standard_Integer It = (Dev1 < Dev2) ? ((Dev1 < Dev3) ? 1 : 3) : ((Dev2 < Dev3) ? 2 : 3);
|
||||
|
||||
switch (It) {
|
||||
case 1:
|
||||
{
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if ((2.*Dev1 > Dev2) || (2.*Dev1 > Dev3)) It = 0;
|
||||
else aPln = gp_Pln(g,V1);
|
||||
break;
|
||||
switch (It)
|
||||
{
|
||||
case 1: {
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if ((2. * Dev1 > Dev2) || (2. * Dev1 > Dev3))
|
||||
It = 0;
|
||||
else
|
||||
aPln = gp_Pln(g, V1);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if ((2.*Dev2 > Dev1) || (2.*Dev2 > Dev3)) It = 0;
|
||||
else aPln = gp_Pln(g,V2);
|
||||
break;
|
||||
case 2: {
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if ((2. * Dev2 > Dev1) || (2. * Dev2 > Dev3))
|
||||
It = 0;
|
||||
else
|
||||
aPln = gp_Pln(g, V2);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if ((2.*Dev3 > Dev2) || (2.*Dev3 > Dev1)) It = 0;
|
||||
else aPln = gp_Pln(g,V3);
|
||||
break;
|
||||
case 3: {
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if ((2. * Dev3 > Dev2) || (2. * Dev3 > Dev1))
|
||||
It = 0;
|
||||
else
|
||||
aPln = gp_Pln(g, V3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Dmax = RealFirst();
|
||||
if ( It != 0 ) //szv#4:S4163:12Mar99 anti-exception
|
||||
for (i = ilow; i <= iup; i ++) {
|
||||
D = aPln.Distance (Pnts(i));
|
||||
if (Dmax < D) Dmax = D;
|
||||
if (It != 0) // szv#4:S4163:12Mar99 anti-exception
|
||||
for (i = ilow; i <= iup; i++)
|
||||
{
|
||||
D = aPln.Distance(Pnts(i));
|
||||
if (Dmax < D)
|
||||
Dmax = D;
|
||||
}
|
||||
|
||||
return (It != 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PositionTrsf
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_Geom::PositionTrsf(const Handle(TColStd_HArray2OfReal)& coefs,gp_Trsf& trsf,
|
||||
const Standard_Real unit,const Standard_Real prec)
|
||||
Standard_Boolean ShapeAnalysis_Geom::PositionTrsf(const Handle(TColStd_HArray2OfReal)& coefs,
|
||||
gp_Trsf& trsf,
|
||||
const Standard_Real unit,
|
||||
const Standard_Real prec)
|
||||
{
|
||||
Standard_Boolean result = Standard_True;
|
||||
|
||||
trsf = gp_Trsf(); //szv#4:S4163:12Mar99 moved
|
||||
trsf = gp_Trsf(); // szv#4:S4163:12Mar99 moved
|
||||
|
||||
if (coefs.IsNull()) return Standard_True; //szv#4:S4163:12Mar99 moved
|
||||
if (coefs.IsNull())
|
||||
return Standard_True; // szv#4:S4163:12Mar99 moved
|
||||
|
||||
gp_GTrsf gtrsf;
|
||||
for (Standard_Integer i = 1; i <= 3; i ++)
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
{
|
||||
for (Standard_Integer j = 1; j <= 4; j ++)
|
||||
for (Standard_Integer j = 1; j <= 4; j++)
|
||||
{
|
||||
gtrsf.SetValue (i,j, coefs->Value(i,j));
|
||||
gtrsf.SetValue(i, j, coefs->Value(i, j));
|
||||
}
|
||||
}
|
||||
|
||||
//try { //szv#4:S4163:12Mar99 waste try
|
||||
//// trsf = gtrsf.Trsf();
|
||||
// --- Prec et Unit ont ete lues suite aux StepFile_Read
|
||||
// Valables pour tous les composants d un assemblage transmis
|
||||
//trsf = gp_Trsf(); // Identite forcee au depart //szv#4:S4163:12Mar99 not needed
|
||||
// On prend le contenu de <gtrsf>. Attention a l adressage
|
||||
gp_XYZ v1 ( gtrsf.Value(1,1), gtrsf.Value(2,1), gtrsf.Value(3,1) );
|
||||
gp_XYZ v2 ( gtrsf.Value(1,2), gtrsf.Value(2,2), gtrsf.Value(3,2) );
|
||||
gp_XYZ v3 ( gtrsf.Value(1,3), gtrsf.Value(2,3), gtrsf.Value(3,3) );
|
||||
// A-t-on affaire a une similitude ?
|
||||
Standard_Real m1 = v1.Modulus();
|
||||
Standard_Real m2 = v2.Modulus();
|
||||
Standard_Real m3 = v3.Modulus();
|
||||
// try { //szv#4:S4163:12Mar99 waste try
|
||||
//// trsf = gtrsf.Trsf();
|
||||
// --- Prec et Unit ont ete lues suite aux StepFile_Read
|
||||
// Valables pour tous les composants d un assemblage transmis
|
||||
// trsf = gp_Trsf(); // Identite forcee au depart //szv#4:S4163:12Mar99 not needed
|
||||
// On prend le contenu de <gtrsf>. Attention a l adressage
|
||||
gp_XYZ v1(gtrsf.Value(1, 1), gtrsf.Value(2, 1), gtrsf.Value(3, 1));
|
||||
gp_XYZ v2(gtrsf.Value(1, 2), gtrsf.Value(2, 2), gtrsf.Value(3, 2));
|
||||
gp_XYZ v3(gtrsf.Value(1, 3), gtrsf.Value(2, 3), gtrsf.Value(3, 3));
|
||||
// A-t-on affaire a une similitude ?
|
||||
Standard_Real m1 = v1.Modulus();
|
||||
Standard_Real m2 = v2.Modulus();
|
||||
Standard_Real m3 = v3.Modulus();
|
||||
|
||||
// D abord est-elle singuliere cette matrice ?
|
||||
if (m1 < prec || m2 < prec || m3 < prec) return Standard_False;
|
||||
Standard_Real mm = (m1+m2+m3)/3.; // voici la Norme moyenne, cf Scale
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
Standard_Real pmm = prec*mm;
|
||||
if ( Abs(m1 - mm) > pmm || Abs(m2 - mm) > pmm || Abs(m3 - mm) > pmm )
|
||||
return Standard_False;
|
||||
//szv#4:S4163:12Mar99 warning
|
||||
v1.Divide(m1);
|
||||
v2.Divide(m2);
|
||||
v3.Divide(m3);
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if ( Abs(v1.Dot(v2)) > prec || Abs(v2.Dot(v3)) > prec || Abs(v3.Dot(v1)) > prec )
|
||||
return Standard_False;
|
||||
// D abord est-elle singuliere cette matrice ?
|
||||
if (m1 < prec || m2 < prec || m3 < prec)
|
||||
return Standard_False;
|
||||
Standard_Real mm = (m1 + m2 + m3) / 3.; // voici la Norme moyenne, cf Scale
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
Standard_Real pmm = prec * mm;
|
||||
if (Abs(m1 - mm) > pmm || Abs(m2 - mm) > pmm || Abs(m3 - mm) > pmm)
|
||||
return Standard_False;
|
||||
// szv#4:S4163:12Mar99 warning
|
||||
v1.Divide(m1);
|
||||
v2.Divide(m2);
|
||||
v3.Divide(m3);
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (Abs(v1.Dot(v2)) > prec || Abs(v2.Dot(v3)) > prec || Abs(v3.Dot(v1)) > prec)
|
||||
return Standard_False;
|
||||
|
||||
// Ici, Orthogonale et memes normes. En plus on l a Normee
|
||||
// On isole le cas de l Identite (tellement facile et avantageux)
|
||||
if (v1.X() != 1 || v1.Y() != 0 || v1.Z() != 0 ||
|
||||
v2.X() != 0 || v2.Y() != 1 || v2.Z() != 0 ||
|
||||
v3.X() != 0 || v3.Y() != 0 || v3.Z() != 1 ) {
|
||||
// Pas Identite : vraie construction depuis un Ax3
|
||||
gp_Dir d1(v1);
|
||||
gp_Dir d2(v2);
|
||||
gp_Dir d3(v3);
|
||||
gp_Ax3 axes (gp_Pnt(0,0,0),d3,d1);
|
||||
d3.Cross(d1);
|
||||
if (d3.Dot(d2) < 0) axes.YReverse();
|
||||
trsf.SetTransformation(axes);
|
||||
}
|
||||
// Ici, Orthogonale et memes normes. En plus on l a Normee
|
||||
// On isole le cas de l Identite (tellement facile et avantageux)
|
||||
if (v1.X() != 1 || v1.Y() != 0 || v1.Z() != 0 || v2.X() != 0 || v2.Y() != 1 || v2.Z() != 0
|
||||
|| v3.X() != 0 || v3.Y() != 0 || v3.Z() != 1)
|
||||
{
|
||||
// Pas Identite : vraie construction depuis un Ax3
|
||||
gp_Dir d1(v1);
|
||||
gp_Dir d2(v2);
|
||||
gp_Dir d3(v3);
|
||||
gp_Ax3 axes(gp_Pnt(0, 0, 0), d3, d1);
|
||||
d3.Cross(d1);
|
||||
if (d3.Dot(d2) < 0)
|
||||
axes.YReverse();
|
||||
trsf.SetTransformation(axes);
|
||||
}
|
||||
|
||||
// Restent les autres caracteristiques :
|
||||
if ( Abs(mm - 1.) > prec ) trsf.SetScale(gp_Pnt(0,0,0), mm); //szv#4:S4163:12Mar99 optimized
|
||||
gp_Vec tp (gtrsf.TranslationPart());
|
||||
if (unit != 1.) tp.Multiply(unit);
|
||||
if (tp.X() != 0 || tp.Y() != 0 || tp.Z() != 0) trsf.SetTranslationPart(tp);
|
||||
// Restent les autres caracteristiques :
|
||||
if (Abs(mm - 1.) > prec)
|
||||
trsf.SetScale(gp_Pnt(0, 0, 0), mm); // szv#4:S4163:12Mar99 optimized
|
||||
gp_Vec tp(gtrsf.TranslationPart());
|
||||
if (unit != 1.)
|
||||
tp.Multiply(unit);
|
||||
if (tp.X() != 0 || tp.Y() != 0 || tp.Z() != 0)
|
||||
trsf.SetTranslationPart(tp);
|
||||
/* }
|
||||
catch(Standard_Failure) {
|
||||
trsf = gp_Trsf();
|
||||
|
@@ -26,46 +26,29 @@
|
||||
class gp_Pln;
|
||||
class gp_Trsf;
|
||||
|
||||
|
||||
//! Analyzing tool aimed to work on primitive geometrical objects
|
||||
class ShapeAnalysis_Geom
|
||||
class ShapeAnalysis_Geom
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Builds a plane out of a set of points in array
|
||||
//! Returns in <dmax> the maximal distance between the produced
|
||||
//! plane and given points
|
||||
Standard_EXPORT static Standard_Boolean NearestPlane (const TColgp_Array1OfPnt& Pnts, gp_Pln& aPln, Standard_Real& Dmax);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean NearestPlane(const TColgp_Array1OfPnt& Pnts,
|
||||
gp_Pln& aPln,
|
||||
Standard_Real& Dmax);
|
||||
|
||||
//! Builds transformation object out of matrix.
|
||||
//! Matrix must be 3 x 4.
|
||||
//! Unit is used as multiplier.
|
||||
Standard_EXPORT static Standard_Boolean PositionTrsf (const Handle(TColStd_HArray2OfReal)& coefs, gp_Trsf& trsf, const Standard_Real unit, const Standard_Real prec);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Boolean PositionTrsf(const Handle(TColStd_HArray2OfReal)& coefs,
|
||||
gp_Trsf& trsf,
|
||||
const Standard_Real unit,
|
||||
const Standard_Real prec);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_Geom_HeaderFile
|
||||
|
@@ -22,5 +22,4 @@
|
||||
|
||||
DEFINE_HSEQUENCE(ShapeAnalysis_HSequenceOfFreeBounds, ShapeAnalysis_SequenceOfFreeBounds)
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <ShapeAnalysis_FreeBoundData.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
typedef NCollection_Sequence<Handle(ShapeAnalysis_FreeBoundData)> ShapeAnalysis_SequenceOfFreeBounds;
|
||||
|
||||
typedef NCollection_Sequence<Handle(ShapeAnalysis_FreeBoundData)>
|
||||
ShapeAnalysis_SequenceOfFreeBounds;
|
||||
|
||||
#endif
|
||||
|
@@ -14,7 +14,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//szv#4 S4163
|
||||
// szv#4 S4163
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
@@ -43,52 +43,52 @@
|
||||
|
||||
ShapeAnalysis_ShapeContents::ShapeAnalysis_ShapeContents()
|
||||
{
|
||||
myBigSplineSec = new TopTools_HSequenceOfShape;
|
||||
myIndirectSec = new TopTools_HSequenceOfShape;
|
||||
myBigSplineSec = new TopTools_HSequenceOfShape;
|
||||
myIndirectSec = new TopTools_HSequenceOfShape;
|
||||
myOffsetSurfaceSec = new TopTools_HSequenceOfShape;
|
||||
myTrimmed3dSec = new TopTools_HSequenceOfShape;
|
||||
myOffsetCurveSec = new TopTools_HSequenceOfShape;
|
||||
myTrimmed2dSec = new TopTools_HSequenceOfShape;
|
||||
myTrimmed3dSec = new TopTools_HSequenceOfShape;
|
||||
myOffsetCurveSec = new TopTools_HSequenceOfShape;
|
||||
myTrimmed2dSec = new TopTools_HSequenceOfShape;
|
||||
ClearFlags();
|
||||
}
|
||||
|
||||
void ShapeAnalysis_ShapeContents::Clear()
|
||||
{
|
||||
myNbSolids = 0;
|
||||
myNbShells = 0;
|
||||
myNbFaces = 0;
|
||||
myNbWires = 0;
|
||||
myNbEdges = 0;
|
||||
myNbVertices = 0;
|
||||
myNbSolidsWithVoids = 0;
|
||||
myNbBigSplines = 0;
|
||||
myNbC0Surfaces = 0;
|
||||
myNbC0Curves = 0;
|
||||
myNbOffsetSurf = 0;
|
||||
myNbIndirectSurf = 0;
|
||||
myNbOffsetCurves = 0;
|
||||
myNbTrimmedCurve2d = 0;
|
||||
myNbTrimmedCurve3d =0;
|
||||
myNbBSplibeSurf = 0;
|
||||
myNbBezierSurf = 0;
|
||||
myNbTrimSurf = 0;
|
||||
myNbWireWitnSeam = 0;
|
||||
myNbSolids = 0;
|
||||
myNbShells = 0;
|
||||
myNbFaces = 0;
|
||||
myNbWires = 0;
|
||||
myNbEdges = 0;
|
||||
myNbVertices = 0;
|
||||
myNbSolidsWithVoids = 0;
|
||||
myNbBigSplines = 0;
|
||||
myNbC0Surfaces = 0;
|
||||
myNbC0Curves = 0;
|
||||
myNbOffsetSurf = 0;
|
||||
myNbIndirectSurf = 0;
|
||||
myNbOffsetCurves = 0;
|
||||
myNbTrimmedCurve2d = 0;
|
||||
myNbTrimmedCurve3d = 0;
|
||||
myNbBSplibeSurf = 0;
|
||||
myNbBezierSurf = 0;
|
||||
myNbTrimSurf = 0;
|
||||
myNbWireWitnSeam = 0;
|
||||
myNbWireWithSevSeams = 0;
|
||||
myNbFaceWithSevWires = 0;
|
||||
myNbNoPCurve = 0;
|
||||
myNbFreeFaces = 0;
|
||||
myNbFreeWires = 0;
|
||||
myNbFreeEdges = 0;
|
||||
|
||||
myNbSharedSolids = 0;
|
||||
myNbSharedShells = 0;
|
||||
myNbSharedFaces = 0;
|
||||
myNbSharedWires = 0;
|
||||
myNbNoPCurve = 0;
|
||||
myNbFreeFaces = 0;
|
||||
myNbFreeWires = 0;
|
||||
myNbFreeEdges = 0;
|
||||
|
||||
myNbSharedSolids = 0;
|
||||
myNbSharedShells = 0;
|
||||
myNbSharedFaces = 0;
|
||||
myNbSharedWires = 0;
|
||||
myNbSharedFreeWires = 0;
|
||||
myNbSharedFreeEdges = 0;
|
||||
myNbSharedEdges = 0;
|
||||
myNbSharedVertices = 0;
|
||||
|
||||
myNbSharedEdges = 0;
|
||||
myNbSharedVertices = 0;
|
||||
|
||||
myBigSplineSec->Clear();
|
||||
myIndirectSec->Clear();
|
||||
myOffsetSurfaceSec->Clear();
|
||||
@@ -97,191 +97,226 @@ void ShapeAnalysis_ShapeContents::Clear()
|
||||
myTrimmed2dSec->Clear();
|
||||
}
|
||||
|
||||
|
||||
void ShapeAnalysis_ShapeContents::ClearFlags()
|
||||
{
|
||||
myBigSplineMode = Standard_False;
|
||||
myIndirectMode = Standard_False;
|
||||
myBigSplineMode = Standard_False;
|
||||
myIndirectMode = Standard_False;
|
||||
myOffsetSurfaceMode = Standard_False;
|
||||
myTrimmed3dMode = Standard_False;
|
||||
myOffsetCurveMode = Standard_False;
|
||||
myTrimmed2dMode = Standard_False;
|
||||
myTrimmed3dMode = Standard_False;
|
||||
myOffsetCurveMode = Standard_False;
|
||||
myTrimmed2dMode = Standard_False;
|
||||
}
|
||||
|
||||
|
||||
void ShapeAnalysis_ShapeContents::Perform(const TopoDS_Shape& Shape)
|
||||
{
|
||||
Clear();
|
||||
// On y va
|
||||
TopExp_Explorer exp;
|
||||
TopExp_Explorer exp;
|
||||
TopTools_MapOfShape mapsh;
|
||||
// On note pour les SOLIDES : ceux qui ont des trous (plus d un SHELL)
|
||||
|
||||
for (exp.Init (Shape,TopAbs_SOLID); exp.More(); exp.Next()) {
|
||||
TopoDS_Solid sol = TopoDS::Solid (exp.Current());
|
||||
// On note pour les SOLIDES : ceux qui ont des trous (plus d un SHELL)
|
||||
|
||||
for (exp.Init(Shape, TopAbs_SOLID); exp.More(); exp.Next())
|
||||
{
|
||||
TopoDS_Solid sol = TopoDS::Solid(exp.Current());
|
||||
sol.Location(TopLoc_Location());
|
||||
mapsh.Add(sol);
|
||||
Standard_Integer nbs = 0;
|
||||
for (TopExp_Explorer shel (sol,TopAbs_SHELL); shel.More(); shel.Next())
|
||||
nbs ++;
|
||||
if (nbs > 1) myNbSolidsWithVoids++;
|
||||
myNbSolids++;
|
||||
for (TopExp_Explorer shel(sol, TopAbs_SHELL); shel.More(); shel.Next())
|
||||
nbs++;
|
||||
if (nbs > 1)
|
||||
myNbSolidsWithVoids++;
|
||||
myNbSolids++;
|
||||
}
|
||||
myNbSharedSolids = mapsh.Extent();
|
||||
|
||||
// Pour les SHELLS, on compte les faces dans les SHELLS
|
||||
// Ensuite une soustraction, et on a les faces libres
|
||||
// Pour les SHELLS, on compte les faces dans les SHELLS
|
||||
// Ensuite une soustraction, et on a les faces libres
|
||||
mapsh.Clear();
|
||||
Standard_Integer nbfaceshell = 0;
|
||||
for (exp.Init (Shape,TopAbs_SHELL); exp.More(); exp.Next()) {
|
||||
for (exp.Init(Shape, TopAbs_SHELL); exp.More(); exp.Next())
|
||||
{
|
||||
myNbShells++;
|
||||
TopoDS_Shell she = TopoDS::Shell(exp.Current());
|
||||
she.Location(TopLoc_Location());
|
||||
mapsh.Add(she);
|
||||
for (TopExp_Explorer shel (she,TopAbs_FACE); shel.More(); shel.Next())
|
||||
nbfaceshell ++;
|
||||
for (TopExp_Explorer shel(she, TopAbs_FACE); shel.More(); shel.Next())
|
||||
nbfaceshell++;
|
||||
}
|
||||
myNbSharedShells = mapsh.Extent();
|
||||
// On note pour les FACES pas mal de choses (surface, topologie)
|
||||
// * Surface BSpline > 8192 poles
|
||||
// * Surface BSpline "OnlyC0" (not yet impl)
|
||||
// * Surface Offset
|
||||
// * Surface Elementaire INDIRECTE
|
||||
// * Presence de COUTURES; en particulier WIRE A PLUS D UNE COUTURE
|
||||
// * Edge : OffsetCurve
|
||||
// On note pour les FACES pas mal de choses (surface, topologie)
|
||||
// * Surface BSpline > 8192 poles
|
||||
// * Surface BSpline "OnlyC0" (not yet impl)
|
||||
// * Surface Offset
|
||||
// * Surface Elementaire INDIRECTE
|
||||
// * Presence de COUTURES; en particulier WIRE A PLUS D UNE COUTURE
|
||||
// * Edge : OffsetCurve
|
||||
|
||||
mapsh.Clear();
|
||||
for (exp.Init (Shape,TopAbs_FACE); exp.More(); exp.Next()) {
|
||||
for (exp.Init(Shape, TopAbs_FACE); exp.More(); exp.Next())
|
||||
{
|
||||
TopoDS_Face face = TopoDS::Face(exp.Current());
|
||||
myNbFaces++;
|
||||
TopLoc_Location loc;
|
||||
Handle(Geom_Surface) surf = BRep_Tool::Surface (face,loc);
|
||||
TopLoc_Location loc;
|
||||
Handle(Geom_Surface) surf = BRep_Tool::Surface(face, loc);
|
||||
face.Location(TopLoc_Location());
|
||||
mapsh.Add(face);
|
||||
Handle(Geom_RectangularTrimmedSurface) trsu =
|
||||
Handle(Geom_RectangularTrimmedSurface)::DownCast (surf);
|
||||
if (!trsu.IsNull()) {
|
||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(surf);
|
||||
if (!trsu.IsNull())
|
||||
{
|
||||
myNbTrimSurf++;
|
||||
surf = trsu->BasisSurface();
|
||||
}
|
||||
//#10 rln 27/02/98 BUC50003 entity 56
|
||||
//C0 if at least in one direction (U or V)
|
||||
if (!surf.IsNull() && !(surf->IsCNu(1) && surf->IsCNv(1))) {
|
||||
// #10 rln 27/02/98 BUC50003 entity 56
|
||||
// C0 if at least in one direction (U or V)
|
||||
if (!surf.IsNull() && !(surf->IsCNu(1) && surf->IsCNv(1)))
|
||||
{
|
||||
myNbC0Surfaces++;
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineSurface) bsps = Handle(Geom_BSplineSurface)::DownCast(surf);
|
||||
if (!bsps.IsNull()) {
|
||||
if (!bsps.IsNull())
|
||||
{
|
||||
myNbBSplibeSurf++;
|
||||
if (bsps->NbUPoles() * bsps->NbVPoles() > 8192) {
|
||||
myNbBigSplines++;
|
||||
if (myBigSplineMode) myBigSplineSec->Append(face);
|
||||
if (bsps->NbUPoles() * bsps->NbVPoles() > 8192)
|
||||
{
|
||||
myNbBigSplines++;
|
||||
if (myBigSplineMode)
|
||||
myBigSplineSec->Append(face);
|
||||
}
|
||||
}
|
||||
Handle(Geom_ElementarySurface) els = Handle(Geom_ElementarySurface)::DownCast(surf);
|
||||
if (!els.IsNull()) {
|
||||
if (!els->Position().Direct()) {
|
||||
myNbIndirectSurf++;
|
||||
if (myIndirectMode) myIndirectSec->Append(face);
|
||||
if (!els.IsNull())
|
||||
{
|
||||
if (!els->Position().Direct())
|
||||
{
|
||||
myNbIndirectSurf++;
|
||||
if (myIndirectMode)
|
||||
myIndirectSec->Append(face);
|
||||
}
|
||||
}
|
||||
if (surf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
|
||||
if (surf->IsKind(STANDARD_TYPE(Geom_OffsetSurface)))
|
||||
{
|
||||
myNbOffsetSurf++;
|
||||
if (myOffsetSurfaceMode) myOffsetSurfaceSec->Append(face);
|
||||
if (myOffsetSurfaceMode)
|
||||
myOffsetSurfaceSec->Append(face);
|
||||
}
|
||||
else if (surf->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
|
||||
else if (surf->IsKind(STANDARD_TYPE(Geom_BezierSurface)))
|
||||
{
|
||||
myNbBezierSurf++;
|
||||
}
|
||||
|
||||
Standard_Integer maxseam = 0, nbwires = 0;
|
||||
for (TopExp_Explorer wires(face,TopAbs_WIRE); wires.More(); wires.Next()) {
|
||||
TopoDS_Wire wire = TopoDS::Wire (wires.Current());
|
||||
for (TopExp_Explorer wires(face, TopAbs_WIRE); wires.More(); wires.Next())
|
||||
{
|
||||
TopoDS_Wire wire = TopoDS::Wire(wires.Current());
|
||||
Standard_Integer nbseam = 0;
|
||||
nbwires ++;
|
||||
for (TopExp_Explorer edg(wire,TopAbs_EDGE); edg.More(); edg.Next()) {
|
||||
TopoDS_Edge edge = TopoDS::Edge (edg.Current());
|
||||
Standard_Real first,last;
|
||||
if (BRep_Tool::IsClosed (edge,face)) nbseam ++;
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve (edge,first,last);
|
||||
if (!c3d.IsNull()) {
|
||||
if (c3d->IsKind (STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
myNbTrimmedCurve3d++;
|
||||
if (myTrimmed3dMode) myTrimmed3dSec->Append(face);
|
||||
}
|
||||
}
|
||||
Handle(Geom2d_Curve) c2d = BRep_Tool::CurveOnSurface (edge,face,first,last);
|
||||
if (c2d.IsNull()) myNbNoPCurve++;
|
||||
else if (c2d->IsKind (STANDARD_TYPE(Geom2d_OffsetCurve))) {
|
||||
myNbOffsetCurves++;
|
||||
if (myOffsetCurveMode) myOffsetCurveSec->Append(face);
|
||||
}
|
||||
else if (c2d->IsKind (STANDARD_TYPE(Geom2d_TrimmedCurve))) {
|
||||
myNbTrimmedCurve2d++;
|
||||
if (myTrimmed2dMode) myTrimmed2dSec->Append(face);
|
||||
}
|
||||
nbwires++;
|
||||
for (TopExp_Explorer edg(wire, TopAbs_EDGE); edg.More(); edg.Next())
|
||||
{
|
||||
TopoDS_Edge edge = TopoDS::Edge(edg.Current());
|
||||
Standard_Real first, last;
|
||||
if (BRep_Tool::IsClosed(edge, face))
|
||||
nbseam++;
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge, first, last);
|
||||
if (!c3d.IsNull())
|
||||
{
|
||||
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
|
||||
{
|
||||
myNbTrimmedCurve3d++;
|
||||
if (myTrimmed3dMode)
|
||||
myTrimmed3dSec->Append(face);
|
||||
}
|
||||
}
|
||||
Handle(Geom2d_Curve) c2d = BRep_Tool::CurveOnSurface(edge, face, first, last);
|
||||
if (c2d.IsNull())
|
||||
myNbNoPCurve++;
|
||||
else if (c2d->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
|
||||
{
|
||||
myNbOffsetCurves++;
|
||||
if (myOffsetCurveMode)
|
||||
myOffsetCurveSec->Append(face);
|
||||
}
|
||||
else if (c2d->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
{
|
||||
myNbTrimmedCurve2d++;
|
||||
if (myTrimmed2dMode)
|
||||
myTrimmed2dSec->Append(face);
|
||||
}
|
||||
}
|
||||
if (nbseam > maxseam) maxseam = nbseam;
|
||||
if (nbseam > maxseam)
|
||||
maxseam = nbseam;
|
||||
}
|
||||
if (maxseam == 1) myNbWireWitnSeam++;
|
||||
if (maxseam == 1)
|
||||
myNbWireWitnSeam++;
|
||||
else if (maxseam > 1)
|
||||
myNbWireWithSevSeams++;
|
||||
if (nbwires > 1) myNbFaceWithSevWires++;
|
||||
if (nbwires > 1)
|
||||
myNbFaceWithSevWires++;
|
||||
}
|
||||
myNbSharedFaces = mapsh.Extent();
|
||||
|
||||
|
||||
mapsh.Clear();
|
||||
for (exp.Init (Shape,TopAbs_WIRE); exp.More(); exp.Next()) {
|
||||
for (exp.Init(Shape, TopAbs_WIRE); exp.More(); exp.Next())
|
||||
{
|
||||
TopoDS_Wire wire = TopoDS::Wire(exp.Current());
|
||||
wire.Location(TopLoc_Location());
|
||||
mapsh.Add(wire);
|
||||
myNbWires++;
|
||||
}
|
||||
myNbSharedWires = mapsh.Extent();
|
||||
|
||||
// Ne pas oublier les FACES :
|
||||
|
||||
// Ne pas oublier les FACES :
|
||||
myNbFreeFaces = myNbFaces - nbfaceshell;
|
||||
|
||||
mapsh.Clear();
|
||||
for (exp.Init (Shape,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||
TopoDS_Edge edge = TopoDS::Edge (exp.Current());
|
||||
for (exp.Init(Shape, TopAbs_EDGE); exp.More(); exp.Next())
|
||||
{
|
||||
TopoDS_Edge edge = TopoDS::Edge(exp.Current());
|
||||
edge.Location(TopLoc_Location());
|
||||
mapsh.Add (edge);
|
||||
mapsh.Add(edge);
|
||||
TopLoc_Location loc;
|
||||
Standard_Real first,last;
|
||||
Standard_Real first, last;
|
||||
myNbEdges++;
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve (edge,loc,first,last);
|
||||
if (!c3d.IsNull() && c3d->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) {
|
||||
Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge, loc, first, last);
|
||||
if (!c3d.IsNull() && c3d->IsKind(STANDARD_TYPE(Geom_OffsetCurve)))
|
||||
{
|
||||
myNbOffsetCurves++;
|
||||
if (myOffsetCurveMode) myOffsetCurveSec->Append(edge);
|
||||
if (myOffsetCurveMode)
|
||||
myOffsetCurveSec->Append(edge);
|
||||
}
|
||||
if (!c3d.IsNull() && !c3d->IsCN(1)) myNbC0Curves++;
|
||||
if (!c3d.IsNull() && !c3d->IsCN(1))
|
||||
myNbC0Curves++;
|
||||
}
|
||||
myNbSharedEdges=mapsh.Extent();
|
||||
myNbSharedEdges = mapsh.Extent();
|
||||
|
||||
mapsh.Clear();
|
||||
for (exp.Init (Shape,TopAbs_VERTEX); exp.More(); exp.Next()) {
|
||||
for (exp.Init(Shape, TopAbs_VERTEX); exp.More(); exp.Next())
|
||||
{
|
||||
TopoDS_Vertex vert = TopoDS::Vertex(exp.Current());
|
||||
vert.Location(TopLoc_Location());
|
||||
myNbVertices++;
|
||||
mapsh.Add (vert);
|
||||
mapsh.Add(vert);
|
||||
}
|
||||
myNbSharedVertices=mapsh.Extent();
|
||||
|
||||
myNbSharedVertices = mapsh.Extent();
|
||||
|
||||
mapsh.Clear();
|
||||
for (exp.Init(Shape, TopAbs_EDGE, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||
TopoDS_Edge edge = TopoDS::Edge (exp.Current());
|
||||
for (exp.Init(Shape, TopAbs_EDGE, TopAbs_FACE); exp.More(); exp.Next())
|
||||
{
|
||||
TopoDS_Edge edge = TopoDS::Edge(exp.Current());
|
||||
edge.Location(TopLoc_Location());
|
||||
myNbFreeEdges++;
|
||||
mapsh.Add (edge);
|
||||
mapsh.Add(edge);
|
||||
}
|
||||
myNbSharedFreeEdges=mapsh.Extent();
|
||||
|
||||
myNbSharedFreeEdges = mapsh.Extent();
|
||||
|
||||
mapsh.Clear();
|
||||
for (exp.Init(Shape, TopAbs_WIRE, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||
for (exp.Init(Shape, TopAbs_WIRE, TopAbs_FACE); exp.More(); exp.Next())
|
||||
{
|
||||
TopoDS_Wire wire = TopoDS::Wire(exp.Current());
|
||||
wire.Location(TopLoc_Location());
|
||||
myNbFreeWires++;
|
||||
mapsh.Add (wire);
|
||||
mapsh.Add(wire);
|
||||
}
|
||||
myNbSharedFreeWires=mapsh.Extent();
|
||||
myNbSharedFreeWires = mapsh.Extent();
|
||||
}
|
||||
|
@@ -25,27 +25,24 @@
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
//! Dumps shape contents
|
||||
class ShapeAnalysis_ShapeContents
|
||||
class ShapeAnalysis_ShapeContents
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Initialize fields and call ClearFlags()
|
||||
Standard_EXPORT ShapeAnalysis_ShapeContents();
|
||||
|
||||
|
||||
//! Clears all accumulated statistics
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
|
||||
//! Clears all flags
|
||||
Standard_EXPORT void ClearFlags();
|
||||
|
||||
|
||||
//! Counts quantities of sun-shapes in shape and
|
||||
//! stores sub-shapes according to flags
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& shape);
|
||||
Standard_EXPORT void Perform(const TopoDS_Shape& shape);
|
||||
|
||||
//! Returns (modifiable) the flag which defines whether to store faces
|
||||
//! with edges if its 3D curves has more than 8192 poles.
|
||||
@@ -146,60 +143,58 @@ public:
|
||||
const Handle(TopTools_HSequenceOfShape)& OffsetCurveSec() const { return myOffsetCurveSec; }
|
||||
|
||||
const Handle(TopTools_HSequenceOfShape)& Trimmed2dSec() const { return myTrimmed2dSec; }
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
Standard_DEPRECATED("ModifyOffsetSurfaceMode() should be used instead")
|
||||
|
||||
Standard_Boolean& ModifyOffestSurfaceMode() { return myOffsetSurfaceMode; }
|
||||
|
||||
private:
|
||||
|
||||
Standard_Integer myNbSolids;
|
||||
Standard_Integer myNbShells;
|
||||
Standard_Integer myNbFaces;
|
||||
Standard_Integer myNbWires;
|
||||
Standard_Integer myNbEdges;
|
||||
Standard_Integer myNbVertices;
|
||||
Standard_Integer myNbSolidsWithVoids;
|
||||
Standard_Integer myNbBigSplines;
|
||||
Standard_Integer myNbC0Surfaces;
|
||||
Standard_Integer myNbC0Curves;
|
||||
Standard_Integer myNbOffsetSurf;
|
||||
Standard_Integer myNbIndirectSurf;
|
||||
Standard_Integer myNbOffsetCurves;
|
||||
Standard_Integer myNbTrimmedCurve2d;
|
||||
Standard_Integer myNbTrimmedCurve3d;
|
||||
Standard_Integer myNbBSplibeSurf;
|
||||
Standard_Integer myNbBezierSurf;
|
||||
Standard_Integer myNbTrimSurf;
|
||||
Standard_Integer myNbWireWitnSeam;
|
||||
Standard_Integer myNbWireWithSevSeams;
|
||||
Standard_Integer myNbFaceWithSevWires;
|
||||
Standard_Integer myNbNoPCurve;
|
||||
Standard_Integer myNbFreeFaces;
|
||||
Standard_Integer myNbFreeWires;
|
||||
Standard_Integer myNbFreeEdges;
|
||||
Standard_Integer myNbSharedSolids;
|
||||
Standard_Integer myNbSharedShells;
|
||||
Standard_Integer myNbSharedFaces;
|
||||
Standard_Integer myNbSharedWires;
|
||||
Standard_Integer myNbSharedFreeWires;
|
||||
Standard_Integer myNbSharedFreeEdges;
|
||||
Standard_Integer myNbSharedEdges;
|
||||
Standard_Integer myNbSharedVertices;
|
||||
Standard_Boolean myBigSplineMode;
|
||||
Standard_Boolean myIndirectMode;
|
||||
Standard_Boolean myOffsetSurfaceMode;
|
||||
Standard_Boolean myTrimmed3dMode;
|
||||
Standard_Boolean myOffsetCurveMode;
|
||||
Standard_Boolean myTrimmed2dMode;
|
||||
Standard_Integer myNbSolids;
|
||||
Standard_Integer myNbShells;
|
||||
Standard_Integer myNbFaces;
|
||||
Standard_Integer myNbWires;
|
||||
Standard_Integer myNbEdges;
|
||||
Standard_Integer myNbVertices;
|
||||
Standard_Integer myNbSolidsWithVoids;
|
||||
Standard_Integer myNbBigSplines;
|
||||
Standard_Integer myNbC0Surfaces;
|
||||
Standard_Integer myNbC0Curves;
|
||||
Standard_Integer myNbOffsetSurf;
|
||||
Standard_Integer myNbIndirectSurf;
|
||||
Standard_Integer myNbOffsetCurves;
|
||||
Standard_Integer myNbTrimmedCurve2d;
|
||||
Standard_Integer myNbTrimmedCurve3d;
|
||||
Standard_Integer myNbBSplibeSurf;
|
||||
Standard_Integer myNbBezierSurf;
|
||||
Standard_Integer myNbTrimSurf;
|
||||
Standard_Integer myNbWireWitnSeam;
|
||||
Standard_Integer myNbWireWithSevSeams;
|
||||
Standard_Integer myNbFaceWithSevWires;
|
||||
Standard_Integer myNbNoPCurve;
|
||||
Standard_Integer myNbFreeFaces;
|
||||
Standard_Integer myNbFreeWires;
|
||||
Standard_Integer myNbFreeEdges;
|
||||
Standard_Integer myNbSharedSolids;
|
||||
Standard_Integer myNbSharedShells;
|
||||
Standard_Integer myNbSharedFaces;
|
||||
Standard_Integer myNbSharedWires;
|
||||
Standard_Integer myNbSharedFreeWires;
|
||||
Standard_Integer myNbSharedFreeEdges;
|
||||
Standard_Integer myNbSharedEdges;
|
||||
Standard_Integer myNbSharedVertices;
|
||||
Standard_Boolean myBigSplineMode;
|
||||
Standard_Boolean myIndirectMode;
|
||||
Standard_Boolean myOffsetSurfaceMode;
|
||||
Standard_Boolean myTrimmed3dMode;
|
||||
Standard_Boolean myOffsetCurveMode;
|
||||
Standard_Boolean myTrimmed2dMode;
|
||||
Handle(TopTools_HSequenceOfShape) myBigSplineSec;
|
||||
Handle(TopTools_HSequenceOfShape) myIndirectSec;
|
||||
Handle(TopTools_HSequenceOfShape) myOffsetSurfaceSec;
|
||||
Handle(TopTools_HSequenceOfShape) myTrimmed3dSec;
|
||||
Handle(TopTools_HSequenceOfShape) myOffsetCurveSec;
|
||||
Handle(TopTools_HSequenceOfShape) myTrimmed2dSec;
|
||||
|
||||
};
|
||||
|
||||
#endif // _ShapeAnalysis_ShapeContents_HeaderFile
|
||||
|
@@ -11,8 +11,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//#76 rln 11.03.99 S4135: compute average without weights according to tolerances
|
||||
//szv#4 S4163
|
||||
// #76 rln 11.03.99 S4135: compute average without weights according to tolerances
|
||||
// szv#4 S4163
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <ShapeAnalysis_ShapeTolerance.hxx>
|
||||
@@ -21,237 +21,271 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_ShapeTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
ShapeAnalysis_ShapeTolerance::ShapeAnalysis_ShapeTolerance() : myNbTol (0)
|
||||
//=================================================================================================
|
||||
|
||||
ShapeAnalysis_ShapeTolerance::ShapeAnalysis_ShapeTolerance()
|
||||
: myNbTol(0)
|
||||
{
|
||||
}
|
||||
|
||||
static void AddTol (const Standard_Real tol, Standard_Integer& nbt,
|
||||
Standard_Real& cmin, Standard_Real& cmoy, Standard_Real& cmax)
|
||||
static void AddTol(const Standard_Real tol,
|
||||
Standard_Integer& nbt,
|
||||
Standard_Real& cmin,
|
||||
Standard_Real& cmoy,
|
||||
Standard_Real& cmax)
|
||||
{
|
||||
nbt ++;
|
||||
if (nbt == 1) cmin = cmoy = cmax = tol;
|
||||
else {
|
||||
if (cmin > tol) cmin = tol;
|
||||
if (cmax < tol) cmax = tol;
|
||||
// cmoy += tol;
|
||||
// Calcul en moyenne geometrique entre 1 et 1e-7
|
||||
nbt++;
|
||||
if (nbt == 1)
|
||||
cmin = cmoy = cmax = tol;
|
||||
else
|
||||
{
|
||||
if (cmin > tol)
|
||||
cmin = tol;
|
||||
if (cmax < tol)
|
||||
cmax = tol;
|
||||
// cmoy += tol;
|
||||
// Calcul en moyenne geometrique entre 1 et 1e-7
|
||||
Standard_Integer mult = 1;
|
||||
//#76 rln 11.03.99 S4135: compute average without weights according to tolerances
|
||||
/* if (tol < 1.e-07) mult = 10000;
|
||||
else if (tol < 1.e-06) mult = 3000;
|
||||
else if (tol < 1.e-05) mult = 1000;
|
||||
else if (tol < 1.e-04) mult = 300;
|
||||
else if (tol < 1.e-03) mult = 100;
|
||||
else if (tol < 1.e-02) mult = 30;
|
||||
else if (tol < 1.e-01) mult = 10;
|
||||
else if (tol < 1. ) mult = 3;
|
||||
*/
|
||||
nbt += (mult-1);
|
||||
// #76 rln 11.03.99 S4135: compute average without weights according to tolerances
|
||||
/* if (tol < 1.e-07) mult = 10000;
|
||||
else if (tol < 1.e-06) mult = 3000;
|
||||
else if (tol < 1.e-05) mult = 1000;
|
||||
else if (tol < 1.e-04) mult = 300;
|
||||
else if (tol < 1.e-03) mult = 100;
|
||||
else if (tol < 1.e-02) mult = 30;
|
||||
else if (tol < 1.e-01) mult = 10;
|
||||
else if (tol < 1. ) mult = 3;
|
||||
*/
|
||||
nbt += (mult - 1);
|
||||
cmoy += (tol * mult);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Tolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis_ShapeTolerance::Tolerance(const TopoDS_Shape& shape,const Standard_Integer mode,const TopAbs_ShapeEnum type)
|
||||
Standard_Real ShapeAnalysis_ShapeTolerance::Tolerance(const TopoDS_Shape& shape,
|
||||
const Standard_Integer mode,
|
||||
const TopAbs_ShapeEnum type)
|
||||
{
|
||||
InitTolerance();
|
||||
AddTolerance (shape, type);
|
||||
return GlobalTolerance (mode);
|
||||
AddTolerance(shape, type);
|
||||
return GlobalTolerance(mode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OverTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Handle(TopTools_HSequenceOfShape) ShapeAnalysis_ShapeTolerance::OverTolerance(const TopoDS_Shape& shape,const Standard_Real value,const TopAbs_ShapeEnum type) const
|
||||
Handle(TopTools_HSequenceOfShape) ShapeAnalysis_ShapeTolerance::OverTolerance(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real value,
|
||||
const TopAbs_ShapeEnum type) const
|
||||
{
|
||||
if (value >= 0) return InTolerance (shape,value,0.,type);
|
||||
else return InTolerance (shape,0.,value,type);
|
||||
if (value >= 0)
|
||||
return InTolerance(shape, value, 0., type);
|
||||
else
|
||||
return InTolerance(shape, 0., value, type);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Handle(TopTools_HSequenceOfShape) ShapeAnalysis_ShapeTolerance::InTolerance(const TopoDS_Shape& shape,const Standard_Real valmin,const Standard_Real valmax,const TopAbs_ShapeEnum type) const
|
||||
Handle(TopTools_HSequenceOfShape) ShapeAnalysis_ShapeTolerance::InTolerance(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real valmin,
|
||||
const Standard_Real valmax,
|
||||
const TopAbs_ShapeEnum type) const
|
||||
{
|
||||
Standard_Real tol;
|
||||
Standard_Boolean over = (valmax < valmin); // pas de liminite max
|
||||
Handle(TopTools_HSequenceOfShape) sl = new TopTools_HSequenceOfShape ();
|
||||
Standard_Real tol;
|
||||
Standard_Boolean over = (valmax < valmin); // pas de liminite max
|
||||
Handle(TopTools_HSequenceOfShape) sl = new TopTools_HSequenceOfShape();
|
||||
|
||||
TopExp_Explorer myExp;
|
||||
|
||||
// Iteration sur les Faces
|
||||
|
||||
if (type == TopAbs_FACE || type == TopAbs_SHAPE) {
|
||||
if (type == TopAbs_FACE || type == TopAbs_SHAPE)
|
||||
{
|
||||
myExp.Init(shape, TopAbs_FACE);
|
||||
while(myExp.More()) {
|
||||
while (myExp.More())
|
||||
{
|
||||
tol = BRep_Tool::Tolerance(TopoDS::Face(myExp.Current()));
|
||||
if (tol >= valmin && (over || (tol <= valmax)) ) sl->Append (myExp.Current());
|
||||
if (tol >= valmin && (over || (tol <= valmax)))
|
||||
sl->Append(myExp.Current());
|
||||
myExp.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// Iteration sur les Edges
|
||||
|
||||
if (type == TopAbs_EDGE || type == TopAbs_SHAPE) {
|
||||
if (type == TopAbs_EDGE || type == TopAbs_SHAPE)
|
||||
{
|
||||
myExp.Init(shape, TopAbs_EDGE);
|
||||
while(myExp.More()) {
|
||||
while (myExp.More())
|
||||
{
|
||||
tol = BRep_Tool::Tolerance(TopoDS::Edge(myExp.Current()));
|
||||
if (tol >= valmin && (over || (tol <= valmax)) ) sl->Append (myExp.Current());
|
||||
if (tol >= valmin && (over || (tol <= valmax)))
|
||||
sl->Append(myExp.Current());
|
||||
myExp.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// Iteration sur les Vertex
|
||||
|
||||
if (type == TopAbs_VERTEX || type == TopAbs_SHAPE) {
|
||||
if (type == TopAbs_VERTEX || type == TopAbs_SHAPE)
|
||||
{
|
||||
myExp.Init(shape, TopAbs_VERTEX);
|
||||
while(myExp.More()) {
|
||||
while (myExp.More())
|
||||
{
|
||||
tol = BRep_Tool::Tolerance(TopoDS::Vertex(myExp.Current()));
|
||||
if (tol >= valmin && (over || (tol >= valmax)) ) sl->Append (myExp.Current());
|
||||
if (tol >= valmin && (over || (tol >= valmax)))
|
||||
sl->Append(myExp.Current());
|
||||
myExp.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// Iteration combinee (cumul) SHELL+FACE+EDGE+VERTEX, on retourne SHELL+FACE
|
||||
|
||||
if (type == TopAbs_SHELL) {
|
||||
if (type == TopAbs_SHELL)
|
||||
{
|
||||
// Exploration des shells
|
||||
TopTools_MapOfShape mapface;
|
||||
myExp.Init (shape, TopAbs_SHELL);
|
||||
while(myExp.More()) {
|
||||
myExp.Init(shape, TopAbs_SHELL);
|
||||
while (myExp.More())
|
||||
{
|
||||
Standard_Boolean iashell = Standard_False;
|
||||
TopoDS_Shape ash = myExp.Current();
|
||||
for (TopExp_Explorer face (ash,TopAbs_FACE); face.More(); face.Next()) {
|
||||
mapface.Add (face.Current());
|
||||
Handle(TopTools_HSequenceOfShape) fc =
|
||||
InTolerance (face.Current(),valmin,valmax,type);
|
||||
if (fc->Length() > 0) {
|
||||
sl->Append(fc);
|
||||
iashell = Standard_True;
|
||||
}
|
||||
TopoDS_Shape ash = myExp.Current();
|
||||
for (TopExp_Explorer face(ash, TopAbs_FACE); face.More(); face.Next())
|
||||
{
|
||||
mapface.Add(face.Current());
|
||||
Handle(TopTools_HSequenceOfShape) fc = InTolerance(face.Current(), valmin, valmax, type);
|
||||
if (fc->Length() > 0)
|
||||
{
|
||||
sl->Append(fc);
|
||||
iashell = Standard_True;
|
||||
}
|
||||
}
|
||||
if (iashell) sl->Append (ash);
|
||||
if (iashell)
|
||||
sl->Append(ash);
|
||||
myExp.Next();
|
||||
}
|
||||
|
||||
// Les faces (libres ou sous shell)
|
||||
myExp.Init (shape, TopAbs_FACE);
|
||||
for (; myExp.More(); myExp.Next()) {
|
||||
myExp.Init(shape, TopAbs_FACE);
|
||||
for (; myExp.More(); myExp.Next())
|
||||
{
|
||||
Standard_Boolean iaface = Standard_False;
|
||||
if (mapface.Contains (myExp.Current()) ) continue;
|
||||
if (mapface.Contains(myExp.Current()))
|
||||
continue;
|
||||
tol = BRep_Tool::Tolerance(TopoDS::Face(myExp.Current()));
|
||||
if (tol >= valmin && (over || (tol <= valmax)) ) iaface = Standard_True;
|
||||
else {
|
||||
// les edges contenues ?
|
||||
Handle(TopTools_HSequenceOfShape) fl =
|
||||
InTolerance (myExp.Current(),valmin,valmax,TopAbs_EDGE);
|
||||
if (fl->Length() > 0) iaface = Standard_True;
|
||||
else {
|
||||
fl = InTolerance (myExp.Current(),valmin,valmax,TopAbs_VERTEX);
|
||||
if (fl->Length() > 0) iaface = Standard_True;
|
||||
}
|
||||
if (tol >= valmin && (over || (tol <= valmax)))
|
||||
iaface = Standard_True;
|
||||
else
|
||||
{
|
||||
// les edges contenues ?
|
||||
Handle(TopTools_HSequenceOfShape) fl =
|
||||
InTolerance(myExp.Current(), valmin, valmax, TopAbs_EDGE);
|
||||
if (fl->Length() > 0)
|
||||
iaface = Standard_True;
|
||||
else
|
||||
{
|
||||
fl = InTolerance(myExp.Current(), valmin, valmax, TopAbs_VERTEX);
|
||||
if (fl->Length() > 0)
|
||||
iaface = Standard_True;
|
||||
}
|
||||
}
|
||||
if (iaface) sl->Append (myExp.Current());
|
||||
if (iaface)
|
||||
sl->Append(myExp.Current());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return sl;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_ShapeTolerance::InitTolerance()
|
||||
void ShapeAnalysis_ShapeTolerance::InitTolerance()
|
||||
{
|
||||
myNbTol = 0;
|
||||
myNbTol = 0;
|
||||
myTols[1] = 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_ShapeTolerance::AddTolerance(const TopoDS_Shape& shape,const TopAbs_ShapeEnum type)
|
||||
void ShapeAnalysis_ShapeTolerance::AddTolerance(const TopoDS_Shape& shape,
|
||||
const TopAbs_ShapeEnum type)
|
||||
{
|
||||
Standard_Integer nbt = 0;
|
||||
Standard_Real tol, cmin = 0.,cmoy = 0.,cmax = 0.;
|
||||
Standard_Integer nbt = 0;
|
||||
Standard_Real tol, cmin = 0., cmoy = 0., cmax = 0.;
|
||||
|
||||
TopExp_Explorer myExp;
|
||||
|
||||
// Iteration sur les Faces
|
||||
|
||||
if (type == TopAbs_FACE || type == TopAbs_SHAPE) {
|
||||
if (type == TopAbs_FACE || type == TopAbs_SHAPE)
|
||||
{
|
||||
myExp.Init(shape, TopAbs_FACE);
|
||||
while(myExp.More()) {
|
||||
while (myExp.More())
|
||||
{
|
||||
tol = BRep_Tool::Tolerance(TopoDS::Face(myExp.Current()));
|
||||
AddTol (tol,nbt,cmin,cmoy,cmax);
|
||||
AddTol(tol, nbt, cmin, cmoy, cmax);
|
||||
myExp.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// Iteration sur les Edges
|
||||
|
||||
if (type == TopAbs_EDGE || type == TopAbs_SHAPE) {
|
||||
if (type == TopAbs_EDGE || type == TopAbs_SHAPE)
|
||||
{
|
||||
myExp.Init(shape, TopAbs_EDGE);
|
||||
while(myExp.More()) {
|
||||
while (myExp.More())
|
||||
{
|
||||
tol = BRep_Tool::Tolerance(TopoDS::Edge(myExp.Current()));
|
||||
AddTol (tol,nbt,cmin,cmoy,cmax);
|
||||
AddTol(tol, nbt, cmin, cmoy, cmax);
|
||||
myExp.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// Iteration sur les Vertices
|
||||
|
||||
if (type == TopAbs_VERTEX || type == TopAbs_SHAPE) {
|
||||
if (type == TopAbs_VERTEX || type == TopAbs_SHAPE)
|
||||
{
|
||||
myExp.Init(shape, TopAbs_VERTEX);
|
||||
while(myExp.More()) {
|
||||
while (myExp.More())
|
||||
{
|
||||
tol = BRep_Tool::Tolerance(TopoDS::Vertex(myExp.Current()));
|
||||
AddTol (tol,nbt,cmin,cmoy,cmax);
|
||||
AddTol(tol, nbt, cmin, cmoy, cmax);
|
||||
myExp.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// Resultat : attention en mode cumul
|
||||
if (nbt == 0) return;
|
||||
if (myNbTol == 0 || myTols[0] > cmin) myTols[0] = cmin;
|
||||
if (myNbTol == 0 || myTols[2] < cmax) myTols[2] = cmax;
|
||||
// Resultat : attention en mode cumul
|
||||
if (nbt == 0)
|
||||
return;
|
||||
if (myNbTol == 0 || myTols[0] > cmin)
|
||||
myTols[0] = cmin;
|
||||
if (myNbTol == 0 || myTols[2] < cmax)
|
||||
myTols[2] = cmax;
|
||||
myTols[1] += cmoy;
|
||||
myNbTol += nbt;
|
||||
myNbTol += nbt;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GlobalTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis_ShapeTolerance::GlobalTolerance(const Standard_Integer mode) const
|
||||
Standard_Real ShapeAnalysis_ShapeTolerance::GlobalTolerance(const Standard_Integer mode) const
|
||||
{
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
Standard_Real result = 0.;
|
||||
if (myNbTol != 0.) {
|
||||
if (mode < 0) result = myTols[0];
|
||||
else if (mode == 0) {
|
||||
if (myTols[0] == myTols[2]) result = myTols[0];
|
||||
else result = myTols[1] / myNbTol;
|
||||
if (myNbTol != 0.)
|
||||
{
|
||||
if (mode < 0)
|
||||
result = myTols[0];
|
||||
else if (mode == 0)
|
||||
{
|
||||
if (myTols[0] == myTols[2])
|
||||
result = myTols[0];
|
||||
else
|
||||
result = myTols[1] / myNbTol;
|
||||
}
|
||||
else result = myTols[2];
|
||||
else
|
||||
result = myTols[2];
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -26,20 +26,17 @@
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
//! Tool for computing shape tolerances (minimal, maximal, average),
|
||||
//! finding shape with tolerance matching given criteria,
|
||||
//! setting or limitating tolerances.
|
||||
class ShapeAnalysis_ShapeTolerance
|
||||
class ShapeAnalysis_ShapeTolerance
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_ShapeTolerance();
|
||||
|
||||
|
||||
//! Determines a tolerance from the ones stored in a shape
|
||||
//! Remark : calls InitTolerance and AddTolerance,
|
||||
//! hence, can be used to start a series for cumulating tolerance
|
||||
@@ -53,52 +50,43 @@ public:
|
||||
//! FACE : only faces,
|
||||
//! SHELL : combined SHELL + FACE, for each face (and containing
|
||||
//! shell), also checks EDGE and VERTEX
|
||||
Standard_EXPORT Standard_Real Tolerance (const TopoDS_Shape& shape, const Standard_Integer mode, const TopAbs_ShapeEnum type = TopAbs_SHAPE);
|
||||
|
||||
Standard_EXPORT Standard_Real Tolerance(const TopoDS_Shape& shape,
|
||||
const Standard_Integer mode,
|
||||
const TopAbs_ShapeEnum type = TopAbs_SHAPE);
|
||||
|
||||
//! Determines which shapes have a tolerance over the given value
|
||||
//! <type> is interpreted as in the method Tolerance
|
||||
Standard_EXPORT Handle(TopTools_HSequenceOfShape) OverTolerance (const TopoDS_Shape& shape, const Standard_Real value, const TopAbs_ShapeEnum type = TopAbs_SHAPE) const;
|
||||
|
||||
Standard_EXPORT Handle(TopTools_HSequenceOfShape) OverTolerance(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real value,
|
||||
const TopAbs_ShapeEnum type = TopAbs_SHAPE) const;
|
||||
|
||||
//! Determines which shapes have a tolerance within a given interval
|
||||
//! <type> is interpreted as in the method Tolerance
|
||||
Standard_EXPORT Handle(TopTools_HSequenceOfShape) InTolerance (const TopoDS_Shape& shape, const Standard_Real valmin, const Standard_Real valmax, const TopAbs_ShapeEnum type = TopAbs_SHAPE) const;
|
||||
|
||||
Standard_EXPORT Handle(TopTools_HSequenceOfShape) InTolerance(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real valmin,
|
||||
const Standard_Real valmax,
|
||||
const TopAbs_ShapeEnum type = TopAbs_SHAPE) const;
|
||||
|
||||
//! Initializes computation of cumulated tolerance
|
||||
Standard_EXPORT void InitTolerance();
|
||||
|
||||
|
||||
//! Adds data on new Shape to compute Cumulated Tolerance
|
||||
//! (prepares three computations : maximal, average, minimal)
|
||||
Standard_EXPORT void AddTolerance (const TopoDS_Shape& shape, const TopAbs_ShapeEnum type = TopAbs_SHAPE);
|
||||
|
||||
Standard_EXPORT void AddTolerance(const TopoDS_Shape& shape,
|
||||
const TopAbs_ShapeEnum type = TopAbs_SHAPE);
|
||||
|
||||
//! Returns the computed tolerance according to the <mode>
|
||||
//! <mode> = 0 : average
|
||||
//! <mode> > 0 : maximal
|
||||
//! <mode> < 0 : minimal
|
||||
Standard_EXPORT Standard_Real GlobalTolerance (const Standard_Integer mode) const;
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real GlobalTolerance(const Standard_Integer mode) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Real myTols[3];
|
||||
Standard_Real myTols[3];
|
||||
Standard_Integer myNbTol;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_ShapeTolerance_HeaderFile
|
||||
|
@@ -11,7 +11,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//szv#4 S4163
|
||||
// szv#4 S4163
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@@ -23,20 +23,16 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_Shell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
ShapeAnalysis_Shell::ShapeAnalysis_Shell()
|
||||
: myConex(Standard_False)
|
||||
: myConex(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void ShapeAnalysis_Shell::Clear()
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_Shell::Clear()
|
||||
{
|
||||
myShells.Clear();
|
||||
myBad.Clear();
|
||||
@@ -44,224 +40,241 @@ void ShapeAnalysis_Shell::Clear()
|
||||
myConex = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadShells
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_Shell::LoadShells(const TopoDS_Shape& shape)
|
||||
void ShapeAnalysis_Shell::LoadShells(const TopoDS_Shape& shape)
|
||||
{
|
||||
if (shape.IsNull()) return;
|
||||
if (shape.IsNull())
|
||||
return;
|
||||
|
||||
if (shape.ShapeType() == TopAbs_SHELL) myShells.Add (shape); //szv#4:S4163:12Mar99 i =
|
||||
else {
|
||||
for (TopExp_Explorer exs (shape,TopAbs_SHELL); exs.More(); exs.Next()) {
|
||||
if (shape.ShapeType() == TopAbs_SHELL)
|
||||
myShells.Add(shape); // szv#4:S4163:12Mar99 i =
|
||||
else
|
||||
{
|
||||
for (TopExp_Explorer exs(shape, TopAbs_SHELL); exs.More(); exs.Next())
|
||||
{
|
||||
const TopoDS_Shape& sh = exs.Current();
|
||||
myShells.Add (sh); //szv#4:S4163:12Mar99 i =
|
||||
myShells.Add(sh); // szv#4:S4163:12Mar99 i =
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CheckOrientedShells : alimente BadEdges et FreeEdges
|
||||
// BadEdges : edges presentes plus d une fois dans une meme orientation
|
||||
// FreeEdges : edges presentes une seule fois
|
||||
// On utilise pour cela une fonction auxiliaire : CheckEdges
|
||||
// Qui alimente 2 maps auxiliaires : les edges directes et les inverses
|
||||
|
||||
static Standard_Boolean CheckEdges(const TopoDS_Shape& shape,
|
||||
TopTools_IndexedMapOfShape& bads,
|
||||
TopTools_IndexedMapOfShape& dirs,
|
||||
TopTools_IndexedMapOfShape& revs,
|
||||
TopTools_IndexedMapOfShape& ints)
|
||||
static Standard_Boolean CheckEdges(const TopoDS_Shape& shape,
|
||||
TopTools_IndexedMapOfShape& bads,
|
||||
TopTools_IndexedMapOfShape& dirs,
|
||||
TopTools_IndexedMapOfShape& revs,
|
||||
TopTools_IndexedMapOfShape& ints)
|
||||
{
|
||||
Standard_Boolean res = Standard_False;
|
||||
|
||||
if (shape.ShapeType() != TopAbs_EDGE) {
|
||||
for (TopoDS_Iterator it(shape); it.More(); it.Next()) {
|
||||
if (CheckEdges (it.Value(),bads,dirs,revs,ints)) res = Standard_True;
|
||||
if (shape.ShapeType() != TopAbs_EDGE)
|
||||
{
|
||||
for (TopoDS_Iterator it(shape); it.More(); it.Next())
|
||||
{
|
||||
if (CheckEdges(it.Value(), bads, dirs, revs, ints))
|
||||
res = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
TopoDS_Edge E = TopoDS::Edge(shape);
|
||||
if (BRep_Tool::Degenerated(E)) return Standard_False;
|
||||
if (BRep_Tool::Degenerated(E))
|
||||
return Standard_False;
|
||||
|
||||
if (shape.Orientation() == TopAbs_FORWARD) {
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if (dirs.FindIndex (shape) == 0) dirs.Add (shape);
|
||||
else { bads.Add (shape); res = Standard_True; }
|
||||
if (shape.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (dirs.FindIndex(shape) == 0)
|
||||
dirs.Add(shape);
|
||||
else
|
||||
{
|
||||
bads.Add(shape);
|
||||
res = Standard_True;
|
||||
}
|
||||
}
|
||||
if (shape.Orientation() == TopAbs_REVERSED) {
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if (revs.FindIndex (shape) == 0) revs.Add (shape);
|
||||
else { bads.Add (shape); res = Standard_True; }
|
||||
if (shape.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (revs.FindIndex(shape) == 0)
|
||||
revs.Add(shape);
|
||||
else
|
||||
{
|
||||
bads.Add(shape);
|
||||
res = Standard_True;
|
||||
}
|
||||
}
|
||||
if (shape.Orientation() == TopAbs_INTERNAL) {
|
||||
if (ints.FindIndex (shape) == 0) ints.Add (shape);
|
||||
//else { bads.Add (shape); res = Standard_True; }
|
||||
if (shape.Orientation() == TopAbs_INTERNAL)
|
||||
{
|
||||
if (ints.FindIndex(shape) == 0)
|
||||
ints.Add(shape);
|
||||
// else { bads.Add (shape); res = Standard_True; }
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckOrientedShells
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_Shell::CheckOrientedShells(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean alsofree,
|
||||
Standard_Boolean ShapeAnalysis_Shell::CheckOrientedShells(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean alsofree,
|
||||
const Standard_Boolean checkinternaledges)
|
||||
{
|
||||
myConex = Standard_False;
|
||||
if (shape.IsNull()) return Standard_False;
|
||||
if (shape.IsNull())
|
||||
return Standard_False;
|
||||
Standard_Boolean res = Standard_False;
|
||||
|
||||
TopTools_IndexedMapOfShape dirs, revs, ints;
|
||||
for (TopExp_Explorer exs(shape,TopAbs_SHELL); exs.More(); exs.Next()) {
|
||||
for (TopExp_Explorer exs(shape, TopAbs_SHELL); exs.More(); exs.Next())
|
||||
{
|
||||
const TopoDS_Shape& sh = exs.Current();
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if (CheckEdges (sh,myBad,dirs,revs,ints))
|
||||
if (myShells.Add (sh)) res = Standard_True;
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (CheckEdges(sh, myBad, dirs, revs, ints))
|
||||
if (myShells.Add(sh))
|
||||
res = Standard_True;
|
||||
}
|
||||
|
||||
// Resteraient a faire les FreeEdges
|
||||
if (!alsofree) return res;
|
||||
if (!alsofree)
|
||||
return res;
|
||||
|
||||
// Free Edges . Ce sont les edges d une map pas dans l autre
|
||||
// et lycee de Versailles (les maps dirs et revs)
|
||||
Standard_Integer nb = dirs.Extent();
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
const TopoDS_Shape& sh = dirs.FindKey (i);
|
||||
if (!myBad.Contains(sh)) {
|
||||
if (!revs.Contains(sh)) {
|
||||
if(checkinternaledges) {
|
||||
if (!ints.Contains(sh)) {
|
||||
myFree.Add (sh);
|
||||
for (i = 1; i <= nb; i++)
|
||||
{
|
||||
const TopoDS_Shape& sh = dirs.FindKey(i);
|
||||
if (!myBad.Contains(sh))
|
||||
{
|
||||
if (!revs.Contains(sh))
|
||||
{
|
||||
if (checkinternaledges)
|
||||
{
|
||||
if (!ints.Contains(sh))
|
||||
{
|
||||
myFree.Add(sh);
|
||||
}
|
||||
else myConex = Standard_True;
|
||||
else
|
||||
myConex = Standard_True;
|
||||
}
|
||||
else {
|
||||
myFree.Add (sh);
|
||||
else
|
||||
{
|
||||
myFree.Add(sh);
|
||||
}
|
||||
}
|
||||
else myConex = Standard_True;
|
||||
else
|
||||
myConex = Standard_True;
|
||||
}
|
||||
else myConex = Standard_True;
|
||||
else
|
||||
myConex = Standard_True;
|
||||
}
|
||||
|
||||
nb = revs.Extent();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
const TopoDS_Shape& sh = revs.FindKey (i);
|
||||
if (!myBad.Contains(sh)) {
|
||||
if (!dirs.Contains(sh)) {
|
||||
if(checkinternaledges) {
|
||||
if (!ints.Contains(sh)) {
|
||||
myFree.Add (sh);
|
||||
for (i = 1; i <= nb; i++)
|
||||
{
|
||||
const TopoDS_Shape& sh = revs.FindKey(i);
|
||||
if (!myBad.Contains(sh))
|
||||
{
|
||||
if (!dirs.Contains(sh))
|
||||
{
|
||||
if (checkinternaledges)
|
||||
{
|
||||
if (!ints.Contains(sh))
|
||||
{
|
||||
myFree.Add(sh);
|
||||
}
|
||||
else myConex = Standard_True;
|
||||
else
|
||||
myConex = Standard_True;
|
||||
}
|
||||
else {
|
||||
myFree.Add (sh);
|
||||
else
|
||||
{
|
||||
myFree.Add(sh);
|
||||
}
|
||||
}
|
||||
else myConex = Standard_True;
|
||||
else
|
||||
myConex = Standard_True;
|
||||
}
|
||||
else myConex = Standard_True;
|
||||
else
|
||||
myConex = Standard_True;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsLoaded
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_Shell::IsLoaded(const TopoDS_Shape& shape) const
|
||||
Standard_Boolean ShapeAnalysis_Shell::IsLoaded(const TopoDS_Shape& shape) const
|
||||
{
|
||||
if (shape.IsNull()) return Standard_False;
|
||||
return myShells.Contains (shape);
|
||||
if (shape.IsNull())
|
||||
return Standard_False;
|
||||
return myShells.Contains(shape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbLoaded
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer ShapeAnalysis_Shell::NbLoaded() const
|
||||
Standard_Integer ShapeAnalysis_Shell::NbLoaded() const
|
||||
{
|
||||
return myShells.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Loaded
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
TopoDS_Shape ShapeAnalysis_Shell::Loaded(const Standard_Integer num) const
|
||||
TopoDS_Shape ShapeAnalysis_Shell::Loaded(const Standard_Integer num) const
|
||||
{
|
||||
return myShells.FindKey (num);
|
||||
return myShells.FindKey(num);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasBadEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_Shell::HasBadEdges() const
|
||||
Standard_Boolean ShapeAnalysis_Shell::HasBadEdges() const
|
||||
{
|
||||
return (myBad.Extent() > 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BadEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
TopoDS_Compound ShapeAnalysis_Shell::BadEdges() const
|
||||
TopoDS_Compound ShapeAnalysis_Shell::BadEdges() const
|
||||
{
|
||||
TopoDS_Compound C;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound (C);
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(C);
|
||||
Standard_Integer n = myBad.Extent();
|
||||
for (Standard_Integer i = 1; i <= n; i ++) B.Add (C,myBad.FindKey(i));
|
||||
for (Standard_Integer i = 1; i <= n; i++)
|
||||
B.Add(C, myBad.FindKey(i));
|
||||
return C;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasFreeEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_Shell::HasFreeEdges() const
|
||||
Standard_Boolean ShapeAnalysis_Shell::HasFreeEdges() const
|
||||
{
|
||||
return (myFree.Extent() > 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FreeEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
TopoDS_Compound ShapeAnalysis_Shell::FreeEdges() const
|
||||
TopoDS_Compound ShapeAnalysis_Shell::FreeEdges() const
|
||||
{
|
||||
TopoDS_Compound C;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound (C);
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(C);
|
||||
Standard_Integer n = myFree.Extent();
|
||||
for (Standard_Integer i = 1; i <= n; i ++) B.Add (C,myFree.FindKey(i));
|
||||
for (Standard_Integer i = 1; i <= n; i++)
|
||||
B.Add(C, myFree.FindKey(i));
|
||||
return C;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasConnectedEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_Shell::HasConnectedEdges() const
|
||||
Standard_Boolean ShapeAnalysis_Shell::HasConnectedEdges() const
|
||||
{
|
||||
return myConex;
|
||||
}
|
||||
|
@@ -25,25 +25,22 @@
|
||||
class TopoDS_Shape;
|
||||
class TopoDS_Compound;
|
||||
|
||||
|
||||
//! This class provides operators to analyze edges orientation
|
||||
//! in the shell.
|
||||
class ShapeAnalysis_Shell
|
||||
class ShapeAnalysis_Shell
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_Shell();
|
||||
|
||||
|
||||
//! Clears data about loaded shells and performed checks
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
|
||||
//! Adds shells contained in the <shape> to the list of loaded shells
|
||||
Standard_EXPORT void LoadShells (const TopoDS_Shape& shape);
|
||||
|
||||
Standard_EXPORT void LoadShells(const TopoDS_Shape& shape);
|
||||
|
||||
//! Checks if shells fulfill orientation condition, i.e. if each
|
||||
//! edge is, either present once (free edge) or twice (connected
|
||||
//! edge) but with different orientations (FORWARD/REVERSED)
|
||||
@@ -51,60 +48,44 @@ public:
|
||||
//!
|
||||
//! If <alsofree> is True free edges are considered.
|
||||
//! Free edges can be queried but are not bad
|
||||
Standard_EXPORT Standard_Boolean CheckOrientedShells (const TopoDS_Shape& shape, const Standard_Boolean alsofree = Standard_False, const Standard_Boolean checkinternaledges = Standard_False);
|
||||
|
||||
Standard_EXPORT Standard_Boolean
|
||||
CheckOrientedShells(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean alsofree = Standard_False,
|
||||
const Standard_Boolean checkinternaledges = Standard_False);
|
||||
|
||||
//! Tells if a shape is loaded (only shells are checked)
|
||||
Standard_EXPORT Standard_Boolean IsLoaded (const TopoDS_Shape& shape) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsLoaded(const TopoDS_Shape& shape) const;
|
||||
|
||||
//! Returns the actual number of loaded shapes (i.e. shells)
|
||||
Standard_EXPORT Standard_Integer NbLoaded() const;
|
||||
|
||||
|
||||
//! Returns a loaded shape specified by its rank number.
|
||||
//! Returns null shape if <num> is out of range
|
||||
Standard_EXPORT TopoDS_Shape Loaded (const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT TopoDS_Shape Loaded(const Standard_Integer num) const;
|
||||
|
||||
//! Tells if at least one edge is recorded as bad
|
||||
Standard_EXPORT Standard_Boolean HasBadEdges() const;
|
||||
|
||||
|
||||
//! Returns the list of bad edges as a Compound
|
||||
//! It is empty (not null) if no edge are recorded as bad
|
||||
Standard_EXPORT TopoDS_Compound BadEdges() const;
|
||||
|
||||
|
||||
//! Tells if at least one edge is recorded as free (not connected)
|
||||
Standard_EXPORT Standard_Boolean HasFreeEdges() const;
|
||||
|
||||
|
||||
//! Returns the list of free (not connected) edges as a Compound
|
||||
//! It is empty (not null) if no edge are recorded as free
|
||||
Standard_EXPORT TopoDS_Compound FreeEdges() const;
|
||||
|
||||
|
||||
//! Tells if at least one edge is connected (shared twice or more)
|
||||
Standard_EXPORT Standard_Boolean HasConnectedEdges() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TopTools_IndexedMapOfShape myShells;
|
||||
TopTools_IndexedMapOfShape myBad;
|
||||
TopTools_IndexedMapOfShape myFree;
|
||||
Standard_Boolean myConex;
|
||||
|
||||
|
||||
Standard_Boolean myConex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_Shell_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -59,30 +59,30 @@ class ShapeAnalysis_Surface : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an analyzer object on the basis of existing surface
|
||||
Standard_EXPORT ShapeAnalysis_Surface(const Handle(Geom_Surface)& S);
|
||||
|
||||
|
||||
//! Loads existing surface
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& S);
|
||||
|
||||
Standard_EXPORT void Init(const Handle(Geom_Surface)& S);
|
||||
|
||||
//! Reads all the data from another Surface, without recomputing
|
||||
Standard_EXPORT void Init (const Handle(ShapeAnalysis_Surface)& other);
|
||||
|
||||
Standard_EXPORT void SetDomain (const Standard_Real U1, const Standard_Real U2,
|
||||
const Standard_Real V1, const Standard_Real V2);
|
||||
|
||||
Standard_EXPORT void Init(const Handle(ShapeAnalysis_Surface)& other);
|
||||
|
||||
Standard_EXPORT void SetDomain(const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real V2);
|
||||
|
||||
//! Returns a surface being analyzed
|
||||
const Handle(Geom_Surface)& Surface() const;
|
||||
|
||||
const Handle(Geom_Surface)& Surface() const;
|
||||
|
||||
//! Returns the Adaptor.
|
||||
//! Creates it if not yet done.
|
||||
Standard_EXPORT const Handle(GeomAdaptor_Surface)& Adaptor3d();
|
||||
|
||||
|
||||
//! Returns the Adaptor (may be Null if method Adaptor() was not called)
|
||||
const Handle(GeomAdaptor_Surface)& TrueAdaptor3d() const;
|
||||
|
||||
const Handle(GeomAdaptor_Surface)& TrueAdaptor3d() const;
|
||||
|
||||
//! Returns 3D distance found by one of the following methods.
|
||||
//! IsDegenerated, DegeneratedValues, ProjectDegenerated
|
||||
//! (distance between 3D point and found or last (if not found)
|
||||
@@ -90,26 +90,26 @@ public:
|
||||
//! IsUClosed, IsVClosed (minimum value of precision to consider
|
||||
//! the surface to be closed),
|
||||
//! ValueOfUV (distance between 3D point and found solution).
|
||||
Standard_Real Gap() const;
|
||||
|
||||
Standard_Real Gap() const;
|
||||
|
||||
//! Returns a 3D point specified by parameters in surface
|
||||
//! parametrical space
|
||||
gp_Pnt Value (const Standard_Real u, const Standard_Real v);
|
||||
|
||||
gp_Pnt Value(const Standard_Real u, const Standard_Real v);
|
||||
|
||||
//! Returns a 3d point specified by a point in surface
|
||||
//! parametrical space
|
||||
gp_Pnt Value (const gp_Pnt2d& p2d);
|
||||
|
||||
gp_Pnt Value(const gp_Pnt2d& p2d);
|
||||
|
||||
//! Returns True if the surface has singularities for the given
|
||||
//! precision (i.e. if there are surface singularities with sizes
|
||||
//! not greater than precision).
|
||||
Standard_EXPORT Standard_Boolean HasSingularities (const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasSingularities(const Standard_Real preci);
|
||||
|
||||
//! Returns the number of singularities for the given precision
|
||||
//! (i.e. number of surface singularities with sizes not greater
|
||||
//! than precision).
|
||||
Standard_EXPORT Standard_Integer NbSingularities (const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT Standard_Integer NbSingularities(const Standard_Real preci);
|
||||
|
||||
//! Returns the characteristics of the singularity specified by
|
||||
//! its rank number <num>.
|
||||
//! That means, that it is not necessary for <num> to be in the
|
||||
@@ -127,35 +127,36 @@ public:
|
||||
//! uisodeg: if the degenerated iso-line is U-iso (True) or
|
||||
//! V-iso (False).
|
||||
//! Returns False if <num> is out of range, else returns True.
|
||||
Standard_EXPORT Standard_Boolean Singularity (const Standard_Integer num,
|
||||
Standard_Real& preci,
|
||||
gp_Pnt& P3d,
|
||||
gp_Pnt2d& firstP2d,
|
||||
gp_Pnt2d& lastP2d,
|
||||
Standard_Real& firstpar,
|
||||
Standard_Real& lastpar,
|
||||
Standard_Boolean& uisodeg);
|
||||
|
||||
Standard_EXPORT Standard_Boolean Singularity(const Standard_Integer num,
|
||||
Standard_Real& preci,
|
||||
gp_Pnt& P3d,
|
||||
gp_Pnt2d& firstP2d,
|
||||
gp_Pnt2d& lastP2d,
|
||||
Standard_Real& firstpar,
|
||||
Standard_Real& lastpar,
|
||||
Standard_Boolean& uisodeg);
|
||||
|
||||
//! Returns True if there is at least one surface boundary which
|
||||
//! is considered as degenerated with <preci> and distance
|
||||
//! between P3d and corresponding singular point is less than
|
||||
//! <preci>
|
||||
Standard_EXPORT Standard_Boolean IsDegenerated (const gp_Pnt& P3d, const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsDegenerated(const gp_Pnt& P3d, const Standard_Real preci);
|
||||
|
||||
//! Returns True if there is at least one surface iso-line which
|
||||
//! is considered as degenerated with <preci> and distance
|
||||
//! between P3d and corresponding singular point is less than
|
||||
//! <preci> (like IsDegenerated).
|
||||
//! Returns characteristics of the first found boundary matching
|
||||
//! those criteria.
|
||||
Standard_EXPORT Standard_Boolean DegeneratedValues (const gp_Pnt& P3d,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt2d& firstP2d,
|
||||
gp_Pnt2d& lastP2d,
|
||||
Standard_Real& firstpar,
|
||||
Standard_Real& lastpar,
|
||||
const Standard_Boolean forward = Standard_True);
|
||||
|
||||
Standard_EXPORT Standard_Boolean
|
||||
DegeneratedValues(const gp_Pnt& P3d,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt2d& firstP2d,
|
||||
gp_Pnt2d& lastP2d,
|
||||
Standard_Real& firstpar,
|
||||
Standard_Real& lastpar,
|
||||
const Standard_Boolean forward = Standard_True);
|
||||
|
||||
//! Projects a point <P3d> on a singularity by computing
|
||||
//! one of the coordinates of preliminary computed <result>.
|
||||
//!
|
||||
@@ -168,21 +169,22 @@ public:
|
||||
//! resolution (computed from <preci> by Geom_Adaptor).
|
||||
//! Then sets not yet computed <result>'s coordinate taking it
|
||||
//! from <neighbour> and returns True.
|
||||
Standard_EXPORT Standard_Boolean ProjectDegenerated (const gp_Pnt& P3d,
|
||||
const Standard_Real preci,
|
||||
const gp_Pnt2d& neighbour,
|
||||
gp_Pnt2d& result);
|
||||
|
||||
Standard_EXPORT Standard_Boolean ProjectDegenerated(const gp_Pnt& P3d,
|
||||
const Standard_Real preci,
|
||||
const gp_Pnt2d& neighbour,
|
||||
gp_Pnt2d& result);
|
||||
|
||||
//! Checks points at the beginning (direct is True) or end
|
||||
//! (direct is False) of array <points> to lie in singularity of
|
||||
//! surface, and if yes, adjusts the indeterminate 2d coordinate
|
||||
//! of these points by nearest point which is not in singularity.
|
||||
//! Returns True if some points were adjusted.
|
||||
Standard_EXPORT Standard_Boolean ProjectDegenerated (const Standard_Integer nbrPnt,
|
||||
const TColgp_SequenceOfPnt& points,
|
||||
TColgp_SequenceOfPnt2d& pnt2d,
|
||||
const Standard_Real preci, const Standard_Boolean direct);
|
||||
|
||||
Standard_EXPORT Standard_Boolean ProjectDegenerated(const Standard_Integer nbrPnt,
|
||||
const TColgp_SequenceOfPnt& points,
|
||||
TColgp_SequenceOfPnt2d& pnt2d,
|
||||
const Standard_Real preci,
|
||||
const Standard_Boolean direct);
|
||||
|
||||
//! Returns True if straight pcurve going from point p2d1 to p2d2
|
||||
//! is degenerate, i.e. lies in the singularity of the surface.
|
||||
//! NOTE: it uses another method of detecting singularity than
|
||||
@@ -196,27 +198,29 @@ public:
|
||||
//! the Resolution computed from max distance in 3d
|
||||
//! (max3d < tol && max2d > ratio * Resolution(max3d))
|
||||
//! NOTE: <ratio> should be >1 (e.g. 10)
|
||||
Standard_EXPORT Standard_Boolean IsDegenerated (const gp_Pnt2d& p2d1,
|
||||
const gp_Pnt2d& p2d2,
|
||||
const Standard_Real tol,
|
||||
const Standard_Real ratio);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsDegenerated(const gp_Pnt2d& p2d1,
|
||||
const gp_Pnt2d& p2d2,
|
||||
const Standard_Real tol,
|
||||
const Standard_Real ratio);
|
||||
|
||||
//! Returns the bounds of the surface
|
||||
//! (from Bounds from Surface, but buffered)
|
||||
void Bounds (Standard_Real& ufirst, Standard_Real& ulast,
|
||||
Standard_Real& vfirst, Standard_Real& vlast) const;
|
||||
|
||||
void Bounds(Standard_Real& ufirst,
|
||||
Standard_Real& ulast,
|
||||
Standard_Real& vfirst,
|
||||
Standard_Real& vlast) const;
|
||||
|
||||
//! Computes bound isos (protected against exceptions)
|
||||
Standard_EXPORT void ComputeBoundIsos();
|
||||
|
||||
|
||||
//! Returns a U-Iso. Null if not possible or failed
|
||||
//! Remark : bound isos are buffered
|
||||
Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U);
|
||||
|
||||
Standard_EXPORT Handle(Geom_Curve) UIso(const Standard_Real U);
|
||||
|
||||
//! Returns a V-Iso. Null if not possible or failed
|
||||
//! Remark : bound isos are buffered
|
||||
Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V);
|
||||
|
||||
Standard_EXPORT Handle(Geom_Curve) VIso(const Standard_Real V);
|
||||
|
||||
//! Tells if the Surface is spatially closed in U with given
|
||||
//! precision. If <preci> < 0 then Precision::Confusion is used.
|
||||
//! If Geom_Surface says that the surface is U-closed, this method
|
||||
@@ -232,8 +236,8 @@ public:
|
||||
//! curve,
|
||||
//! - other (RectangularTrimmed and Offset) - maximum distance
|
||||
//! computed at 100 equi-distanted points.
|
||||
Standard_EXPORT Standard_Boolean IsUClosed (const Standard_Real preci = -1);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsUClosed(const Standard_Real preci = -1);
|
||||
|
||||
//! Tells if the Surface is spatially closed in V with given
|
||||
//! precision. If <preci> < 0 then Precision::Confusion is used.
|
||||
//! If Geom_Surface says that the surface is V-closed, this method
|
||||
@@ -249,8 +253,8 @@ public:
|
||||
//! curve,
|
||||
//! - other (RectangularTrimmed and Offset) - maximum distance
|
||||
//! computed at 100 equi-distanted points.
|
||||
Standard_EXPORT Standard_Boolean IsVClosed (const Standard_Real preci = -1);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsVClosed(const Standard_Real preci = -1);
|
||||
|
||||
//! Computes the parameters in the surface parametrical space of
|
||||
//! 3D point.
|
||||
//! The result is parameters of the point projected onto the
|
||||
@@ -259,8 +263,8 @@ public:
|
||||
//! tool GeomAPI_ProjectPointOnSurface by treatment of cases when
|
||||
//! the projected point is near to the surface boundaries and
|
||||
//! when this standard tool fails.
|
||||
Standard_EXPORT gp_Pnt2d ValueOfUV (const gp_Pnt& P3D, const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT gp_Pnt2d ValueOfUV(const gp_Pnt& P3D, const Standard_Real preci);
|
||||
|
||||
//! Projects a point P3D on the surface.
|
||||
//! Does the same thing as ValueOfUV but tries to optimize
|
||||
//! computations by taking into account previous point <p2dPrev>:
|
||||
@@ -269,11 +273,11 @@ public:
|
||||
//! P3D is greater than <maxpreci>, that solution is considered
|
||||
//! as bad, and ValueOfUV() is used.
|
||||
//! If not succeeded, calls ValueOfUV()
|
||||
Standard_EXPORT gp_Pnt2d NextValueOfUV (const gp_Pnt2d& p2dPrev,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
const Standard_Real maxpreci = -1.0);
|
||||
|
||||
Standard_EXPORT gp_Pnt2d NextValueOfUV(const gp_Pnt2d& p2dPrev,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
const Standard_Real maxpreci = -1.0);
|
||||
|
||||
//! Tries a refinement of an already computed couple (U,V) by
|
||||
//! using projecting 3D point on iso-lines:
|
||||
//! 1. boundaries of the surface,
|
||||
@@ -283,69 +287,61 @@ public:
|
||||
//! direction)
|
||||
//! Returns the best resulting distance between P3D and Value(U,V)
|
||||
//! in the case of success. Else, returns a very great value
|
||||
Standard_EXPORT Standard_Real UVFromIso (const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V);
|
||||
|
||||
Standard_EXPORT Standard_Real UVFromIso(const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V);
|
||||
|
||||
//! Returns minimum value to consider the surface as U-closed
|
||||
Standard_Real UCloseVal() const;
|
||||
|
||||
Standard_Real UCloseVal() const;
|
||||
|
||||
//! Returns minimum value to consider the surface as V-closed
|
||||
Standard_Real VCloseVal() const;
|
||||
|
||||
Standard_Real VCloseVal() const;
|
||||
|
||||
Standard_EXPORT const Bnd_Box& GetBoxUF();
|
||||
|
||||
|
||||
Standard_EXPORT const Bnd_Box& GetBoxUL();
|
||||
|
||||
|
||||
Standard_EXPORT const Bnd_Box& GetBoxVF();
|
||||
|
||||
|
||||
Standard_EXPORT const Bnd_Box& GetBoxVL();
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_Surface,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_Surface, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Handle(Geom_Surface) mySurf;
|
||||
Handle(Geom_Surface) mySurf;
|
||||
Handle(GeomAdaptor_Surface) myAdSur;
|
||||
Extrema_ExtPS myExtPS;
|
||||
Standard_Boolean myExtOK;
|
||||
Standard_Integer myNbDeg;
|
||||
Standard_Real myPreci[4];
|
||||
gp_Pnt myP3d[4];
|
||||
gp_Pnt2d myFirstP2d[4];
|
||||
gp_Pnt2d myLastP2d[4];
|
||||
Standard_Real myFirstPar[4];
|
||||
Standard_Real myLastPar[4];
|
||||
Standard_Boolean myUIsoDeg[4];
|
||||
Standard_Boolean myIsos;
|
||||
Standard_Real myUF;
|
||||
Standard_Real myUL;
|
||||
Standard_Real myVF;
|
||||
Standard_Real myVL;
|
||||
Handle(Geom_Curve) myIsoUF;
|
||||
Handle(Geom_Curve) myIsoUL;
|
||||
Handle(Geom_Curve) myIsoVF;
|
||||
Handle(Geom_Curve) myIsoVL;
|
||||
Standard_Boolean myIsoBoxes;
|
||||
Bnd_Box myBndUF;
|
||||
Bnd_Box myBndUL;
|
||||
Bnd_Box myBndVF;
|
||||
Bnd_Box myBndVL;
|
||||
Standard_Real myGap;
|
||||
Standard_Real myUDelt;
|
||||
Standard_Real myVDelt;
|
||||
Standard_Real myUCloseVal;
|
||||
Standard_Real myVCloseVal;
|
||||
|
||||
Extrema_ExtPS myExtPS;
|
||||
Standard_Boolean myExtOK;
|
||||
Standard_Integer myNbDeg;
|
||||
Standard_Real myPreci[4];
|
||||
gp_Pnt myP3d[4];
|
||||
gp_Pnt2d myFirstP2d[4];
|
||||
gp_Pnt2d myLastP2d[4];
|
||||
Standard_Real myFirstPar[4];
|
||||
Standard_Real myLastPar[4];
|
||||
Standard_Boolean myUIsoDeg[4];
|
||||
Standard_Boolean myIsos;
|
||||
Standard_Real myUF;
|
||||
Standard_Real myUL;
|
||||
Standard_Real myVF;
|
||||
Standard_Real myVL;
|
||||
Handle(Geom_Curve) myIsoUF;
|
||||
Handle(Geom_Curve) myIsoUL;
|
||||
Handle(Geom_Curve) myIsoVF;
|
||||
Handle(Geom_Curve) myIsoVL;
|
||||
Standard_Boolean myIsoBoxes;
|
||||
Bnd_Box myBndUF;
|
||||
Bnd_Box myBndUL;
|
||||
Bnd_Box myBndVF;
|
||||
Bnd_Box myBndVL;
|
||||
Standard_Real myGap;
|
||||
Standard_Real myUDelt;
|
||||
Standard_Real myVDelt;
|
||||
Standard_Real myUCloseVal;
|
||||
Standard_Real myVCloseVal;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Computes singularities on the surface.
|
||||
//! Computes the sizes of boundaries or singular ares of the
|
||||
//! surface. Then each boundary or area is considered as
|
||||
@@ -363,26 +359,18 @@ private:
|
||||
//! points, precisions are maximum distance between corners
|
||||
//! and middle point on the boundary
|
||||
Standard_EXPORT void ComputeSingularities();
|
||||
|
||||
|
||||
Standard_EXPORT void ComputeBoxes();
|
||||
|
||||
//! @return 0, 1 or 2.
|
||||
Standard_EXPORT Standard_Integer SurfaceNewton (const gp_Pnt2d& p2dPrev,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt2d& sol);
|
||||
Standard_EXPORT Standard_Integer SurfaceNewton(const gp_Pnt2d& p2dPrev,
|
||||
const gp_Pnt& P3D,
|
||||
const Standard_Real preci,
|
||||
gp_Pnt2d& sol);
|
||||
|
||||
Standard_EXPORT void SortSingularities();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <ShapeAnalysis_Surface.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_Surface_HeaderFile
|
||||
|
@@ -15,8 +15,8 @@
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Surface
|
||||
//purpose :
|
||||
// function : Surface
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(Geom_Surface)& ShapeAnalysis_Surface::Surface() const
|
||||
@@ -24,10 +24,9 @@ inline const Handle(Geom_Surface)& ShapeAnalysis_Surface::Surface() const
|
||||
return mySurf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TrueAdaptor3d
|
||||
//purpose :
|
||||
// function : TrueAdaptor3d
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(GeomAdaptor_Surface)& ShapeAnalysis_Surface::TrueAdaptor3d() const
|
||||
@@ -35,10 +34,9 @@ inline const Handle(GeomAdaptor_Surface)& ShapeAnalysis_Surface::TrueAdaptor3d()
|
||||
return myAdSur;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Gap
|
||||
//purpose :
|
||||
// function : Gap
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Surface::Gap() const
|
||||
@@ -46,39 +44,35 @@ inline Standard_Real ShapeAnalysis_Surface::Gap() const
|
||||
return myGap;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
// function : Value
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline gp_Pnt ShapeAnalysis_Surface::Value (const Standard_Real u,
|
||||
const Standard_Real v)
|
||||
inline gp_Pnt ShapeAnalysis_Surface::Value(const Standard_Real u, const Standard_Real v)
|
||||
{
|
||||
return myAdSur->Value ( u, v );
|
||||
return myAdSur->Value(u, v);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
// function : Value
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline gp_Pnt ShapeAnalysis_Surface::Value(const gp_Pnt2d& p2d)
|
||||
inline gp_Pnt ShapeAnalysis_Surface::Value(const gp_Pnt2d& p2d)
|
||||
{
|
||||
return myAdSur->Value ( p2d.X(), p2d.Y() );
|
||||
return myAdSur->Value(p2d.X(), p2d.Y());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Bounds
|
||||
//purpose :
|
||||
// function : Bounds
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void ShapeAnalysis_Surface::Bounds (Standard_Real& ufirst,
|
||||
Standard_Real& ulast,
|
||||
Standard_Real& vfirst,
|
||||
Standard_Real& vlast) const
|
||||
inline void ShapeAnalysis_Surface::Bounds(Standard_Real& ufirst,
|
||||
Standard_Real& ulast,
|
||||
Standard_Real& vfirst,
|
||||
Standard_Real& vlast) const
|
||||
{
|
||||
ufirst = myUF;
|
||||
ulast = myUL;
|
||||
@@ -87,8 +81,8 @@ inline void ShapeAnalysis_Surface::Bounds (Standard_Real& ufirst,
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UCloseVal
|
||||
//purpose :
|
||||
// function : UCloseVal
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Surface::UCloseVal() const
|
||||
@@ -97,8 +91,8 @@ inline Standard_Real ShapeAnalysis_Surface::UCloseVal() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : VCloseVal
|
||||
//purpose :
|
||||
// function : VCloseVal
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Surface::VCloseVal() const
|
||||
|
@@ -11,7 +11,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
@@ -23,147 +22,123 @@
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ShapeAnalysis_TransferParameters,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ShapeAnalysis_TransferParameters, Standard_Transient)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_TransferParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
ShapeAnalysis_TransferParameters::ShapeAnalysis_TransferParameters()
|
||||
{
|
||||
myScale = 1.;
|
||||
myShift = 0.;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_TransferParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
ShapeAnalysis_TransferParameters::ShapeAnalysis_TransferParameters(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
Init(E,F);
|
||||
Init(E, F);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_TransferParameters::Init(const TopoDS_Edge& E, const TopoDS_Face& F)
|
||||
void ShapeAnalysis_TransferParameters::Init(const TopoDS_Edge& E, const TopoDS_Face& F)
|
||||
{
|
||||
myScale = 1.;
|
||||
myShift = 0.;
|
||||
Standard_Real l,f,l2d = 0.0,f2d = 0.0;
|
||||
Standard_Real l, f, l2d = 0.0, f2d = 0.0;
|
||||
TopLoc_Location L;
|
||||
myEdge = E;
|
||||
ShapeAnalysis_Edge sae;
|
||||
Handle(Geom_Curve) curve3d;// = BRep_Tool::Curve (E,f,l);
|
||||
sae.Curve3d ( E, curve3d, f, l ,Standard_False);
|
||||
Handle(Geom_Curve) curve3d; // = BRep_Tool::Curve (E,f,l);
|
||||
sae.Curve3d(E, curve3d, f, l, Standard_False);
|
||||
myFirst = f;
|
||||
myLast = l;
|
||||
Handle(Geom2d_Curve) curve2d;// = BRep_Tool::CurveOnSurface (E, F, f2d,l2d);
|
||||
myLast = l;
|
||||
Handle(Geom2d_Curve) curve2d; // = BRep_Tool::CurveOnSurface (E, F, f2d,l2d);
|
||||
// ShapeAnalysis_Edge sae;
|
||||
if (! F.IsNull() ) { // process free edges
|
||||
sae.PCurve ( E, F, curve2d, f2d, l2d,Standard_False );
|
||||
if (!F.IsNull())
|
||||
{ // process free edges
|
||||
sae.PCurve(E, F, curve2d, f2d, l2d, Standard_False);
|
||||
}
|
||||
myFirst2d = f2d;
|
||||
myLast2d = l2d;
|
||||
myFace = F;
|
||||
if ( curve3d.IsNull() || curve2d.IsNull() ) return;
|
||||
myLast2d = l2d;
|
||||
myFace = F;
|
||||
if (curve3d.IsNull() || curve2d.IsNull())
|
||||
return;
|
||||
|
||||
Standard_Real ln2d = l2d - f2d;
|
||||
Standard_Real ln3d = l - f;
|
||||
myScale = ( ln3d <= gp::Resolution() ? 1. : ln2d / ln3d );
|
||||
myShift = f2d - f * myScale;
|
||||
Standard_Real ln2d = l2d - f2d;
|
||||
Standard_Real ln3d = l - f;
|
||||
myScale = (ln3d <= gp::Resolution() ? 1. : ln2d / ln3d);
|
||||
myShift = f2d - f * myScale;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMaxTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_TransferParameters::SetMaxTolerance( const Standard_Real maxtol )
|
||||
void ShapeAnalysis_TransferParameters::SetMaxTolerance(const Standard_Real maxtol)
|
||||
{
|
||||
myMaxTolerance = maxtol;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
|
||||
Handle(TColStd_HSequenceOfReal) ShapeAnalysis_TransferParameters::Perform
|
||||
(const Handle(TColStd_HSequenceOfReal)& Params,
|
||||
const Standard_Boolean To2d)
|
||||
Handle(TColStd_HSequenceOfReal) ShapeAnalysis_TransferParameters::Perform(
|
||||
const Handle(TColStd_HSequenceOfReal)& Params,
|
||||
const Standard_Boolean To2d)
|
||||
{
|
||||
Handle(TColStd_HSequenceOfReal) res = new TColStd_HSequenceOfReal;
|
||||
for (Standard_Integer i = 1 ; i <= Params->Length(); i++)
|
||||
res->Append(Perform(Params->Value(i),To2d));
|
||||
return res;
|
||||
|
||||
for (Standard_Integer i = 1; i <= Params->Length(); i++)
|
||||
res->Append(Perform(Params->Value(i), To2d));
|
||||
return res;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis_TransferParameters::Perform(const Standard_Real Param,
|
||||
const Standard_Boolean To2d)
|
||||
Standard_Real ShapeAnalysis_TransferParameters::Perform(const Standard_Real Param,
|
||||
const Standard_Boolean To2d)
|
||||
{
|
||||
Standard_Real NewParam;
|
||||
if(To2d)
|
||||
NewParam = myShift + Param*myScale;
|
||||
if (To2d)
|
||||
NewParam = myShift + Param * myScale;
|
||||
else
|
||||
NewParam = -myShift/myScale + Param*1./myScale;
|
||||
NewParam = -myShift / myScale + Param * 1. / myScale;
|
||||
return NewParam;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeAnalysis_TransferParameters::TransferRange(TopoDS_Edge& newEdge,
|
||||
const Standard_Real prevPar,
|
||||
const Standard_Real currPar,
|
||||
const Standard_Boolean Is2d)
|
||||
void ShapeAnalysis_TransferParameters::TransferRange(TopoDS_Edge& newEdge,
|
||||
const Standard_Real prevPar,
|
||||
const Standard_Real currPar,
|
||||
const Standard_Boolean Is2d)
|
||||
{
|
||||
ShapeBuild_Edge sbe;
|
||||
if(Is2d) {
|
||||
Standard_Real span2d = myLast2d - myFirst2d;
|
||||
Standard_Real tmp1,tmp2;
|
||||
if(prevPar > currPar) {
|
||||
if (Is2d)
|
||||
{
|
||||
Standard_Real span2d = myLast2d - myFirst2d;
|
||||
Standard_Real tmp1, tmp2;
|
||||
if (prevPar > currPar)
|
||||
{
|
||||
tmp1 = currPar;
|
||||
tmp2 = prevPar;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
tmp1 = prevPar;
|
||||
tmp2 = currPar;
|
||||
}
|
||||
Standard_Real alpha = (tmp1-myFirst2d) / span2d;
|
||||
Standard_Real alpha = (tmp1 - myFirst2d) / span2d;
|
||||
Standard_Real beta = (tmp2 - myFirst2d) / span2d;
|
||||
sbe.CopyRanges(newEdge,myEdge, alpha, beta);
|
||||
sbe.CopyRanges(newEdge, myEdge, alpha, beta);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real alpha = (prevPar - myFirst) / (myLast - myFirst);
|
||||
Standard_Real beta = (currPar - myFirst) / (myLast - myFirst);
|
||||
sbe.CopyRanges(newEdge, myEdge, alpha, beta);
|
||||
}
|
||||
else {
|
||||
Standard_Real alpha = (prevPar-myFirst)/(myLast - myFirst);
|
||||
Standard_Real beta = (currPar - myFirst)/(myLast - myFirst);
|
||||
sbe.CopyRanges(newEdge,myEdge, alpha, beta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSameRange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_TransferParameters::IsSameRange() const
|
||||
{
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColStd_HSequenceOfReal.hxx>
|
||||
|
||||
|
||||
class ShapeAnalysis_TransferParameters;
|
||||
DEFINE_STANDARD_HANDLE(ShapeAnalysis_TransferParameters, Standard_Transient)
|
||||
|
||||
@@ -48,67 +47,55 @@ class ShapeAnalysis_TransferParameters : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates empty tool with myShift = 0 and myScale = 1
|
||||
Standard_EXPORT ShapeAnalysis_TransferParameters();
|
||||
|
||||
|
||||
//! Creates a tool and initializes it with edge and face
|
||||
Standard_EXPORT ShapeAnalysis_TransferParameters(const TopoDS_Edge& E, const TopoDS_Face& F);
|
||||
|
||||
|
||||
//! Initialize a tool with edge and face
|
||||
Standard_EXPORT virtual void Init (const TopoDS_Edge& E, const TopoDS_Face& F);
|
||||
|
||||
Standard_EXPORT virtual void Init(const TopoDS_Edge& E, const TopoDS_Face& F);
|
||||
|
||||
//! Sets maximal tolerance to use linear recomputation of
|
||||
//! parameters.
|
||||
Standard_EXPORT void SetMaxTolerance (const Standard_Real maxtol);
|
||||
|
||||
Standard_EXPORT void SetMaxTolerance(const Standard_Real maxtol);
|
||||
|
||||
//! Transfers parameters given by sequence Params from 3d curve
|
||||
//! to pcurve (if To2d is True) or back (if To2d is False)
|
||||
Standard_EXPORT virtual Handle(TColStd_HSequenceOfReal) Perform (const Handle(TColStd_HSequenceOfReal)& Params, const Standard_Boolean To2d);
|
||||
|
||||
Standard_EXPORT virtual Handle(TColStd_HSequenceOfReal) Perform(
|
||||
const Handle(TColStd_HSequenceOfReal)& Params,
|
||||
const Standard_Boolean To2d);
|
||||
|
||||
//! Transfers parameter given by sequence Params from 3d curve
|
||||
//! to pcurve (if To2d is True) or back (if To2d is False)
|
||||
Standard_EXPORT virtual Standard_Real Perform (const Standard_Real Param, const Standard_Boolean To2d);
|
||||
|
||||
Standard_EXPORT virtual Standard_Real Perform(const Standard_Real Param,
|
||||
const Standard_Boolean To2d);
|
||||
|
||||
//! Recomputes range of curves from NewEdge.
|
||||
//! If Is2d equals True parameters are recomputed by curve2d else by curve3d.
|
||||
Standard_EXPORT virtual void TransferRange (TopoDS_Edge& newEdge, const Standard_Real prevPar, const Standard_Real currPar, const Standard_Boolean To2d);
|
||||
|
||||
Standard_EXPORT virtual void TransferRange(TopoDS_Edge& newEdge,
|
||||
const Standard_Real prevPar,
|
||||
const Standard_Real currPar,
|
||||
const Standard_Boolean To2d);
|
||||
|
||||
//! Returns True if 3d curve of edge and pcurve are SameRange
|
||||
//! (in default implementation, if myScale == 1 and myShift == 0)
|
||||
Standard_EXPORT virtual Standard_Boolean IsSameRange() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_TransferParameters,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_TransferParameters, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Standard_Real myFirst;
|
||||
Standard_Real myLast;
|
||||
TopoDS_Edge myEdge;
|
||||
TopoDS_Edge myEdge;
|
||||
Standard_Real myMaxTolerance;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myShift;
|
||||
Standard_Real myScale;
|
||||
Standard_Real myFirst2d;
|
||||
Standard_Real myLast2d;
|
||||
TopoDS_Face myFace;
|
||||
|
||||
|
||||
TopoDS_Face myFace;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_TransferParameters_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,6 @@ class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Vertex;
|
||||
|
||||
|
||||
class ShapeAnalysis_TransferParametersProj;
|
||||
DEFINE_STANDARD_HANDLE(ShapeAnalysis_TransferParametersProj, ShapeAnalysis_TransferParameters)
|
||||
|
||||
@@ -43,76 +42,70 @@ class ShapeAnalysis_TransferParametersProj : public ShapeAnalysis_TransferParame
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates empty constructor.
|
||||
Standard_EXPORT ShapeAnalysis_TransferParametersProj();
|
||||
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_TransferParametersProj(const TopoDS_Edge& E, const TopoDS_Face& F);
|
||||
|
||||
Standard_EXPORT virtual void Init (const TopoDS_Edge& E, const TopoDS_Face& F) Standard_OVERRIDE;
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Init(const TopoDS_Edge& E, const TopoDS_Face& F) Standard_OVERRIDE;
|
||||
|
||||
//! Transfers parameters given by sequence Params from 3d curve
|
||||
//! to pcurve (if To2d is True) or back (if To2d is False)
|
||||
Standard_EXPORT virtual Handle(TColStd_HSequenceOfReal) Perform (const Handle(TColStd_HSequenceOfReal)& Papams, const Standard_Boolean To2d) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(TColStd_HSequenceOfReal) Perform(
|
||||
const Handle(TColStd_HSequenceOfReal)& Papams,
|
||||
const Standard_Boolean To2d) Standard_OVERRIDE;
|
||||
|
||||
//! Transfers parameter given by Param from 3d curve
|
||||
//! to pcurve (if To2d is True) or back (if To2d is False)
|
||||
Standard_EXPORT virtual Standard_Real Perform (const Standard_Real Param, const Standard_Boolean To2d) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real Perform(const Standard_Real Param,
|
||||
const Standard_Boolean To2d) Standard_OVERRIDE;
|
||||
|
||||
//! Returns modifiable flag forcing projection
|
||||
//! If it is False (default), projection is done only
|
||||
//! if edge is not SameParameter or if tolerance of edge
|
||||
//! is greater than MaxTolerance()
|
||||
Standard_EXPORT Standard_Boolean& ForceProjection();
|
||||
|
||||
|
||||
//! Recomputes range of curves from NewEdge.
|
||||
//! If Is2d equals True parameters are recomputed by curve2d else by curve3d.
|
||||
Standard_EXPORT virtual void TransferRange (TopoDS_Edge& newEdge, const Standard_Real prevPar, const Standard_Real currPar, const Standard_Boolean Is2d) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void TransferRange(TopoDS_Edge& newEdge,
|
||||
const Standard_Real prevPar,
|
||||
const Standard_Real currPar,
|
||||
const Standard_Boolean Is2d) Standard_OVERRIDE;
|
||||
|
||||
//! Returns False;
|
||||
Standard_EXPORT virtual Standard_Boolean IsSameRange() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Make a copy of non-manifold vertex theVert
|
||||
//! (i.e. create new TVertex and replace PointRepresentations for this vertex
|
||||
//! from fromedge to toedge. Other representations were copied)
|
||||
Standard_EXPORT static TopoDS_Vertex CopyNMVertex (const TopoDS_Vertex& theVert, const TopoDS_Edge& toedge, const TopoDS_Edge& fromedge);
|
||||
|
||||
Standard_EXPORT static TopoDS_Vertex CopyNMVertex(const TopoDS_Vertex& theVert,
|
||||
const TopoDS_Edge& toedge,
|
||||
const TopoDS_Edge& fromedge);
|
||||
|
||||
//! Make a copy of non-manifold vertex theVert
|
||||
//! (i.e. create new TVertex and replace PointRepresentations for this vertex
|
||||
//! from fromFace to toFace. Other representations were copied)
|
||||
Standard_EXPORT static TopoDS_Vertex CopyNMVertex (const TopoDS_Vertex& theVert, const TopoDS_Face& toFace, const TopoDS_Face& fromFace);
|
||||
Standard_EXPORT static TopoDS_Vertex CopyNMVertex(const TopoDS_Vertex& theVert,
|
||||
const TopoDS_Face& toFace,
|
||||
const TopoDS_Face& fromFace);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_TransferParametersProj,ShapeAnalysis_TransferParameters)
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_TransferParametersProj, ShapeAnalysis_TransferParameters)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
Standard_EXPORT Standard_Real PreformSegment(const Standard_Real Param,
|
||||
const Standard_Boolean To2d,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last);
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real PreformSegment (const Standard_Real Param, const Standard_Boolean To2d, const Standard_Real First, const Standard_Real Last);
|
||||
|
||||
Handle(Geom_Curve) myCurve;
|
||||
Handle(Geom2d_Curve) myCurve2d;
|
||||
Handle(Geom_Curve) myCurve;
|
||||
Handle(Geom2d_Curve) myCurve2d;
|
||||
Adaptor3d_CurveOnSurface myAC3d;
|
||||
Standard_Real myPrecision;
|
||||
TopLoc_Location myLocation;
|
||||
Standard_Boolean myForceProj;
|
||||
Standard_Boolean myInitOK;
|
||||
|
||||
|
||||
Standard_Real myPrecision;
|
||||
TopLoc_Location myLocation;
|
||||
Standard_Boolean myForceProj;
|
||||
Standard_Boolean myInitOK;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_TransferParametersProj_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -90,69 +90,76 @@ class ShapeAnalysis_Wire : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_Wire();
|
||||
|
||||
|
||||
//! Creates object with standard TopoDS_Wire, face
|
||||
//! and precision
|
||||
Standard_EXPORT ShapeAnalysis_Wire(const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real precision);
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_Wire(const TopoDS_Wire& wire,
|
||||
const TopoDS_Face& face,
|
||||
const Standard_Real precision);
|
||||
|
||||
//! Creates the object with WireData object, face
|
||||
//! and precision
|
||||
Standard_EXPORT ShapeAnalysis_Wire(const Handle(ShapeExtend_WireData)& sbwd, const TopoDS_Face& face, const Standard_Real precision);
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_Wire(const Handle(ShapeExtend_WireData)& sbwd,
|
||||
const TopoDS_Face& face,
|
||||
const Standard_Real precision);
|
||||
|
||||
//! Initializes the object with standard TopoDS_Wire, face
|
||||
//! and precision
|
||||
Standard_EXPORT void Init (const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real precision);
|
||||
|
||||
Standard_EXPORT void Init(const TopoDS_Wire& wire,
|
||||
const TopoDS_Face& face,
|
||||
const Standard_Real precision);
|
||||
|
||||
//! Initializes the object with WireData object, face
|
||||
//! and precision
|
||||
Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& sbwd, const TopoDS_Face& face, const Standard_Real precision);
|
||||
|
||||
Standard_EXPORT void Init(const Handle(ShapeExtend_WireData)& sbwd,
|
||||
const TopoDS_Face& face,
|
||||
const Standard_Real precision);
|
||||
|
||||
//! Loads the object with standard TopoDS_Wire
|
||||
Standard_EXPORT void Load (const TopoDS_Wire& wire);
|
||||
|
||||
Standard_EXPORT void Load(const TopoDS_Wire& wire);
|
||||
|
||||
//! Loads the object with WireData object
|
||||
Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
|
||||
|
||||
Standard_EXPORT void Load(const Handle(ShapeExtend_WireData)& sbwd);
|
||||
|
||||
//! Loads the face the wire lies on
|
||||
Standard_EXPORT void SetFace (const TopoDS_Face& face);
|
||||
|
||||
Standard_EXPORT void SetFace(const TopoDS_Face& face);
|
||||
|
||||
//! Loads the surface the wire lies on
|
||||
Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& surface);
|
||||
|
||||
Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& surface);
|
||||
|
||||
//! Loads the surface the wire lies on
|
||||
Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& surface, const TopLoc_Location& location);
|
||||
|
||||
Standard_EXPORT void SetPrecision (const Standard_Real precision);
|
||||
|
||||
Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& surface,
|
||||
const TopLoc_Location& location);
|
||||
|
||||
Standard_EXPORT void SetPrecision(const Standard_Real precision);
|
||||
|
||||
//! Unsets all the status and distance fields
|
||||
//! wire, face and precision are not cleared
|
||||
Standard_EXPORT void ClearStatuses();
|
||||
|
||||
|
||||
//! Returns True if wire is loaded and has number of edges >0
|
||||
Standard_Boolean IsLoaded() const;
|
||||
|
||||
Standard_Boolean IsLoaded() const;
|
||||
|
||||
//! Returns True if IsLoaded and underlying face is not null
|
||||
Standard_Boolean IsReady() const;
|
||||
|
||||
Standard_Boolean IsReady() const;
|
||||
|
||||
//! Returns the value of precision
|
||||
Standard_Real Precision() const;
|
||||
|
||||
Standard_Real Precision() const;
|
||||
|
||||
//! Returns wire object being analyzed
|
||||
const Handle(ShapeExtend_WireData)& WireData() const;
|
||||
|
||||
const Handle(ShapeExtend_WireData)& WireData() const;
|
||||
|
||||
//! Returns the number of edges in the wire, or 0 if it is not loaded
|
||||
Standard_Integer NbEdges() const;
|
||||
|
||||
Standard_Integer NbEdges() const;
|
||||
|
||||
//! Returns the working face
|
||||
const TopoDS_Face& Face() const;
|
||||
|
||||
const TopoDS_Face& Face() const;
|
||||
|
||||
//! Returns the working surface
|
||||
const Handle(ShapeAnalysis_Surface)& Surface() const;
|
||||
|
||||
const Handle(ShapeAnalysis_Surface)& Surface() const;
|
||||
|
||||
//! Performs all the checks in the following order :
|
||||
//! CheckOrder, CheckSmall, CheckConnected, CheckEdgeCurves,
|
||||
//! CheckDegenerated, CheckSelfIntersection, CheckLacking,
|
||||
@@ -160,22 +167,23 @@ public:
|
||||
//! Returns: True if at least one method returned True;
|
||||
//! For deeper analysis use Status...(status) methods
|
||||
Standard_EXPORT Standard_Boolean Perform();
|
||||
|
||||
|
||||
//! Calls CheckOrder and returns False if wire is already
|
||||
//! ordered (tail-to-head), True otherwise
|
||||
//! Flag <isClosed> defines if the wire is closed or not
|
||||
//! Flag <mode3d> defines which mode is used (3d or 2d)
|
||||
Standard_EXPORT Standard_Boolean CheckOrder (const Standard_Boolean isClosed = Standard_True, const Standard_Boolean mode3d = Standard_True);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckOrder(const Standard_Boolean isClosed = Standard_True,
|
||||
const Standard_Boolean mode3d = Standard_True);
|
||||
|
||||
//! Calls to CheckConnected for each edge
|
||||
//! Returns: True if at least one pair of disconnected edges (not sharing the
|
||||
//! same vertex) was detected
|
||||
Standard_EXPORT Standard_Boolean CheckConnected (const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckConnected(const Standard_Real prec = 0.0);
|
||||
|
||||
//! Calls to CheckSmall for each edge
|
||||
//! Returns: True if at least one small edge was detected
|
||||
Standard_EXPORT Standard_Boolean CheckSmall (const Standard_Real precsmall = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSmall(const Standard_Real precsmall = 0.0);
|
||||
|
||||
//! Checks edges geometry (consistency of 2d and 3d senses, adjasment
|
||||
//! of curves to the vertices, etc.).
|
||||
//! The order of the checks :
|
||||
@@ -192,19 +200,19 @@ public:
|
||||
//! Remark: The numbers in brackets show with what DONEi or FAILi
|
||||
//! the status can be queried
|
||||
Standard_EXPORT Standard_Boolean CheckEdgeCurves();
|
||||
|
||||
|
||||
//! Calls to CheckDegenerated for each edge
|
||||
//! Returns: True if at least one incorrect degenerated edge was detected
|
||||
Standard_EXPORT Standard_Boolean CheckDegenerated();
|
||||
|
||||
|
||||
//! Checks if wire is closed, performs CheckConnected,
|
||||
//! CheckDegenerated and CheckLacking for the first and the last edges
|
||||
//! Returns: True if at least one check returned True
|
||||
//! Status:
|
||||
//! FAIL1 or DONE1: see CheckConnected
|
||||
//! FAIL2 or DONE2: see CheckDegenerated
|
||||
Standard_EXPORT Standard_Boolean CheckClosed (const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckClosed(const Standard_Real prec = 0.0);
|
||||
|
||||
//! Checks self-intersection of the wire (considering pcurves)
|
||||
//! Looks for self-intersecting edges and each pair of intersecting
|
||||
//! edges.
|
||||
@@ -216,17 +224,17 @@ public:
|
||||
//! Status: FAIL1 or DONE1 - see CheckSelfIntersectingEdge
|
||||
//! FAIL2 or DONE2 - see CheckIntersectingEdges
|
||||
Standard_EXPORT Standard_Boolean CheckSelfIntersection();
|
||||
|
||||
|
||||
//! Calls to CheckLacking for each edge
|
||||
//! Returns: True if at least one lacking edge was detected
|
||||
Standard_EXPORT Standard_Boolean CheckLacking();
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckGaps3d();
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckGaps2d();
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckCurveGaps();
|
||||
|
||||
|
||||
//! Analyzes the order of the edges in the wire,
|
||||
//! uses class WireOrder for that purpose.
|
||||
//! Flag <isClosed> defines if the wire is closed or not
|
||||
@@ -242,11 +250,11 @@ public:
|
||||
//! DONE3: not the same edges orientation (some need to be reversed)
|
||||
//! DONE4: as DONE3 and gaps more than myPrecision
|
||||
//! FAIL : algorithm failed (could not detect order)
|
||||
Standard_EXPORT Standard_Boolean CheckOrder(ShapeAnalysis_WireOrder &sawo,
|
||||
Standard_Boolean isClosed = Standard_True,
|
||||
Standard_Boolean theMode3D = Standard_True,
|
||||
Standard_Boolean theModeBoth = Standard_False);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckOrder(ShapeAnalysis_WireOrder& sawo,
|
||||
Standard_Boolean isClosed = Standard_True,
|
||||
Standard_Boolean theMode3D = Standard_True,
|
||||
Standard_Boolean theModeBoth = Standard_False);
|
||||
|
||||
//! Checks connected edges (num-th and preceding).
|
||||
//! Tests with starting preci from <SBWD> or with <prec> if
|
||||
//! it is greater.
|
||||
@@ -260,8 +268,9 @@ public:
|
||||
//! DONE3 : Confused at <prec> but not <preci>
|
||||
//! FAIL1 : Not confused
|
||||
//! FAIL2 : Not confused but confused with <preci> if reverse num-th edge
|
||||
Standard_EXPORT Standard_Boolean CheckConnected (const Standard_Integer num, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckConnected(const Standard_Integer num,
|
||||
const Standard_Real prec = 0.0);
|
||||
|
||||
//! Checks if an edge has a length not greater than myPreci or
|
||||
//! precsmall (if it is smaller)
|
||||
//! Returns: False if its length is greater than precision
|
||||
@@ -270,8 +279,9 @@ public:
|
||||
//! DONE1: edge is small, vertices are the same
|
||||
//! DONE2: edge is small, vertices are not the same
|
||||
//! FAIL : no 3d curve and pcurve
|
||||
Standard_EXPORT Standard_Boolean CheckSmall (const Standard_Integer num, const Standard_Real precsmall = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSmall(const Standard_Integer num,
|
||||
const Standard_Real precsmall = 0.0);
|
||||
|
||||
//! Checks if a seam pcurves are correct oriented
|
||||
//! Returns: False (status OK) if given edge is not a seam or if it is OK
|
||||
//! C1 - current pcurve for FORWARD edge,
|
||||
@@ -281,12 +291,16 @@ public:
|
||||
//! Status:
|
||||
//! OK : Pcurves are correct or edge is not seam
|
||||
//! DONE : Seam pcurves should be swapped
|
||||
Standard_EXPORT Standard_Boolean CheckSeam (const Standard_Integer num, Handle(Geom2d_Curve)& C1, Handle(Geom2d_Curve)& C2, Standard_Real& cf, Standard_Real& cl);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSeam(const Standard_Integer num,
|
||||
Handle(Geom2d_Curve)& C1,
|
||||
Handle(Geom2d_Curve)& C2,
|
||||
Standard_Real& cf,
|
||||
Standard_Real& cl);
|
||||
|
||||
//! Checks if a seam pcurves are correct oriented
|
||||
//! See previous functions for details
|
||||
Standard_EXPORT Standard_Boolean CheckSeam (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSeam(const Standard_Integer num);
|
||||
|
||||
//! Checks for degenerated edge between two adjacent ones.
|
||||
//! Fills parameters dgnr1 and dgnr2 with points in parametric
|
||||
//! space that correspond to the singularity (either gap that
|
||||
@@ -302,13 +316,15 @@ public:
|
||||
//! no pcurve
|
||||
//! FAIL2: Edge marked as degenerated and has no pcurve
|
||||
//! but singularity is not detected
|
||||
Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num, gp_Pnt2d& dgnr1, gp_Pnt2d& dgnr2);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckDegenerated(const Standard_Integer num,
|
||||
gp_Pnt2d& dgnr1,
|
||||
gp_Pnt2d& dgnr2);
|
||||
|
||||
//! Checks for degenerated edge between two adjacent ones.
|
||||
//! Remark : Calls previous function
|
||||
//! Status : See the function above for details
|
||||
Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckDegenerated(const Standard_Integer num);
|
||||
|
||||
//! Checks gap between edges in 3D (3d curves).
|
||||
//! Checks the distance between ends of 3d curves of the num-th
|
||||
//! and preceding edge.
|
||||
@@ -319,8 +335,8 @@ public:
|
||||
//! OK : Gap is less than myPrecision
|
||||
//! DONE : Gap is greater than myPrecision
|
||||
//! FAIL : No 3d curve(s) on the edge(s)
|
||||
Standard_EXPORT Standard_Boolean CheckGap3d (const Standard_Integer num = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckGap3d(const Standard_Integer num = 0);
|
||||
|
||||
//! Checks gap between edges in 2D (pcurves).
|
||||
//! Checks the distance between ends of pcurves of the num-th
|
||||
//! and preceding edge.
|
||||
@@ -331,8 +347,8 @@ public:
|
||||
//! OK : Gap is less than parametric precision out of myPrecision
|
||||
//! DONE : Gap is greater than parametric precision out of myPrecision
|
||||
//! FAIL : No pcurve(s) on the edge(s)
|
||||
Standard_EXPORT Standard_Boolean CheckGap2d (const Standard_Integer num = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckGap2d(const Standard_Integer num = 0);
|
||||
|
||||
//! Checks gap between points on 3D curve and points on surface
|
||||
//! generated by pcurve of the num-th edge.
|
||||
//! The distance can be queried by MinDistance3d.
|
||||
@@ -342,8 +358,8 @@ public:
|
||||
//! OK : Gap is less than myPrecision
|
||||
//! DONE : Gap is greater than myPrecision
|
||||
//! FAIL : No 3d curve(s) on the edge(s)
|
||||
Standard_EXPORT Standard_Boolean CheckCurveGap (const Standard_Integer num = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckCurveGap(const Standard_Integer num = 0);
|
||||
|
||||
//! Checks if num-th edge is self-intersecting.
|
||||
//! Self-intersection is reported only if intersection point lies outside
|
||||
//! of both end vertices of the edge.
|
||||
@@ -354,10 +370,13 @@ public:
|
||||
//! FAIL1 : No pcurve
|
||||
//! FAIL2 : No vertices
|
||||
//! DONE1 : Self-intersection found
|
||||
Standard_EXPORT Standard_Boolean CheckSelfIntersectingEdge (const Standard_Integer num, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSelfIntersectingEdge (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT Standard_Boolean
|
||||
CheckSelfIntersectingEdge(const Standard_Integer num,
|
||||
IntRes2d_SequenceOfIntersectionPoint& points2d,
|
||||
TColgp_SequenceOfPnt& points3d);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSelfIntersectingEdge(const Standard_Integer num);
|
||||
|
||||
//! Checks two adjacent edges for intersecting.
|
||||
//! Intersection is reported only if intersection point is not enclosed
|
||||
//! by the common end vertex of the edges.
|
||||
@@ -369,22 +388,32 @@ public:
|
||||
//! FAIL1 : No pcurve
|
||||
//! FAIL2 : No vertices
|
||||
//! DONE1 : Self-intersection found
|
||||
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d, TColStd_SequenceOfReal& errors);
|
||||
|
||||
Standard_EXPORT Standard_Boolean
|
||||
CheckIntersectingEdges(const Standard_Integer num,
|
||||
IntRes2d_SequenceOfIntersectionPoint& points2d,
|
||||
TColgp_SequenceOfPnt& points3d,
|
||||
TColStd_SequenceOfReal& errors);
|
||||
|
||||
//! Checks two adjacent edges for intersecting.
|
||||
//! Remark : Calls the previous method
|
||||
//! Status : See the function above for details
|
||||
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckIntersectingEdges(const Standard_Integer num);
|
||||
|
||||
//! Checks i-th and j-th edges for intersecting.
|
||||
//! Remark : See the previous method for details
|
||||
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num1, const Standard_Integer num2, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d, TColStd_SequenceOfReal& errors);
|
||||
|
||||
Standard_EXPORT Standard_Boolean
|
||||
CheckIntersectingEdges(const Standard_Integer num1,
|
||||
const Standard_Integer num2,
|
||||
IntRes2d_SequenceOfIntersectionPoint& points2d,
|
||||
TColgp_SequenceOfPnt& points3d,
|
||||
TColStd_SequenceOfReal& errors);
|
||||
|
||||
//! Checks i-th and j-th edges for intersecting.
|
||||
//! Remark : Calls previous method.
|
||||
//! Status : See the function above for details
|
||||
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num1, const Standard_Integer num2);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckIntersectingEdges(const Standard_Integer num1,
|
||||
const Standard_Integer num2);
|
||||
|
||||
//! Checks if there is a gap in 2d between edges, not comprised by
|
||||
//! the tolerance of their common vertex.
|
||||
//! If <Tolerance> is greater than 0. and less than tolerance of
|
||||
@@ -403,8 +432,11 @@ public:
|
||||
//! DONE2: is set (together with DONE1) if gap is detected and the
|
||||
//! vector (p2d2 - p2d1) goes in direction opposite to the pcurves
|
||||
//! of the edges (if angle is more than 0.9*PI).
|
||||
Standard_EXPORT Standard_Boolean CheckLacking (const Standard_Integer num, const Standard_Real Tolerance, gp_Pnt2d& p2d1, gp_Pnt2d& p2d2);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckLacking(const Standard_Integer num,
|
||||
const Standard_Real Tolerance,
|
||||
gp_Pnt2d& p2d1,
|
||||
gp_Pnt2d& p2d2);
|
||||
|
||||
//! Checks if there is a gap in 2D between edges and not comprised by vertex tolerance
|
||||
//! The value of SBWD.thepreci is used.
|
||||
//! Returns: False if no edge should be inserted
|
||||
@@ -413,21 +445,25 @@ public:
|
||||
//! DONE1 : The vertex tolerance should be increased only (2d gap is
|
||||
//! small)
|
||||
//! DONE2 : Edge can be inserted (3d and 2d gaps are large enough)
|
||||
Standard_EXPORT Standard_Boolean CheckLacking (const Standard_Integer num, const Standard_Real Tolerance = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckLacking(const Standard_Integer num,
|
||||
const Standard_Real Tolerance = 0.0);
|
||||
|
||||
//! Checks if wire defines an outer bound on the face
|
||||
//! Uses ShapeAnalysis::IsOuterBound for analysis
|
||||
//! If <APIMake> is True uses BRepAPI_MakeWire to build the
|
||||
//! wire, if False (to be used only when edges share common
|
||||
//! vertices) uses BRep_Builder to build the wire
|
||||
Standard_EXPORT Standard_Boolean CheckOuterBound (const Standard_Boolean APIMake = Standard_True);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckOuterBound(const Standard_Boolean APIMake = Standard_True);
|
||||
|
||||
//! Detects a notch
|
||||
Standard_EXPORT Standard_Boolean CheckNotchedEdges (const Standard_Integer num, Standard_Integer& shortNum, Standard_Real& param, const Standard_Real Tolerance = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckNotchedEdges(const Standard_Integer num,
|
||||
Standard_Integer& shortNum,
|
||||
Standard_Real& param,
|
||||
const Standard_Real Tolerance = 0.0);
|
||||
|
||||
//! Checks if wire has parametric area less than precision.
|
||||
Standard_EXPORT Standard_Boolean CheckSmallArea (const TopoDS_Wire& theWire);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckSmallArea(const TopoDS_Wire& theWire);
|
||||
|
||||
//! Checks with what orientation <shape> (wire or edge) can be
|
||||
//! connected to the wire.
|
||||
//! Tests distances with starting <preci> from <SBWD> (close confusion),
|
||||
@@ -457,109 +493,111 @@ public:
|
||||
//! otherwise reversed.
|
||||
//! For head of <SBWD> if DONE5 is True <shape> should be direct,
|
||||
//! otherwise reversed.
|
||||
Standard_EXPORT Standard_Boolean CheckShapeConnect (const TopoDS_Shape& shape, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckShapeConnect(const TopoDS_Shape& shape,
|
||||
const Standard_Real prec = 0.0);
|
||||
|
||||
//! The same as previous CheckShapeConnect but is more advanced.
|
||||
//! It returns the distances between each end of <sbwd> and each
|
||||
//! end of <shape>. For example, <tailhead> stores distance
|
||||
//! between tail of <sbwd> and head of <shape>
|
||||
//! Remark: First method CheckShapeConnect calls this one
|
||||
Standard_EXPORT Standard_Boolean CheckShapeConnect (Standard_Real& tailhead, Standard_Real& tailtail, Standard_Real& headtail, Standard_Real& headhead, const TopoDS_Shape& shape, const Standard_Real prec = 0.0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckShapeConnect(Standard_Real& tailhead,
|
||||
Standard_Real& tailtail,
|
||||
Standard_Real& headtail,
|
||||
Standard_Real& headhead,
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real prec = 0.0);
|
||||
|
||||
//! Checks existence of loop on wire and return vertices which are loop vertices
|
||||
//! (vertices belonging to a few pairs of edges)
|
||||
Standard_EXPORT Standard_Boolean CheckLoop (TopTools_IndexedMapOfShape& aMapLoopVertices, TopTools_DataMapOfShapeListOfShape& aMapVertexEdges, TopTools_MapOfShape& aMapSmallEdges, TopTools_MapOfShape& aMapSeemEdges);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckTail (const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2, const Standard_Real theMaxSine, const Standard_Real theMaxWidth, const Standard_Real theMaxTolerance, TopoDS_Edge& theEdge11, TopoDS_Edge& theEdge12, TopoDS_Edge& theEdge21, TopoDS_Edge& theEdge22);
|
||||
|
||||
Standard_Boolean StatusOrder (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusConnected (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusEdgeCurves (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusDegenerated (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusClosed (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusSmall (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusSelfIntersection (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusLacking (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusGaps3d (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusGaps2d (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusCurveGaps (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusLoop (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckLoop(TopTools_IndexedMapOfShape& aMapLoopVertices,
|
||||
TopTools_DataMapOfShapeListOfShape& aMapVertexEdges,
|
||||
TopTools_MapOfShape& aMapSmallEdges,
|
||||
TopTools_MapOfShape& aMapSeemEdges);
|
||||
|
||||
Standard_EXPORT Standard_Boolean CheckTail(const TopoDS_Edge& theEdge1,
|
||||
const TopoDS_Edge& theEdge2,
|
||||
const Standard_Real theMaxSine,
|
||||
const Standard_Real theMaxWidth,
|
||||
const Standard_Real theMaxTolerance,
|
||||
TopoDS_Edge& theEdge11,
|
||||
TopoDS_Edge& theEdge12,
|
||||
TopoDS_Edge& theEdge21,
|
||||
TopoDS_Edge& theEdge22);
|
||||
|
||||
Standard_Boolean StatusOrder(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusConnected(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusEdgeCurves(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusDegenerated(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusClosed(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusSmall(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusSelfIntersection(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusLacking(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusGaps3d(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusGaps2d(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusCurveGaps(const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean StatusLoop(const ShapeExtend_Status Status) const;
|
||||
|
||||
//! Querying the status of the LAST performed 'Advanced' checking procedure
|
||||
Standard_Boolean LastCheckStatus (const ShapeExtend_Status Status) const;
|
||||
|
||||
Standard_Boolean LastCheckStatus(const ShapeExtend_Status Status) const;
|
||||
|
||||
//! Returns the last lowest distance in 3D computed by
|
||||
//! CheckOrientation, CheckConnected, CheckContinuity3d,
|
||||
//! CheckVertex, CheckNewVertex
|
||||
Standard_Real MinDistance3d() const;
|
||||
|
||||
Standard_Real MinDistance3d() const;
|
||||
|
||||
//! Returns the last lowest distance in 2D-UV computed by
|
||||
//! CheckContinuity2d
|
||||
Standard_Real MinDistance2d() const;
|
||||
|
||||
Standard_Real MinDistance2d() const;
|
||||
|
||||
//! Returns the last maximal distance in 3D computed by
|
||||
//! CheckOrientation, CheckConnected, CheckContinuity3d,
|
||||
//! CheckVertex, CheckNewVertex, CheckSameParameter
|
||||
Standard_Real MaxDistance3d() const;
|
||||
|
||||
Standard_Real MaxDistance3d() const;
|
||||
|
||||
//! Returns the last maximal distance in 2D-UV computed by
|
||||
//! CheckContinuity2d
|
||||
Standard_Real MaxDistance2d() const;
|
||||
Standard_Real MaxDistance2d() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_Wire,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_Wire, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Handle(ShapeExtend_WireData) myWire;
|
||||
TopoDS_Face myFace;
|
||||
Handle(ShapeExtend_WireData) myWire;
|
||||
TopoDS_Face myFace;
|
||||
Handle(ShapeAnalysis_Surface) mySurf;
|
||||
Standard_Real myPrecision;
|
||||
Standard_Real myMin3d;
|
||||
Standard_Real myMin2d;
|
||||
Standard_Real myMax3d;
|
||||
Standard_Real myMax2d;
|
||||
Standard_Integer myStatusOrder;
|
||||
Standard_Integer myStatusConnected;
|
||||
Standard_Integer myStatusEdgeCurves;
|
||||
Standard_Integer myStatusDegenerated;
|
||||
Standard_Integer myStatusClosed;
|
||||
Standard_Integer myStatusSmall;
|
||||
Standard_Integer myStatusSelfIntersection;
|
||||
Standard_Integer myStatusLacking;
|
||||
Standard_Integer myStatusGaps3d;
|
||||
Standard_Integer myStatusGaps2d;
|
||||
Standard_Integer myStatusCurveGaps;
|
||||
Standard_Integer myStatusLoop;
|
||||
Standard_Integer myStatus;
|
||||
|
||||
Standard_Real myPrecision;
|
||||
Standard_Real myMin3d;
|
||||
Standard_Real myMin2d;
|
||||
Standard_Real myMax3d;
|
||||
Standard_Real myMax2d;
|
||||
Standard_Integer myStatusOrder;
|
||||
Standard_Integer myStatusConnected;
|
||||
Standard_Integer myStatusEdgeCurves;
|
||||
Standard_Integer myStatusDegenerated;
|
||||
Standard_Integer myStatusClosed;
|
||||
Standard_Integer myStatusSmall;
|
||||
Standard_Integer myStatusSelfIntersection;
|
||||
Standard_Integer myStatusLacking;
|
||||
Standard_Integer myStatusGaps3d;
|
||||
Standard_Integer myStatusGaps2d;
|
||||
Standard_Integer myStatusCurveGaps;
|
||||
Standard_Integer myStatusLoop;
|
||||
Standard_Integer myStatus;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <ShapeAnalysis_Wire.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_Wire_HeaderFile
|
||||
|
@@ -11,25 +11,23 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//:pdn 05.01.99: renaming method ...Little to ...Small
|
||||
//: pdn 05.01.99: renaming method ...Little to ...Small
|
||||
#include <ShapeExtend.hxx>
|
||||
#include <ShapeExtend_WireData.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsLoaded
|
||||
//purpose :
|
||||
// function : IsLoaded
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::IsLoaded() const
|
||||
{
|
||||
return ! myWire.IsNull() && myWire->NbEdges() >0;
|
||||
return !myWire.IsNull() && myWire->NbEdges() > 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsReady
|
||||
//purpose :
|
||||
// function : IsReady
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::IsReady() const
|
||||
@@ -37,10 +35,9 @@ inline Standard_Boolean ShapeAnalysis_Wire::IsReady() const
|
||||
return IsLoaded() && !myFace.IsNull();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Precision
|
||||
//purpose :
|
||||
// function : Precision
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Wire::Precision() const
|
||||
@@ -48,10 +45,9 @@ inline Standard_Real ShapeAnalysis_Wire::Precision() const
|
||||
return myPrecision;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : WireData
|
||||
//purpose :
|
||||
// function : WireData
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(ShapeExtend_WireData)& ShapeAnalysis_Wire::WireData() const
|
||||
@@ -59,10 +55,9 @@ inline const Handle(ShapeExtend_WireData)& ShapeAnalysis_Wire::WireData() const
|
||||
return myWire;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
// function : NbEdges
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer ShapeAnalysis_Wire::NbEdges() const
|
||||
@@ -70,10 +65,9 @@ inline Standard_Integer ShapeAnalysis_Wire::NbEdges() const
|
||||
return myWire.IsNull() ? 0 : myWire->NbEdges();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
//purpose :
|
||||
// function : Face
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopoDS_Face& ShapeAnalysis_Wire::Face() const
|
||||
@@ -81,10 +75,9 @@ inline const TopoDS_Face& ShapeAnalysis_Wire::Face() const
|
||||
return myFace;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Surface
|
||||
//purpose :
|
||||
// function : Surface
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(ShapeAnalysis_Surface)& ShapeAnalysis_Wire::Surface() const
|
||||
@@ -92,151 +85,140 @@ inline const Handle(ShapeAnalysis_Surface)& ShapeAnalysis_Wire::Surface() const
|
||||
return mySurf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusOrder
|
||||
//purpose :
|
||||
// function : StatusOrder
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusOrder (const ShapeExtend_Status Status) const
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusOrder(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusOrder, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusConnected
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusConnected (const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusConnected, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusEdgeCurves
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusEdgeCurves (const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusEdgeCurves, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusDegenerated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusDegenerated (const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusDegenerated, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusClosed (const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusClosed, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusSmall
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusSmall (const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusSmall, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusSelfIntersection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusSelfIntersection (const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusSelfIntersection, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusLacking
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusLacking (const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusLacking, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusGaps3d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusGaps3d(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusGaps3d, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusGaps2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusGaps2d(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusGaps2d, Status );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusCurveGaps
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusCurveGaps(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusCurveGaps, Status );
|
||||
return ShapeExtend::DecodeStatus(myStatusOrder, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : StatusLoop
|
||||
//purpose :
|
||||
// function : StatusConnected
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusLoop(const ShapeExtend_Status Status) const
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusConnected(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatusLoop, Status );
|
||||
return ShapeExtend::DecodeStatus(myStatusConnected, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Status
|
||||
//purpose :
|
||||
// function : StatusEdgeCurves
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::LastCheckStatus (const ShapeExtend_Status Status) const
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusEdgeCurves(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus ( myStatus, Status );
|
||||
return ShapeExtend::DecodeStatus(myStatusEdgeCurves, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusDegenerated
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusDegenerated(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusDegenerated, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MinDistance3d
|
||||
//purpose :
|
||||
// function : StatusClosed
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusClosed(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusClosed, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusSmall
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusSmall(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusSmall, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusSelfIntersection
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusSelfIntersection(
|
||||
const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusSelfIntersection, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusLacking
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusLacking(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusLacking, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusGaps3d
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusGaps3d(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusGaps3d, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusGaps2d
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusGaps2d(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusGaps2d, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusCurveGaps
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusCurveGaps(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusCurveGaps, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : StatusLoop
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::StatusLoop(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatusLoop, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Status
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean ShapeAnalysis_Wire::LastCheckStatus(const ShapeExtend_Status Status) const
|
||||
{
|
||||
return ShapeExtend::DecodeStatus(myStatus, Status);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : MinDistance3d
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Wire::MinDistance3d() const
|
||||
@@ -244,10 +226,9 @@ inline Standard_Real ShapeAnalysis_Wire::MinDistance3d() const
|
||||
return myMin3d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MinDistance2d
|
||||
//purpose :
|
||||
// function : MinDistance2d
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Wire::MinDistance2d() const
|
||||
@@ -255,10 +236,9 @@ inline Standard_Real ShapeAnalysis_Wire::MinDistance2d() const
|
||||
return myMin2d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxDistance3d
|
||||
//purpose :
|
||||
// function : MaxDistance3d
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Wire::MaxDistance3d() const
|
||||
@@ -266,10 +246,9 @@ inline Standard_Real ShapeAnalysis_Wire::MaxDistance3d() const
|
||||
return myMax3d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxDistance2d
|
||||
//purpose :
|
||||
// function : MaxDistance2d
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real ShapeAnalysis_Wire::MaxDistance2d() const
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -45,10 +45,9 @@ class gp_XY;
|
||||
//!
|
||||
//! Two phases : firstly add the couples (start, end)
|
||||
//! secondly perform then get the result
|
||||
class ShapeAnalysis_WireOrder
|
||||
class ShapeAnalysis_WireOrder
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor
|
||||
@@ -58,104 +57,109 @@ public:
|
||||
//! Flag <theMode3D> defines 3D or 2d mode.
|
||||
//! Flag <theModeBoth> defines miscible mode and the flag <theMode3D> is ignored.
|
||||
//! Warning: Parameter <theTolerance> is not used in algorithm.
|
||||
Standard_EXPORT ShapeAnalysis_WireOrder (const Standard_Boolean theMode3D,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean theModeBoth = Standard_False);
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_WireOrder(const Standard_Boolean theMode3D,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean theModeBoth = Standard_False);
|
||||
|
||||
//! Sets new values.
|
||||
//! Clears the edge list if the mode (<theMode3D> or <theModeBoth> ) changes.
|
||||
//! Clears the connexion list.
|
||||
//! Warning: Parameter <theTolerance> is not used in algorithm.
|
||||
Standard_EXPORT void SetMode (const Standard_Boolean theMode3D,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean theModeBoth = Standard_False);
|
||||
|
||||
Standard_EXPORT void SetMode(const Standard_Boolean theMode3D,
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Boolean theModeBoth = Standard_False);
|
||||
|
||||
//! Returns the working tolerance
|
||||
Standard_EXPORT Standard_Real Tolerance() const;
|
||||
|
||||
|
||||
//! Clears the list of edges, but not mode and tol
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
|
||||
//! Adds a couple of points 3D (start, end)
|
||||
Standard_EXPORT void Add (const gp_XYZ& theStart3d, const gp_XYZ& theEnd3d);
|
||||
|
||||
Standard_EXPORT void Add(const gp_XYZ& theStart3d, const gp_XYZ& theEnd3d);
|
||||
|
||||
//! Adds a couple of points 2D (start, end)
|
||||
Standard_EXPORT void Add (const gp_XY& theStart2d, const gp_XY& theEnd2d);
|
||||
|
||||
Standard_EXPORT void Add(const gp_XY& theStart2d, const gp_XY& theEnd2d);
|
||||
|
||||
//! Adds a couple of points 3D and 2D (start, end)
|
||||
Standard_EXPORT void Add (const gp_XYZ& theStart3d,
|
||||
const gp_XYZ& theEnd3d,
|
||||
const gp_XY& theStart2d,
|
||||
const gp_XY& theEnd2d);
|
||||
Standard_EXPORT void Add(const gp_XYZ& theStart3d,
|
||||
const gp_XYZ& theEnd3d,
|
||||
const gp_XY& theStart2d,
|
||||
const gp_XY& theEnd2d);
|
||||
|
||||
//! Returns the count of added couples of points (one per edges)
|
||||
Standard_EXPORT Standard_Integer NbEdges() const;
|
||||
|
||||
|
||||
//! If this mode is True method perform does not sort edges of
|
||||
//! different loops. The resulting order is first loop, second
|
||||
//! one etc...
|
||||
Standard_EXPORT Standard_Boolean& KeepLoopsMode();
|
||||
|
||||
|
||||
//! Computes the better order
|
||||
//! Optimised if the couples were already in order
|
||||
//! The criterium is : two couples in order if distance between
|
||||
//! end-prec and start-cur is less then starting tolerance <tol>
|
||||
//! Else, the smallest distance is reached
|
||||
//! Warning: Parameter <closed> not used
|
||||
Standard_EXPORT void Perform (const Standard_Boolean closed = Standard_True);
|
||||
|
||||
Standard_EXPORT void Perform(const Standard_Boolean closed = Standard_True);
|
||||
|
||||
//! Tells if Perform has been done
|
||||
//! Else, the following methods returns original values
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
//! Returns the status of the order (0 if not done) :
|
||||
//! 0 : all edges are direct and in sequence
|
||||
//! 1 : all edges are direct but some are not in sequence
|
||||
//! -1 : some edges are reversed, but no gap remain
|
||||
//! 3 : edges in sequence are just shifted in forward or reverse manner
|
||||
Standard_EXPORT Standard_Integer Status() const;
|
||||
|
||||
|
||||
//! Returns the number of original edge which correspond to the
|
||||
//! newly ordered number <n>
|
||||
//! Warning : the returned value is NEGATIVE if edge should be reversed
|
||||
Standard_EXPORT Standard_Integer Ordered (const Standard_Integer theIdx) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer Ordered(const Standard_Integer theIdx) const;
|
||||
|
||||
//! Returns the values of the couple <num>, as 3D values
|
||||
Standard_EXPORT void XYZ (const Standard_Integer theIdx, gp_XYZ& theStart3D, gp_XYZ& theEnd3D) const;
|
||||
|
||||
Standard_EXPORT void XYZ(const Standard_Integer theIdx,
|
||||
gp_XYZ& theStart3D,
|
||||
gp_XYZ& theEnd3D) const;
|
||||
|
||||
//! Returns the values of the couple <num>, as 2D values
|
||||
Standard_EXPORT void XY (const Standard_Integer theIdx, gp_XY& theStart2D, gp_XY& theEnd2D) const;
|
||||
|
||||
Standard_EXPORT void XY(const Standard_Integer theIdx, gp_XY& theStart2D, gp_XY& theEnd2D) const;
|
||||
|
||||
//! Returns the gap between a couple and its preceding
|
||||
//! <num> is considered ordered
|
||||
//! If <num> = 0 (D), returns the greatest gap found
|
||||
Standard_EXPORT Standard_Real Gap (const Standard_Integer num = 0) const;
|
||||
|
||||
Standard_EXPORT Standard_Real Gap(const Standard_Integer num = 0) const;
|
||||
|
||||
//! Determines the chains inside which successive edges have a gap
|
||||
//! less than a given value. Queried by NbChains and Chain
|
||||
Standard_EXPORT void SetChains (const Standard_Real gap);
|
||||
|
||||
Standard_EXPORT void SetChains(const Standard_Real gap);
|
||||
|
||||
//! Returns the count of computed chains
|
||||
Standard_EXPORT Standard_Integer NbChains() const;
|
||||
|
||||
|
||||
//! Returns, for the chain n0 num, starting and ending numbers of
|
||||
//! edges. In the list of ordered edges (see Ordered for originals)
|
||||
Standard_EXPORT void Chain (const Standard_Integer num, Standard_Integer& n1, Standard_Integer& n2) const;
|
||||
Standard_EXPORT void Chain(const Standard_Integer num,
|
||||
Standard_Integer& n1,
|
||||
Standard_Integer& n2) const;
|
||||
|
||||
//! Determines the couples of edges for which end and start fit
|
||||
//! inside a given gap. Queried by NbCouples and Couple
|
||||
//! Warning: function isn't implemented
|
||||
Standard_EXPORT void SetCouples (const Standard_Real gap);
|
||||
Standard_EXPORT void SetCouples(const Standard_Real gap);
|
||||
|
||||
//! Returns the count of computed couples
|
||||
Standard_EXPORT Standard_Integer NbCouples() const;
|
||||
|
||||
//! Returns, for the couple n0 num, the two implied edges
|
||||
//! In the list of ordered edges
|
||||
Standard_EXPORT void Couple (const Standard_Integer num, Standard_Integer& n1, Standard_Integer& n2) const;
|
||||
Standard_EXPORT void Couple(const Standard_Integer num,
|
||||
Standard_Integer& n1,
|
||||
Standard_Integer& n2) const;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
// the mode in which the algorithm works
|
||||
enum ModeType
|
||||
@@ -168,13 +172,13 @@ private:
|
||||
Handle(TColStd_HArray1OfInteger) myOrd;
|
||||
Handle(TColStd_HArray1OfInteger) myChains;
|
||||
Handle(TColStd_HArray1OfInteger) myCouples;
|
||||
Handle(TColgp_HSequenceOfXYZ) myXYZ;
|
||||
Handle(TColgp_HSequenceOfXY) myXY;
|
||||
Standard_Real myTol;
|
||||
Standard_Real myGap;
|
||||
Standard_Integer myStat;
|
||||
Standard_Boolean myKeepLoops;
|
||||
ModeType myMode;
|
||||
Handle(TColgp_HSequenceOfXYZ) myXYZ;
|
||||
Handle(TColgp_HSequenceOfXY) myXY;
|
||||
Standard_Real myTol;
|
||||
Standard_Real myGap;
|
||||
Standard_Integer myStat;
|
||||
Standard_Boolean myKeepLoops;
|
||||
ModeType myMode;
|
||||
};
|
||||
|
||||
#endif // _ShapeAnalysis_WireOrder_HeaderFile
|
||||
|
@@ -11,7 +11,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//szv#4 S4163
|
||||
// szv#4 S4163
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
@@ -26,298 +26,266 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
//ied_modif_for_compil_Nov-19-1998
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_WireVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// ied_modif_for_compil_Nov-19-1998
|
||||
//=================================================================================================
|
||||
|
||||
ShapeAnalysis_WireVertex::ShapeAnalysis_WireVertex()
|
||||
{
|
||||
myDone = Standard_False;
|
||||
myDone = Standard_False;
|
||||
myPreci = Precision::Confusion();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::Init(const TopoDS_Wire& wire, const Standard_Real preci)
|
||||
void ShapeAnalysis_WireVertex::Init(const TopoDS_Wire& wire, const Standard_Real preci)
|
||||
{
|
||||
Init (new ShapeExtend_WireData (wire), preci);
|
||||
Init(new ShapeExtend_WireData(wire), preci);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::Init(const Handle(ShapeExtend_WireData)& sbwd, const Standard_Real /*preci*/)
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::Init(const Handle(ShapeExtend_WireData)& sbwd,
|
||||
const Standard_Real /*preci*/)
|
||||
{
|
||||
Standard_Integer nb = sbwd->NbEdges();
|
||||
if (nb == 0) return;
|
||||
if (nb == 0)
|
||||
return;
|
||||
myDone = Standard_False;
|
||||
myWire = sbwd;
|
||||
myStat = new TColStd_HArray1OfInteger (1,nb); myStat->Init(0);
|
||||
myPos = new TColgp_HArray1OfXYZ (1,nb);
|
||||
myUPre = new TColStd_HArray1OfReal (1,nb); myUPre->Init(0.0);
|
||||
myUFol = new TColStd_HArray1OfReal (1,nb); myUFol->Init(0.0);
|
||||
myStat = new TColStd_HArray1OfInteger(1, nb);
|
||||
myStat->Init(0);
|
||||
myPos = new TColgp_HArray1OfXYZ(1, nb);
|
||||
myUPre = new TColStd_HArray1OfReal(1, nb);
|
||||
myUPre->Init(0.0);
|
||||
myUFol = new TColStd_HArray1OfReal(1, nb);
|
||||
myUFol->Init(0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::Load(const TopoDS_Wire& wire)
|
||||
void ShapeAnalysis_WireVertex::Load(const TopoDS_Wire& wire)
|
||||
{
|
||||
Init (wire, myPreci);
|
||||
Init(wire, myPreci);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::Load(const Handle(ShapeExtend_WireData)& sbwd)
|
||||
void ShapeAnalysis_WireVertex::Load(const Handle(ShapeExtend_WireData)& sbwd)
|
||||
{
|
||||
Init (sbwd, myPreci);
|
||||
Init(sbwd, myPreci);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPrecision
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetPrecision(const Standard_Real preci)
|
||||
void ShapeAnalysis_WireVertex::SetPrecision(const Standard_Real preci)
|
||||
{
|
||||
myPreci = preci;
|
||||
myDone = Standard_False;
|
||||
myDone = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Analyze
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::Analyze()
|
||||
void ShapeAnalysis_WireVertex::Analyze()
|
||||
{
|
||||
if (myStat.IsNull()) return;
|
||||
if (myStat.IsNull())
|
||||
return;
|
||||
myDone = Standard_True;
|
||||
// Analyse des vertex qui se suivent
|
||||
Handle(Geom_Curve) c1, c2;
|
||||
Standard_Real cf, cl, upre, ufol;
|
||||
Standard_Integer i, j, nb = myStat->Length(), stat;
|
||||
Standard_Real cf, cl, upre, ufol;
|
||||
Standard_Integer i, j, nb = myStat->Length(), stat;
|
||||
ShapeAnalysis_Edge EA;
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
stat = -1; // au depart
|
||||
for (i = 1; i <= nb; i++)
|
||||
{
|
||||
stat = -1; // au depart
|
||||
|
||||
j = (i == nb ? 1 : i+1);
|
||||
TopoDS_Edge E1 = myWire->Edge (i);
|
||||
TopoDS_Edge E2 = myWire->Edge (j);
|
||||
TopoDS_Vertex V1 = EA.LastVertex (myWire->Edge (i));
|
||||
TopoDS_Vertex V2 = EA.FirstVertex (myWire->Edge (j));
|
||||
gp_Pnt PV1 = BRep_Tool::Pnt (V1);
|
||||
gp_Pnt PV2 = BRep_Tool::Pnt (V2);
|
||||
Standard_Real tol1 = BRep_Tool::Tolerance (V1);
|
||||
Standard_Real tol2 = BRep_Tool::Tolerance (V2);
|
||||
EA.Curve3d (myWire->Edge (i),c1,cf,upre);
|
||||
EA.Curve3d (myWire->Edge (j),c2,ufol,cl);
|
||||
if (c1.IsNull() || c2.IsNull()) continue; // on ne peut rien faire ...
|
||||
gp_Pnt P1 = c1->Value (upre);
|
||||
gp_Pnt P2 = c2->Value (ufol);
|
||||
j = (i == nb ? 1 : i + 1);
|
||||
TopoDS_Edge E1 = myWire->Edge(i);
|
||||
TopoDS_Edge E2 = myWire->Edge(j);
|
||||
TopoDS_Vertex V1 = EA.LastVertex(myWire->Edge(i));
|
||||
TopoDS_Vertex V2 = EA.FirstVertex(myWire->Edge(j));
|
||||
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
|
||||
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
|
||||
Standard_Real tol1 = BRep_Tool::Tolerance(V1);
|
||||
Standard_Real tol2 = BRep_Tool::Tolerance(V2);
|
||||
EA.Curve3d(myWire->Edge(i), c1, cf, upre);
|
||||
EA.Curve3d(myWire->Edge(j), c2, ufol, cl);
|
||||
if (c1.IsNull() || c2.IsNull())
|
||||
continue; // on ne peut rien faire ...
|
||||
gp_Pnt P1 = c1->Value(upre);
|
||||
gp_Pnt P2 = c2->Value(ufol);
|
||||
|
||||
// Est-ce que le jeu de vertex convient ? (meme si V1 == V2, on verifie)
|
||||
Standard_Real d1 = PV1.Distance (P1);
|
||||
Standard_Real d2 = PV2.Distance (P2);
|
||||
Standard_Real dd = PV1.Distance (PV2);
|
||||
if (d1 <= tol1 && d2 <= tol2 && dd <= (tol1+tol2)) stat = 1;
|
||||
else if (d1 <= myPreci && d2 <= myPreci && dd <= myPreci) stat = 2;
|
||||
myStat->SetValue (i,-1); // par defaut
|
||||
if (stat > 0) { if (V1 == V2) stat = 0; }
|
||||
if (stat >= 0) { myStat->SetValue (i,stat); continue; }
|
||||
Standard_Real d1 = PV1.Distance(P1);
|
||||
Standard_Real d2 = PV2.Distance(P2);
|
||||
Standard_Real dd = PV1.Distance(PV2);
|
||||
if (d1 <= tol1 && d2 <= tol2 && dd <= (tol1 + tol2))
|
||||
stat = 1;
|
||||
else if (d1 <= myPreci && d2 <= myPreci && dd <= myPreci)
|
||||
stat = 2;
|
||||
myStat->SetValue(i, -1); // par defaut
|
||||
if (stat > 0)
|
||||
{
|
||||
if (V1 == V2)
|
||||
stat = 0;
|
||||
}
|
||||
if (stat >= 0)
|
||||
{
|
||||
myStat->SetValue(i, stat);
|
||||
continue;
|
||||
}
|
||||
// Restent les autres cas !
|
||||
|
||||
// Une edge se termine sur l autre : il faudra simplement relimiter
|
||||
// Projection calculee sur une demi-edge (pour eviter les pbs de couture)
|
||||
gp_Pnt PJ1,PJ2;
|
||||
Standard_Real U1,U2;
|
||||
Standard_Real dj1 = ShapeAnalysis_Curve().Project (c1,P2,myPreci,PJ1,U1,(cf+upre)/2,upre);
|
||||
Standard_Real dj2 = ShapeAnalysis_Curve().Project (c2,P1,myPreci,PJ2,U2,ufol,(ufol+cl)/2);
|
||||
if (dj1 <= myPreci) { SetStart (i,PJ1.XYZ(),U1); continue; }
|
||||
else if (dj2 <= myPreci) { SetEnd (i,PJ2.XYZ(),U2); continue; }
|
||||
gp_Pnt PJ1, PJ2;
|
||||
Standard_Real U1, U2;
|
||||
Standard_Real dj1 =
|
||||
ShapeAnalysis_Curve().Project(c1, P2, myPreci, PJ1, U1, (cf + upre) / 2, upre);
|
||||
Standard_Real dj2 =
|
||||
ShapeAnalysis_Curve().Project(c2, P1, myPreci, PJ2, U2, ufol, (ufol + cl) / 2);
|
||||
if (dj1 <= myPreci)
|
||||
{
|
||||
SetStart(i, PJ1.XYZ(), U1);
|
||||
continue;
|
||||
}
|
||||
else if (dj2 <= myPreci)
|
||||
{
|
||||
SetEnd(i, PJ2.XYZ(), U2);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Restent a verifier les intersections et prolongations !
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSameVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetSameVertex(const Standard_Integer num)
|
||||
void ShapeAnalysis_WireVertex::SetSameVertex(const Standard_Integer num)
|
||||
{
|
||||
myStat->SetValue (num,0);
|
||||
myStat->SetValue(num, 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSameCoords
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetSameCoords(const Standard_Integer num)
|
||||
void ShapeAnalysis_WireVertex::SetSameCoords(const Standard_Integer num)
|
||||
{
|
||||
myStat->SetValue (num,1);
|
||||
myStat->SetValue(num, 1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetClose
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetClose(const Standard_Integer num)
|
||||
void ShapeAnalysis_WireVertex::SetClose(const Standard_Integer num)
|
||||
{
|
||||
myStat->SetValue (num,2);
|
||||
myStat->SetValue(num, 2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetEnd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetEnd(const Standard_Integer num,const gp_XYZ& pos,const Standard_Real ufol)
|
||||
void ShapeAnalysis_WireVertex::SetEnd(const Standard_Integer num,
|
||||
const gp_XYZ& pos,
|
||||
const Standard_Real ufol)
|
||||
{
|
||||
myStat->SetValue (num,3);
|
||||
myPos->SetValue (num,pos);
|
||||
myUFol->SetValue (num,ufol);
|
||||
myStat->SetValue(num, 3);
|
||||
myPos->SetValue(num, pos);
|
||||
myUFol->SetValue(num, ufol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStart
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetStart(const Standard_Integer num,const gp_XYZ& pos,const Standard_Real upre)
|
||||
void ShapeAnalysis_WireVertex::SetStart(const Standard_Integer num,
|
||||
const gp_XYZ& pos,
|
||||
const Standard_Real upre)
|
||||
{
|
||||
myStat->SetValue (num,4);
|
||||
myPos->SetValue (num,pos);
|
||||
myUFol->SetValue (num,upre);
|
||||
myStat->SetValue(num, 4);
|
||||
myPos->SetValue(num, pos);
|
||||
myUFol->SetValue(num, upre);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetInters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetInters(const Standard_Integer num, const gp_XYZ& pos,
|
||||
const Standard_Real upre, const Standard_Real ufol)
|
||||
void ShapeAnalysis_WireVertex::SetInters(const Standard_Integer num,
|
||||
const gp_XYZ& pos,
|
||||
const Standard_Real upre,
|
||||
const Standard_Real ufol)
|
||||
{
|
||||
myStat->SetValue (num,5);
|
||||
myPos->SetValue (num,pos);
|
||||
myUPre->SetValue (num,upre);
|
||||
myUFol->SetValue (num,ufol);
|
||||
myStat->SetValue(num, 5);
|
||||
myPos->SetValue(num, pos);
|
||||
myUPre->SetValue(num, upre);
|
||||
myUFol->SetValue(num, ufol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDisjoined
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void ShapeAnalysis_WireVertex::SetDisjoined(const Standard_Integer num)
|
||||
void ShapeAnalysis_WireVertex::SetDisjoined(const Standard_Integer num)
|
||||
{
|
||||
myStat->SetValue (num,-1);
|
||||
myStat->SetValue(num, -1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ShapeAnalysis_WireVertex::IsDone() const
|
||||
Standard_Boolean ShapeAnalysis_WireVertex::IsDone() const
|
||||
{
|
||||
return myDone;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Precision
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real ShapeAnalysis_WireVertex::Precision() const
|
||||
Standard_Real ShapeAnalysis_WireVertex::Precision() const
|
||||
{
|
||||
return myPreci;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer ShapeAnalysis_WireVertex::NbEdges() const
|
||||
Standard_Integer ShapeAnalysis_WireVertex::NbEdges() const
|
||||
{
|
||||
return myWire->NbEdges();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WireData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
const Handle(ShapeExtend_WireData)& ShapeAnalysis_WireVertex::WireData() const
|
||||
{
|
||||
return myWire;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Status
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer ShapeAnalysis_WireVertex::Status(const Standard_Integer num) const
|
||||
Standard_Integer ShapeAnalysis_WireVertex::Status(const Standard_Integer num) const
|
||||
{
|
||||
return myStat->Value(num);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Position
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
gp_XYZ ShapeAnalysis_WireVertex::Position(const Standard_Integer num) const
|
||||
gp_XYZ ShapeAnalysis_WireVertex::Position(const Standard_Integer num) const
|
||||
{
|
||||
return myPos->Value(num);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UPrevious
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
//szv#4:S4163:12Mar99 was bug: returned Integer
|
||||
Standard_Real ShapeAnalysis_WireVertex::UPrevious(const Standard_Integer num) const
|
||||
// szv#4:S4163:12Mar99 was bug: returned Integer
|
||||
Standard_Real ShapeAnalysis_WireVertex::UPrevious(const Standard_Integer num) const
|
||||
{
|
||||
return myUPre->Value(num);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UFollowing
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
//szv#4:S4163:12Mar99 was bug: returned Integer
|
||||
Standard_Real ShapeAnalysis_WireVertex::UFollowing(const Standard_Integer num) const
|
||||
// szv#4:S4163:12Mar99 was bug: returned Integer
|
||||
Standard_Real ShapeAnalysis_WireVertex::UFollowing(const Standard_Integer num) const
|
||||
{
|
||||
return myUFol->Value(num);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Data
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer ShapeAnalysis_WireVertex::Data(const Standard_Integer num, gp_XYZ& pos,
|
||||
Standard_Real& upre, Standard_Real& ufol) const
|
||||
Standard_Integer ShapeAnalysis_WireVertex::Data(const Standard_Integer num,
|
||||
gp_XYZ& pos,
|
||||
Standard_Real& upre,
|
||||
Standard_Real& ufol) const
|
||||
{
|
||||
pos = myPos->Value(num);
|
||||
upre = myUPre->Value(num);
|
||||
@@ -325,41 +293,38 @@ const Handle(ShapeExtend_WireData)& ShapeAnalysis_WireVertex::WireData() const
|
||||
return myStat->Value(num);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NextStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer ShapeAnalysis_WireVertex::NextStatus(const Standard_Integer stat,
|
||||
const Standard_Integer num) const
|
||||
Standard_Integer ShapeAnalysis_WireVertex::NextStatus(const Standard_Integer stat,
|
||||
const Standard_Integer num) const
|
||||
{
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if (!myStat.IsNull()) {
|
||||
Standard_Integer i,nb = myStat->Length();
|
||||
for (i = num+1; i <= nb; i ++) if (myStat->Value(i) == stat) return i;
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (!myStat.IsNull())
|
||||
{
|
||||
Standard_Integer i, nb = myStat->Length();
|
||||
for (i = num + 1; i <= nb; i++)
|
||||
if (myStat->Value(i) == stat)
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NextCriter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer ShapeAnalysis_WireVertex::NextCriter(const Standard_Integer crit,
|
||||
const Standard_Integer num) const
|
||||
Standard_Integer ShapeAnalysis_WireVertex::NextCriter(const Standard_Integer crit,
|
||||
const Standard_Integer num) const
|
||||
{
|
||||
//szv#4:S4163:12Mar99 optimized
|
||||
if (!myStat.IsNull()) {
|
||||
Standard_Integer i,nb = myStat->Length();
|
||||
for (i = num+1; i <= nb; i ++) {
|
||||
// szv#4:S4163:12Mar99 optimized
|
||||
if (!myStat.IsNull())
|
||||
{
|
||||
Standard_Integer i, nb = myStat->Length();
|
||||
for (i = num + 1; i <= nb; i++)
|
||||
{
|
||||
Standard_Integer stat = myStat->Value(i);
|
||||
if ((crit == -1 && stat < 0) ||
|
||||
(crit == 0 && stat == 0) ||
|
||||
(crit == 1 && stat > 0) ||
|
||||
(crit == 2 && (stat >= 0 && stat <= 2)) ||
|
||||
(crit == 3 && (stat == 1 || stat == 2)) ||
|
||||
(crit == 4 && stat > 2)) return i;
|
||||
if ((crit == -1 && stat < 0) || (crit == 0 && stat == 0) || (crit == 1 && stat > 0)
|
||||
|| (crit == 2 && (stat >= 0 && stat <= 2)) || (crit == 3 && (stat == 1 || stat == 2))
|
||||
|| (crit == 4 && stat > 2))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@@ -40,84 +40,89 @@ class gp_XYZ;
|
||||
//! For each Vertex, a status and some data can be attached
|
||||
//! (case found, position and parameters)
|
||||
//! Then, these information can be used to fix problems
|
||||
class ShapeAnalysis_WireVertex
|
||||
class ShapeAnalysis_WireVertex
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeAnalysis_WireVertex();
|
||||
|
||||
Standard_EXPORT void Init (const TopoDS_Wire& wire, const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& swbd, const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT void Load (const TopoDS_Wire& wire);
|
||||
|
||||
Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
|
||||
|
||||
|
||||
Standard_EXPORT void Init(const TopoDS_Wire& wire, const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT void Init(const Handle(ShapeExtend_WireData)& swbd, const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT void Load(const TopoDS_Wire& wire);
|
||||
|
||||
Standard_EXPORT void Load(const Handle(ShapeExtend_WireData)& sbwd);
|
||||
|
||||
//! Sets the precision for work
|
||||
//! Analysing: for each Vertex, comparison between the end of the
|
||||
//! preceding edge and the start of the following edge
|
||||
//! Each Vertex rank corresponds to the End Vertex of the Edge of
|
||||
//! same rank, in the ShapeExtend_WireData. I.E. for Vertex <num>,
|
||||
//! Edge <num> is the preceding one, <num+1> is the following one
|
||||
Standard_EXPORT void SetPrecision (const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT void SetPrecision(const Standard_Real preci);
|
||||
|
||||
Standard_EXPORT void Analyze();
|
||||
|
||||
|
||||
//! Records status "Same Vertex" (logically) on Vertex <num>
|
||||
Standard_EXPORT void SetSameVertex (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT void SetSameVertex(const Standard_Integer num);
|
||||
|
||||
//! Records status "Same Coords" (at the Vertices Tolerances)
|
||||
Standard_EXPORT void SetSameCoords (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT void SetSameCoords(const Standard_Integer num);
|
||||
|
||||
//! Records status "Close Coords" (at the Precision of <me>)
|
||||
Standard_EXPORT void SetClose (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT void SetClose(const Standard_Integer num);
|
||||
|
||||
//! <num> is the End of preceding Edge, and its projection on the
|
||||
//! following one lies on it at the Precision of <me>
|
||||
//! <ufol> gives the parameter on the following edge
|
||||
Standard_EXPORT void SetEnd (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real ufol);
|
||||
|
||||
Standard_EXPORT void SetEnd(const Standard_Integer num,
|
||||
const gp_XYZ& pos,
|
||||
const Standard_Real ufol);
|
||||
|
||||
//! <num> is the Start of following Edge, its projection on the
|
||||
//! preceding one lies on it at the Precision of <me>
|
||||
//! <upre> gives the parameter on the preceding edge
|
||||
Standard_EXPORT void SetStart (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre);
|
||||
|
||||
Standard_EXPORT void SetStart(const Standard_Integer num,
|
||||
const gp_XYZ& pos,
|
||||
const Standard_Real upre);
|
||||
|
||||
//! <num> is the Intersection of both Edges
|
||||
//! <upre> is the parameter on preceding edge, <ufol> on
|
||||
//! following edge
|
||||
Standard_EXPORT void SetInters (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre, const Standard_Real ufol);
|
||||
|
||||
Standard_EXPORT void SetInters(const Standard_Integer num,
|
||||
const gp_XYZ& pos,
|
||||
const Standard_Real upre,
|
||||
const Standard_Real ufol);
|
||||
|
||||
//! <num> cannot be said as same vertex
|
||||
Standard_EXPORT void SetDisjoined (const Standard_Integer num);
|
||||
|
||||
Standard_EXPORT void SetDisjoined(const Standard_Integer num);
|
||||
|
||||
//! Returns True if analysis was performed, else returns False
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
//! Returns precision value used in analysis
|
||||
Standard_EXPORT Standard_Real Precision() const;
|
||||
|
||||
|
||||
//! Returns the number of edges in analyzed wire (i.e. the
|
||||
//! length of all arrays)
|
||||
Standard_EXPORT Standard_Integer NbEdges() const;
|
||||
|
||||
|
||||
//! Returns analyzed wire
|
||||
Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
|
||||
|
||||
|
||||
//! Returns the recorded status for a vertex
|
||||
//! More detail by method Data
|
||||
Standard_EXPORT Standard_Integer Status (const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT gp_XYZ Position (const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT Standard_Real UPrevious (const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT Standard_Real UFollowing (const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer Status(const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT gp_XYZ Position(const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT Standard_Real UPrevious(const Standard_Integer num) const;
|
||||
|
||||
Standard_EXPORT Standard_Real UFollowing(const Standard_Integer num) const;
|
||||
|
||||
//! Returns the recorded status for a vertex
|
||||
//! With its recorded position and parameters on both edges
|
||||
//! These values are relevant regarding the status:
|
||||
@@ -129,13 +134,17 @@ public:
|
||||
//! 4 Start yes yes no
|
||||
//! 5 Inters yes yes yes
|
||||
//! -1 Disjoined no no no
|
||||
Standard_EXPORT Standard_Integer Data (const Standard_Integer num, gp_XYZ& pos, Standard_Real& upre, Standard_Real& ufol) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer Data(const Standard_Integer num,
|
||||
gp_XYZ& pos,
|
||||
Standard_Real& upre,
|
||||
Standard_Real& ufol) const;
|
||||
|
||||
//! For a given status, returns the rank of the vertex which
|
||||
//! follows <num> and has the same status. 0 if no more
|
||||
//! Acts as an iterator, starts on the first one
|
||||
Standard_EXPORT Standard_Integer NextStatus (const Standard_Integer stat, const Standard_Integer num = 0) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NextStatus(const Standard_Integer stat,
|
||||
const Standard_Integer num = 0) const;
|
||||
|
||||
//! For a given criter, returns the rank of the vertex which
|
||||
//! follows <num> and has the same status. 0 if no more
|
||||
//! Acts as an iterator, starts on the first one
|
||||
@@ -146,36 +155,18 @@ public:
|
||||
//! 3: same coods but not same vertex (status 1 2)
|
||||
//! 4: redefined coords (status 3 4 5)
|
||||
//! -1: no solution (status -1)
|
||||
Standard_EXPORT Standard_Integer NextCriter (const Standard_Integer crit, const Standard_Integer num = 0) const;
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer NextCriter(const Standard_Integer crit,
|
||||
const Standard_Integer num = 0) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(ShapeExtend_WireData) myWire;
|
||||
Handle(ShapeExtend_WireData) myWire;
|
||||
Handle(TColStd_HArray1OfInteger) myStat;
|
||||
Handle(TColgp_HArray1OfXYZ) myPos;
|
||||
Handle(TColStd_HArray1OfReal) myUPre;
|
||||
Handle(TColStd_HArray1OfReal) myUFol;
|
||||
Standard_Real myPreci;
|
||||
Standard_Boolean myDone;
|
||||
|
||||
|
||||
Handle(TColgp_HArray1OfXYZ) myPos;
|
||||
Handle(TColStd_HArray1OfReal) myUPre;
|
||||
Handle(TColStd_HArray1OfReal) myUFol;
|
||||
Standard_Real myPreci;
|
||||
Standard_Boolean myDone;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ShapeAnalysis_WireVertex_HeaderFile
|
||||
|
Reference in New Issue
Block a user