mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0025109: Check PolygonOnTriangulation contained in edges
1. New status "BRepCheck_InvalidPolygonOnTriangulation" is added. 2. Small correction of output of "checkshape" command result. Test cases were changed. Test case for issue CR25109 Some test cases were changed according to their new behavior.
This commit is contained in:
@@ -98,6 +98,8 @@ is
|
||||
BadOrientation,
|
||||
BadOrientationOfSubshape,
|
||||
|
||||
InvalidPolygonOnTriangulation,
|
||||
|
||||
InvalidToleranceValue,
|
||||
|
||||
-- for exception
|
||||
|
@@ -175,6 +175,13 @@ void BRepCheck::Print(const BRepCheck_Status stat,
|
||||
case BRepCheck_CheckFail:
|
||||
OS << "BRepCheck_CheckFail\n";
|
||||
break;
|
||||
case BRepCheck_InvalidPolygonOnTriangulation:
|
||||
OS << "BRepCheck_InvalidPolygonOnTriangulation\n";
|
||||
break;
|
||||
case BRepCheck_InvalidToleranceValue:
|
||||
OS << "BRepCheck_InvalidToleranceValue\n";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -103,15 +103,17 @@ void BRepCheck_Analyzer::Put(const TopoDS_Shape& S,
|
||||
|
||||
void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
|
||||
{
|
||||
for(TopoDS_Iterator theIterator(S);theIterator.More();theIterator.Next()) {
|
||||
for(TopoDS_Iterator theIterator(S);theIterator.More();theIterator.Next())
|
||||
Perform(theIterator.Value());
|
||||
}
|
||||
|
||||
//
|
||||
TopAbs_ShapeEnum styp;
|
||||
TopExp_Explorer exp;
|
||||
//
|
||||
styp = S.ShapeType();
|
||||
switch (styp) {
|
||||
|
||||
switch (styp)
|
||||
{
|
||||
case TopAbs_VERTEX:
|
||||
// modified by NIZHNY-MKK Wed May 19 16:56:16 2004.BEGIN
|
||||
// There is no need to check anything.
|
||||
@@ -121,306 +123,313 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
|
||||
// modified by NIZHNY-MKK Wed May 19 16:56:23 2004.END
|
||||
|
||||
break;
|
||||
case TopAbs_EDGE: {
|
||||
// Modified by skv - Tue Apr 27 11:38:08 2004 Begin
|
||||
// There is no need to check anything except vertices on single edge.
|
||||
// if (myShape.IsSame(S)) {
|
||||
// myMap(S)->Blind();
|
||||
// }
|
||||
// Modified by skv - Tue Apr 27 11:38:09 2004 End
|
||||
TopTools_MapOfShape MapS;
|
||||
|
||||
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next()) {
|
||||
const TopoDS_Shape& aVertex = exp.Current();
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
if (MapS.Add(aVertex)) {
|
||||
myMap(aVertex)->InContext(S);
|
||||
}
|
||||
case TopAbs_EDGE:
|
||||
{
|
||||
Handle(BRepCheck_Result)& aRes = myMap(S);
|
||||
|
||||
try
|
||||
{
|
||||
BRepCheck_Status ste = Handle(BRepCheck_Edge)::
|
||||
DownCast(aRes)->CheckPolygonOnTriangulation(TopoDS::Edge(S));
|
||||
|
||||
if(ste != BRepCheck_NoError)
|
||||
{
|
||||
Handle(BRepCheck_Edge)::DownCast(aRes)->SetStatus(ste);
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
Handle(BRepCheck_Result) aRes = myMap(aVertex);
|
||||
if ( ! aRes.IsNull() ) {
|
||||
aRes->SetFailStatus(aVertex);
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
if ( ! myMap(S).IsNull() )
|
||||
{
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
|
||||
if ( ! aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TopTools_MapOfShape MapS;
|
||||
|
||||
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aVertex = exp.Current();
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
if (MapS.Add(aVertex))
|
||||
myMap(aVertex)->InContext(S);
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
if ( ! myMap(S).IsNull() )
|
||||
myMap(S)->SetFailStatus(S);
|
||||
|
||||
Handle(BRepCheck_Result) aRes = myMap(aVertex);
|
||||
|
||||
if ( ! aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(aVertex);
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}//catch(Standard_Failure)
|
||||
}//for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
|
||||
}
|
||||
break;
|
||||
case TopAbs_WIRE:
|
||||
// Modified by Sergey KHROMOV - Mon May 6 15:53:39 2002 Begin
|
||||
// There is no need to check the orientation of a single wire
|
||||
// (not in context of face).
|
||||
// {
|
||||
// if (myShape.IsSame(S)) {
|
||||
// Handle(BRepCheck_Wire)::DownCast(myMap(S))->Orientation(TopoDS_Face(),
|
||||
// Standard_True);
|
||||
// }
|
||||
// }
|
||||
// Modified by Sergey KHROMOV - Mon May 6 15:53:40 2002 End
|
||||
{
|
||||
}
|
||||
break;
|
||||
case TopAbs_FACE:
|
||||
{
|
||||
TopTools_MapOfShape MapS;
|
||||
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next()) {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
if (MapS.Add(exp.Current())) {
|
||||
myMap(exp.Current())->InContext(S);
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
if (MapS.Add(exp.Current()))
|
||||
{
|
||||
myMap(exp.Current())->InContext(S);
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
if ( ! myMap(S).IsNull() )
|
||||
{
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
|
||||
if ( ! aRes.IsNull() ) {
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
if ( ! aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean performwire = Standard_True;
|
||||
Standard_Boolean isInvalidTolerance = Standard_False;
|
||||
MapS.Clear();
|
||||
for (exp.Init(S,TopAbs_EDGE);exp.More(); exp.Next()) {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
if (MapS.Add(exp.Current())) {
|
||||
Handle(BRepCheck_Result)& res = myMap(exp.Current());
|
||||
res->InContext(S);
|
||||
if (performwire) {
|
||||
for (res->InitContextIterator();
|
||||
res->MoreShapeInContext();
|
||||
res->NextShapeInContext()) {
|
||||
if(res->ContextualShape().IsSame(S)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
|
||||
for (; itl.More(); itl.Next()) {
|
||||
BRepCheck_Status ste = itl.Value();
|
||||
if (ste == BRepCheck_NoCurveOnSurface ||
|
||||
ste == BRepCheck_InvalidCurveOnSurface ||
|
||||
ste == BRepCheck_InvalidRange ||
|
||||
ste == BRepCheck_InvalidCurveOnClosedSurface) {
|
||||
performwire = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
for (exp.Init(S,TopAbs_EDGE);exp.More(); exp.Next())
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
if (MapS.Add(exp.Current()))
|
||||
{
|
||||
Handle(BRepCheck_Result)& res = myMap(exp.Current());
|
||||
res->InContext(S);
|
||||
if (performwire)
|
||||
{
|
||||
for ( res->InitContextIterator();
|
||||
res->MoreShapeInContext();
|
||||
res->NextShapeInContext())
|
||||
{
|
||||
if(res->ContextualShape().IsSame(S))
|
||||
break;
|
||||
}
|
||||
|
||||
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
BRepCheck_Status ste = itl.Value();
|
||||
if (ste == BRepCheck_NoCurveOnSurface ||
|
||||
ste == BRepCheck_InvalidCurveOnSurface ||
|
||||
ste == BRepCheck_InvalidRange ||
|
||||
ste == BRepCheck_InvalidCurveOnClosedSurface)
|
||||
{
|
||||
performwire = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
if ( ! myMap(S).IsNull() )
|
||||
{
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
|
||||
if ( ! aRes.IsNull() ) {
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
if ( ! aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean orientofwires = performwire;
|
||||
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next()) {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Handle(BRepCheck_Result)& res = myMap(exp.Current());
|
||||
res->InContext(S);
|
||||
if (orientofwires) {
|
||||
for (res->InitContextIterator();
|
||||
res->MoreShapeInContext();
|
||||
res->NextShapeInContext()) {
|
||||
if(res->ContextualShape().IsSame(S)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
|
||||
for (; itl.More(); itl.Next()) {
|
||||
BRepCheck_Status ste = itl.Value();
|
||||
if (ste != BRepCheck_NoError) {
|
||||
orientofwires = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
Handle(BRepCheck_Result)& res = myMap(exp.Current());
|
||||
res->InContext(S);
|
||||
if (orientofwires)
|
||||
{
|
||||
for ( res->InitContextIterator();
|
||||
res->MoreShapeInContext();
|
||||
res->NextShapeInContext())
|
||||
{
|
||||
if(res->ContextualShape().IsSame(S))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
BRepCheck_Status ste = itl.Value();
|
||||
if (ste != BRepCheck_NoError)
|
||||
{
|
||||
orientofwires = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
if ( ! myMap(S).IsNull() )
|
||||
{
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
|
||||
if ( ! aRes.IsNull() ) {
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
|
||||
if ( ! aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
if (performwire) {
|
||||
if (orientofwires) {
|
||||
Handle(BRepCheck_Face)::DownCast(myMap(S))->
|
||||
OrientationOfWires(Standard_True);// on enregistre
|
||||
}
|
||||
// else {
|
||||
// Handle(BRepCheck_Face)::DownCast(myMap(S))->
|
||||
// IntersectWires(Standard_True); // on enregistre
|
||||
// }
|
||||
else {
|
||||
Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
|
||||
}
|
||||
if(isInvalidTolerance)
|
||||
{
|
||||
Handle(BRepCheck_Face)::
|
||||
DownCast(myMap(S))->SetStatus(BRepCheck_InvalidToleranceValue);
|
||||
}
|
||||
else if (performwire)
|
||||
{
|
||||
if (orientofwires)
|
||||
{
|
||||
Handle(BRepCheck_Face)::DownCast(myMap(S))->
|
||||
OrientationOfWires(Standard_True);// on enregistre
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
if ( ! myMap(S).IsNull() )
|
||||
{
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
|
||||
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next()) {
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
|
||||
if ( ! aRes.IsNull() ) {
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
myMap(S)->SetFailStatus(exp.Current());
|
||||
}
|
||||
}
|
||||
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
|
||||
{
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
|
||||
if ( ! aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
myMap(S)->SetFailStatus(exp.Current());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TopAbs_SHELL:
|
||||
//modified by NIZNHY-PKV Mon Oct 13 14:23:53 2008f
|
||||
/* {
|
||||
Standard_Boolean VerifyOrientation, bFlag;
|
||||
//
|
||||
VerifyOrientation = Standard_True;
|
||||
//
|
||||
exp.Init(S,TopAbs_FACE);
|
||||
for (; exp.More(); exp.Next()) {
|
||||
const TopoDS_Shape& aF=exp.Current();
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
bFlag= !(Handle(BRepCheck_Face)::DownCast(myMap(aF))->IsUnorientable());
|
||||
VerifyOrientation = (VerifyOrientation && bFlag);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
|
||||
if ( ! aRes.IsNull() ) {
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}
|
||||
} //
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
if (VerifyOrientation) {
|
||||
Handle(BRepCheck_Shell)::DownCast(myMap(S))->Orientation(Standard_True);
|
||||
}
|
||||
else {
|
||||
Handle(BRepCheck_Shell)::DownCast(myMap(S))->SetUnorientable();
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
exp.Init(S,TopAbs_FACE);
|
||||
for (; exp.More(); exp.Next()) {
|
||||
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
|
||||
if ( ! aRes.IsNull() ) {
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
myMap(S)->SetFailStatus(exp.Current());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//modified by NIZNHY-PKV Mon Oct 13 14:24:04 2008t
|
||||
break;
|
||||
//
|
||||
case TopAbs_SOLID: {
|
||||
|
||||
case TopAbs_SOLID:
|
||||
{
|
||||
exp.Init(S,TopAbs_SHELL);
|
||||
for (; exp.More(); exp.Next()) {
|
||||
for (; exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aShell=exp.Current();
|
||||
try {
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
myMap(aShell)->InContext(S);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
catch(Standard_Failure)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"BRepCheck_Analyzer : ";
|
||||
Standard_Failure::Caught()->Print(cout);
|
||||
cout<<endl;
|
||||
#endif
|
||||
if ( ! myMap(S).IsNull() ) {
|
||||
if ( ! myMap(S).IsNull() )
|
||||
{
|
||||
myMap(S)->SetFailStatus(S);
|
||||
}
|
||||
|
||||
//
|
||||
Handle(BRepCheck_Result) aRes = myMap(aShell);
|
||||
if (!aRes.IsNull() ) {
|
||||
if (!aRes.IsNull() )
|
||||
{
|
||||
aRes->SetFailStatus(exp.Current());
|
||||
aRes->SetFailStatus(S);
|
||||
}
|
||||
}//catch(Standard_Failure)
|
||||
}//for (; exp.More(); exp.Next())
|
||||
}
|
||||
}
|
||||
}
|
||||
break;//case TopAbs_SOLID
|
||||
default:
|
||||
break;
|
||||
|
@@ -21,7 +21,8 @@ class Edge from BRepCheck inherits Result from BRepCheck
|
||||
uses Shape from TopoDS,
|
||||
Edge from TopoDS,
|
||||
CurveRepresentation from BRep,
|
||||
HCurve from Adaptor3d
|
||||
HCurve from Adaptor3d,
|
||||
Status from BRepCheck
|
||||
|
||||
is
|
||||
|
||||
@@ -55,6 +56,18 @@ is
|
||||
|
||||
is static;
|
||||
|
||||
SetStatus(me: mutable;
|
||||
theStatus:Status from BRepCheck)
|
||||
|
||||
--- Purpose: Sets status of Edge;
|
||||
is static;
|
||||
|
||||
CheckPolygonOnTriangulation(me: mutable; theEdge: Edge from TopoDS)
|
||||
--- Purpose: Checks, if polygon on triangulation of heEdge
|
||||
-- is out of 3D-curve of this edge.
|
||||
returns Status from BRepCheck
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myCref : CurveRepresentation from BRep;
|
||||
|
@@ -16,6 +16,10 @@
|
||||
|
||||
#include <BRepCheck_Edge.ixx>
|
||||
#include <TColStd_Array1OfTransient.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
#include <BRepCheck_ListOfStatus.hxx>
|
||||
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
|
||||
@@ -29,6 +33,8 @@
|
||||
#include <BRep_GCurve.hxx>
|
||||
#include <BRep_CurveOnSurface.hxx>
|
||||
|
||||
#include <BRep_PolygonOnTriangulation.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
@@ -57,6 +63,8 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
//modified by NIZNHY-PKV Thu May 05 09:01:57 2011f
|
||||
static
|
||||
@@ -83,7 +91,7 @@ static
|
||||
// const Standard_Boolean);
|
||||
//modified by NIZNHY-PKV Thu May 05 09:02:01 2011t
|
||||
|
||||
#define NCONTROL 23
|
||||
static const Standard_Integer NCONTROL=23;
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepCheck_Edge
|
||||
@@ -236,7 +244,13 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (styp) {
|
||||
switch (styp)
|
||||
{
|
||||
case TopAbs_WIRE:
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
case TopAbs_FACE:
|
||||
if (!myCref.IsNull()) {
|
||||
|
||||
@@ -273,8 +287,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
// gka OCC
|
||||
// Modified by skv - Tue Apr 27 11:50:35 2004 Begin
|
||||
// if (SameRange && (fabs(f-First) > Precision::PConfusion() || fabs(l-Last)> Precision::PConfusion())) { //f != First || l != Last)) { gka OCC
|
||||
if (fabs(f-First) > Precision::PConfusion() ||
|
||||
fabs(l-Last) > Precision::PConfusion()) {
|
||||
if (Abs(f-First) > Precision::PConfusion() ||
|
||||
Abs(l-Last) > Precision::PConfusion()) {
|
||||
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
|
||||
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
|
||||
// if (SameParameter) {
|
||||
@@ -449,7 +463,14 @@ Standard_Boolean BRepCheck_Edge::GeometricControls() const
|
||||
return myGctrl;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepCheck_Edge::SetStatus(const BRepCheck_Status theStatus)
|
||||
{
|
||||
BRepCheck::Add(myMap(myShape),theStatus);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@@ -547,6 +568,114 @@ Standard_Real BRepCheck_Edge::Tolerance()
|
||||
return sqrt(tolCal)*1.05;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepCheck_Status BRepCheck_Edge::
|
||||
CheckPolygonOnTriangulation(const TopoDS_Edge& theEdge)
|
||||
{
|
||||
BRep_ListOfCurveRepresentation& aListOfCR =
|
||||
(*((Handle(BRep_TEdge)*) &theEdge.TShape()))->ChangeCurves();
|
||||
BRep_ListIteratorOfListOfCurveRepresentation anITCR(aListOfCR);
|
||||
|
||||
BRepAdaptor_Curve aBC;
|
||||
aBC.Initialize(theEdge);
|
||||
|
||||
if(!aBC.Is3DCurve())
|
||||
return BRepCheck_NoError;
|
||||
|
||||
while (anITCR.More())
|
||||
{
|
||||
if(!anITCR.Value()->IsPolygonOnTriangulation())
|
||||
{
|
||||
anITCR.Next();
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(BRep_CurveRepresentation) aCR = anITCR.Value();
|
||||
const Handle(BRep_PolygonOnTriangulation)& aPT =
|
||||
Handle(BRep_PolygonOnTriangulation)::DownCast(aCR);
|
||||
|
||||
const TopLoc_Location aLL = theEdge.Location() * aPT->Location();
|
||||
|
||||
const Handle(Poly_Triangulation) aTriang = aCR->Triangulation();
|
||||
const Handle(Poly_PolygonOnTriangulation) aPOnTriag =
|
||||
aCR->IsPolygonOnClosedTriangulation() ?
|
||||
aCR->PolygonOnTriangulation2() :
|
||||
aCR->PolygonOnTriangulation();
|
||||
const TColStd_Array1OfInteger& anIndices = aPOnTriag->Nodes();
|
||||
const TColgp_Array1OfPnt& Nodes = aTriang->Nodes();
|
||||
const Standard_Integer aNbNodes = anIndices.Length();
|
||||
|
||||
const Standard_Real aTol = aPOnTriag->Deflection() +
|
||||
BRep_Tool::Tolerance(theEdge);
|
||||
|
||||
if(aPOnTriag->HasParameters())
|
||||
{
|
||||
for(Standard_Integer i = aPOnTriag->Parameters()->Lower();
|
||||
i <= aPOnTriag->Parameters()->Upper(); i++)
|
||||
{
|
||||
const Standard_Real aParam = aPOnTriag->Parameters()->Value(i);
|
||||
const gp_Pnt aPE(aBC.Value(aParam)),
|
||||
aPT(Nodes(anIndices(i)).Transformed(aLL));
|
||||
|
||||
const Standard_Real aSQDist = aPE.SquareDistance(aPT);
|
||||
if(aSQDist > aTol*aTol)
|
||||
{
|
||||
return BRepCheck_InvalidPolygonOnTriangulation;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//If aPOnTriag does not have any parameters we will check if it
|
||||
//inscribes into Bounding box, which is built on the edge triangulation.
|
||||
|
||||
Bnd_Box aB;
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNbNodes; i++)
|
||||
{
|
||||
if (aLL.IsIdentity())
|
||||
aB.Add(Nodes(anIndices(i)));
|
||||
else
|
||||
aB.Add(Nodes(anIndices(i)).Transformed(aLL));
|
||||
}
|
||||
|
||||
aB.Enlarge(aTol);
|
||||
|
||||
Standard_Real aFP = aBC.FirstParameter();
|
||||
Standard_Real aLP = aBC.LastParameter();
|
||||
|
||||
const Standard_Real aStep = (aLP - aFP)/IntToReal(NCONTROL);
|
||||
gp_Pnt aP;
|
||||
Standard_Real aPar = aFP;
|
||||
|
||||
for(Standard_Integer i = 1; i < NCONTROL; i ++)
|
||||
{
|
||||
aBC.D0(aPar, aP);
|
||||
if(aB.IsOut(aP))
|
||||
{
|
||||
return BRepCheck_InvalidPolygonOnTriangulation;
|
||||
}
|
||||
|
||||
aPar += aStep;
|
||||
}
|
||||
|
||||
aBC.D0(aLP, aP);
|
||||
if(aB.IsOut(aP))
|
||||
{
|
||||
return BRepCheck_InvalidPolygonOnTriangulation;
|
||||
}
|
||||
}
|
||||
|
||||
anITCR.Next();
|
||||
}
|
||||
|
||||
return BRepCheck_NoError;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Validate
|
||||
//purpose :
|
||||
@@ -564,12 +693,13 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||
Error = 0.;
|
||||
First = CRef.FirstParameter();
|
||||
Last = CRef.LastParameter();
|
||||
//
|
||||
|
||||
aPC=Precision::PConfusion();
|
||||
proj = (!SameParameter ||
|
||||
fabs(Other.FirstParameter()-First) > aPC ||
|
||||
fabs( Other.LastParameter()-Last) > aPC);
|
||||
if (!proj) {
|
||||
Abs(Other.FirstParameter()-First) > aPC ||
|
||||
Abs( Other.LastParameter()-Last) > aPC);
|
||||
if (!proj)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Real Tol2, prm, dD;
|
||||
gp_Pnt pref, pother;
|
||||
@@ -581,7 +711,7 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||
//Tol2=Tol*Tol;
|
||||
//modified by NIZNHY-PKV Thu May 05 09:06:47 2011t
|
||||
|
||||
for (i = 0; i< NCONTROL; ++i) {
|
||||
for (i = 0; i < NCONTROL; ++i) {
|
||||
prm = ((NCONTROL-1-i)*First + i*Last)/(NCONTROL-1);
|
||||
pref = CRef.Value(prm);
|
||||
pother = Other.Value(prm);
|
||||
@@ -659,18 +789,6 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
|
||||
}
|
||||
}
|
||||
}
|
||||
//FINISH :
|
||||
/*
|
||||
#ifdef DEB
|
||||
if (! Status) {
|
||||
cout << " **** probleme de SameParameter au point :" << endl;
|
||||
cout << " " << problematic_point.Coord(1) << " "
|
||||
<< problematic_point.Coord(2) << " "
|
||||
<< problematic_point.Coord(3) << endl ;
|
||||
cout << " Erreur detectee :" << Error << " Tolerance :" << Tol << endl;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
return Status ;
|
||||
|
||||
|
@@ -66,6 +66,13 @@ is
|
||||
|
||||
is static;
|
||||
|
||||
SetStatus(me: mutable;
|
||||
theStatus:Status from BRepCheck)
|
||||
|
||||
--- Purpose: Sets status of Face;
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
IsUnorientable(me)
|
||||
|
||||
|
@@ -494,6 +494,15 @@ void BRepCheck_Face::SetUnorientable()
|
||||
BRepCheck::Add(myMap(myShape),BRepCheck_UnorientableShape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepCheck_Face::SetStatus(const BRepCheck_Status theStatus)
|
||||
{
|
||||
BRepCheck::Add(myMap(myShape),theStatus);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsUnorientable
|
||||
|
@@ -122,7 +122,11 @@ is
|
||||
---Purpose: set SelfIntersect() to be checked
|
||||
is static;
|
||||
|
||||
SetStatus(me: mutable;
|
||||
theStatus:Status from BRepCheck)
|
||||
|
||||
--- Purpose: Sets status of Wire;
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
|
@@ -1500,6 +1500,17 @@ BRepCheck_Status BRepCheck_Wire::SelfIntersect(const TopoDS_Face& F,
|
||||
//
|
||||
return (BRepCheck_NoError);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepCheck_Wire::SetStatus(const BRepCheck_Status theStatus)
|
||||
{
|
||||
BRepCheck::Add(myMap(myShape),theStatus);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GeometricControls
|
||||
//purpose :
|
||||
|
Reference in New Issue
Block a user