mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
8 Commits
CR32857_us
...
CR770-SALO
Author | SHA1 | Date | |
---|---|---|---|
|
ec7f1db190 | ||
|
3edc262d43 | ||
|
bfacb83607 | ||
|
61b0e8c5e3 | ||
|
f8320ee51b | ||
|
fc54ce089b | ||
|
89e09e4c18 | ||
|
7c73277ec9 |
@@ -42,14 +42,12 @@
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
//#define OCCT_DEBUG_ALGO
|
||||
//#define DRAW
|
||||
#ifdef DRAW
|
||||
#include <DBRep.hxx>
|
||||
#pragma comment(lib,"TKDraw")
|
||||
#endif
|
||||
#ifdef OCCT_DEBUG_ALGO
|
||||
Standard_Boolean AffichLoop = Standard_True;
|
||||
Standard_Boolean AffichLoop = Standard_False;
|
||||
Standard_Integer NbLoops = 0;
|
||||
Standard_Integer NbWires = 1;
|
||||
static char* name = new char[100];
|
||||
@@ -60,8 +58,7 @@ static char* name = new char[100];
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepAlgo_Loop::BRepAlgo_Loop():
|
||||
myTolConf (0.001)
|
||||
BRepAlgo_Loop::BRepAlgo_Loop()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -188,6 +185,7 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E,
|
||||
Standard_Boolean OnStart = 0, OnEnd = 0;
|
||||
//// modified by jgv, 13.04.04 for OCC5634 ////
|
||||
TopExp::Vertices (E,V1,V2);
|
||||
//Standard_Real Tol = Precision::Confusion();
|
||||
Standard_Real Tol = BRep_Tool::Tolerance( V1 );
|
||||
///////////////////////////////////////////////
|
||||
|
||||
@@ -429,12 +427,13 @@ static void StoreInMVE (const TopoDS_Face& F,
|
||||
TopoDS_Edge& E,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& MVE,
|
||||
Standard_Boolean& YaCouture,
|
||||
TopTools_DataMapOfShapeShape& VerticesForSubstitute,
|
||||
const Standard_Real theTolConf)
|
||||
TopTools_DataMapOfShapeShape& VerticesForSubstitute )
|
||||
{
|
||||
TopoDS_Vertex V1, V2, V;
|
||||
TopTools_ListOfShape Empty;
|
||||
|
||||
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
|
||||
// gp_Pnt P1, P2, P;
|
||||
gp_Pnt P1, P;
|
||||
BRep_Builder BB;
|
||||
for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++)
|
||||
@@ -450,7 +449,7 @@ static void StoreInMVE (const TopoDS_Face& F,
|
||||
{
|
||||
V1 = TopoDS::Vertex( itl.Value() );
|
||||
P1 = BRep_Tool::Pnt( V1 );
|
||||
if (P.IsEqual( P1, theTolConf ) && !V.IsSame(V1))
|
||||
if (P.IsEqual( P1, Tol ) && !V.IsSame(V1))
|
||||
{
|
||||
V.Orientation( V1.Orientation() );
|
||||
if (VerticesForSubstitute.IsBound( V1 ))
|
||||
@@ -575,7 +574,7 @@ void BRepAlgo_Loop::Perform()
|
||||
TopoDS_Edge& E = TopoDS::Edge(itl1.Value());
|
||||
if (!Emap.Add(E))
|
||||
continue;
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,7 +586,7 @@ void BRepAlgo_Loop::Perform()
|
||||
for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) {
|
||||
TopoDS_Edge& E = TopoDS::Edge(itl.Value());
|
||||
if (DejaVu.Add(E))
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
|
||||
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
|
||||
}
|
||||
|
||||
#ifdef DRAW
|
||||
@@ -627,42 +626,42 @@ void BRepAlgo_Loop::Perform()
|
||||
//--------------------------------
|
||||
RemovePendingEdges(MVE);
|
||||
|
||||
if (MVE.Extent() == 0) break;
|
||||
if (MVE.Extent() == 0) break;
|
||||
//--------------------------------
|
||||
// Start edge.
|
||||
//--------------------------------
|
||||
EF = CE = TopoDS::Edge(MVE(1).First());
|
||||
TopExp::Vertices(CE, V1, V2);
|
||||
TopExp::Vertices(CE,V1,V2);
|
||||
//--------------------------------
|
||||
// VF vertex start of new wire
|
||||
//--------------------------------
|
||||
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1; }
|
||||
else { CV = VF = V2; }
|
||||
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1;}
|
||||
else { CV = VF = V2;}
|
||||
if (!MVE.Contains(CV)) continue;
|
||||
TopTools_ListOfShape& aListEdges = MVE.ChangeFromKey(CV);
|
||||
for (itl.Initialize(aListEdges); itl.More(); itl.Next()) {
|
||||
for ( itl.Initialize(aListEdges); itl.More(); itl.Next()) {
|
||||
if (itl.Value().IsEqual(CE)) {
|
||||
aListEdges.Remove(itl);
|
||||
break;
|
||||
aListEdges.Remove(itl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
End = Standard_False;
|
||||
|
||||
End = Standard_False;
|
||||
|
||||
while (!End) {
|
||||
//-------------------------------
|
||||
// Construction of a wire.
|
||||
//-------------------------------
|
||||
TopExp::Vertices(CE, V1, V2);
|
||||
TopExp::Vertices(CE,V1,V2);
|
||||
if (!CV.IsSame(V1)) CV = V1; else CV = V2;
|
||||
|
||||
B.Add(NW, CE);
|
||||
B.Add (NW,CE);
|
||||
UsedEdges.Add(CE);
|
||||
|
||||
if (!MVE.Contains(CV) || MVE.FindFromKey(CV).IsEmpty()) {
|
||||
End = Standard_True;
|
||||
}
|
||||
else {
|
||||
End = !SelectEdge(myFace, CE, CV, NE, MVE.ChangeFromKey(CV));
|
||||
End = !SelectEdge(myFace,CE,CV,NE,MVE.ChangeFromKey(CV));
|
||||
if (!End) {
|
||||
CE = NE;
|
||||
if (MVE.FindFromKey(CV).IsEmpty())
|
||||
@@ -673,41 +672,35 @@ void BRepAlgo_Loop::Perform()
|
||||
//--------------------------------------------------
|
||||
// Add new wire to the set of wires
|
||||
//------------------------------------------------
|
||||
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
|
||||
TopExp_Explorer explo( NW, TopAbs_VERTEX );
|
||||
for (; explo.More(); explo.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex( explo.Current() );
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &(aV).TShape());
|
||||
TV->Tolerance( Tol );
|
||||
TV->Modified( Standard_True );
|
||||
}
|
||||
for (explo.Init( NW, TopAbs_EDGE ); explo.More(); explo.Next())
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge( explo.Current() );
|
||||
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &(aE).TShape());
|
||||
TE->Tolerance( Tol );
|
||||
TE->Modified( Standard_True );
|
||||
}
|
||||
|
||||
if (VF.IsSame(CV))
|
||||
if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
|
||||
{
|
||||
if (SamePnt2d(VF, EF, CE, myFace))
|
||||
{
|
||||
NW.Closed(Standard_True);
|
||||
myNewWires.Append(NW);
|
||||
}
|
||||
else if(BRep_Tool::Tolerance(VF) < myTolConf)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
aBB.UpdateVertex(VF, myTolConf);
|
||||
if (SamePnt2d(VF, EF, CE, myFace))
|
||||
{
|
||||
NW.Closed(Standard_True);
|
||||
myNewWires.Append(NW);
|
||||
}
|
||||
#ifdef OCCT_DEBUG_ALGO
|
||||
else
|
||||
{
|
||||
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
|
||||
if (AffichLoop)
|
||||
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
NW.Closed (Standard_True);
|
||||
myNewWires.Append (NW);
|
||||
}
|
||||
#ifdef OCCT_DEBUG_ALGO
|
||||
else {
|
||||
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
|
||||
std::cout <<"BRepAlgo_Loop: Open Wire"<<std::endl;
|
||||
if (AffichLoop)
|
||||
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
|
||||
}
|
||||
std::cout << "OpenWire is : NW_"<<NbLoops<<"_"<<NbWires<<std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DRAW
|
||||
if (AffichLoop) {
|
||||
sprintf(name,"NW_%d_%d",NbLoops,NbWires++);
|
||||
@@ -784,6 +777,8 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
|
||||
VF = TopoDS::Vertex(aLocalV);
|
||||
aLocalV = VCEI.Oriented(TopAbs_REVERSED);
|
||||
VL = TopoDS::Vertex(aLocalV);
|
||||
// VF = TopoDS::Vertex(VCEI.Oriented(TopAbs_FORWARD));
|
||||
// VL = TopoDS::Vertex(VCEI.Oriented(TopAbs_REVERSED));
|
||||
}
|
||||
SV.Prepend(VF);
|
||||
SV.Append(VL);
|
||||
@@ -818,9 +813,13 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
|
||||
B.Add (NewEdge,aLocalEdge);
|
||||
aLocalEdge = V2.Oriented(TopAbs_REVERSED);
|
||||
B.Add (TopoDS::Edge(NewEdge),aLocalEdge);
|
||||
// B.Add (NewEdge,V1.Oriented(TopAbs_FORWARD));
|
||||
// B.Add (NewEdge,V2.Oriented(TopAbs_REVERSED));
|
||||
if (V1.IsSame(VF))
|
||||
U1 = f;
|
||||
else
|
||||
// U1=BRep_Tool::Parameter
|
||||
// (TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),WE);
|
||||
{
|
||||
TopoDS_Shape aLocalV = V1.Oriented(TopAbs_INTERNAL);
|
||||
U1=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
|
||||
@@ -831,6 +830,8 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
|
||||
{
|
||||
TopoDS_Shape aLocalV = V2.Oriented(TopAbs_INTERNAL);
|
||||
U2=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
|
||||
// U2=BRep_Tool::Parameter
|
||||
// (TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),WE);
|
||||
}
|
||||
B.Range (TopoDS::Edge(NewEdge),U1,U2);
|
||||
#ifdef DRAW
|
||||
|
@@ -86,17 +86,8 @@ public:
|
||||
|
||||
Standard_EXPORT void VerticesForSubstitute (TopTools_DataMapOfShapeShape& VerVerMap);
|
||||
|
||||
//! Set maximal tolerance used for comparing distaces between vertices.
|
||||
void SetTolConf(const Standard_Real theTolConf)
|
||||
{
|
||||
myTolConf = theTolConf;
|
||||
}
|
||||
|
||||
//! Get maximal tolerance used for comparing distaces between vertices.
|
||||
Standard_Real GetTolConf() const
|
||||
{
|
||||
return myTolConf;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -117,7 +108,6 @@ private:
|
||||
TopTools_DataMapOfShapeListOfShape myCutEdges;
|
||||
TopTools_DataMapOfShapeShape myVerticesForSubstitute;
|
||||
BRepAlgo_Image myImageVV;
|
||||
Standard_Real myTolConf;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -468,7 +468,14 @@ static void PERFORM_C0(const TopoDS_Edge& S1, const TopoDS_Edge& S2,
|
||||
if (fabs(Dstmin - sqrt(Ext.SquareDistance(ii))) < Eps)
|
||||
{
|
||||
Pt = Ext.Point(ii);
|
||||
if (TRI_SOLUTION(SeqSol2, Pt))
|
||||
// Pt - point on the curve pCurvOther/Eother, but
|
||||
// if iE == 0 -> Eother correspond to edge S2
|
||||
// and to edge S1 in the opposite case.
|
||||
// Therefore we should search Pt through previous solution points on Other curve (edge):
|
||||
// if iE == 0 - on edge S2, namely through SeqSol2,
|
||||
// else - on edge S1, namely through SeqSol1.
|
||||
const bool triSolutionResult = (iE == 0) ? TRI_SOLUTION(SeqSol2, Pt) : TRI_SOLUTION(SeqSol1, Pt);
|
||||
if (triSolutionResult)
|
||||
{
|
||||
// Check if the parameter does not correspond to a vertex
|
||||
const Standard_Real t = Ext.Parameter(ii);
|
||||
@@ -869,9 +876,19 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1,
|
||||
|
||||
if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty())
|
||||
{
|
||||
theSeqSolShape1.Append(seqSol1);
|
||||
theSeqSolShape2.Append(seqSol2);
|
||||
myModif = Standard_True;
|
||||
BRepExtrema_SeqOfSolution::iterator anIt1 = seqSol1.begin();
|
||||
BRepExtrema_SeqOfSolution::iterator anIt2 = seqSol2.begin();
|
||||
for (; anIt1 != seqSol1.end() && anIt2 != seqSol2.end(); anIt1++, anIt2++)
|
||||
{
|
||||
gp_Pnt Pt1 = anIt1->Point();
|
||||
gp_Pnt Pt2 = anIt2->Point();
|
||||
if (TRI_SOLUTION(theSeqSolShape1, Pt1) || TRI_SOLUTION(theSeqSolShape2, Pt2))
|
||||
{
|
||||
theSeqSolShape1.Append(*anIt1);
|
||||
theSeqSolShape2.Append(*anIt2);
|
||||
myModif = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -512,7 +512,7 @@ void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
|
||||
if (!myIsInitS1 || !myIsInitS2 || (myShapeType1 != myShapeType2))
|
||||
return;
|
||||
|
||||
//get vertices on shapes with refining a coarser mesh if it's needed
|
||||
// get vertices on shapes with refining a coarser mesh if it's needed
|
||||
if (!getShapesAdditionalVertices())
|
||||
return;
|
||||
|
||||
@@ -530,37 +530,11 @@ void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
|
||||
if (aProximityDist1 < 0.)
|
||||
return;
|
||||
|
||||
// max(min) dist from the 2nd shape to t he 1st one
|
||||
BVH_Vec3d aP2_1, aP2_2;
|
||||
ProxPnt_Status aPointStatus2_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
ProxPnt_Status aPointStatus2_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
|
||||
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, myAddVertices2, myAddStatus2,
|
||||
mySet1,
|
||||
myShapeList2, myShapeList1,
|
||||
aP2_2, aP2_1,
|
||||
aPointStatus2_2, aPointStatus2_1);
|
||||
|
||||
if (aProximityDist2 < 0.)
|
||||
return;
|
||||
|
||||
// min dist of the two max(min) dists
|
||||
if (aProximityDist1 < aProximityDist2)
|
||||
{
|
||||
myDistance = aProximityDist1;
|
||||
myPnt1.SetCoord(aP1_1.x(), aP1_1.y(), aP1_1.z());
|
||||
myPnt2.SetCoord(aP1_2.x(), aP1_2.y(), aP1_2.z());
|
||||
myPntStatus1 = aPointStatus1_1;
|
||||
myPntStatus2 = aPointStatus1_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
myDistance = aProximityDist2;
|
||||
myPnt1.SetCoord(aP2_1.x(), aP2_1.y(), aP2_1.z());
|
||||
myPnt2.SetCoord(aP2_2.x(), aP2_2.y(), aP2_2.z());
|
||||
myPntStatus1 = aPointStatus2_1;
|
||||
myPntStatus2 = aPointStatus2_2;
|
||||
}
|
||||
myDistance = aProximityDist1;
|
||||
myPnt1.SetCoord(aP1_1.x(), aP1_1.y(), aP1_1.z());
|
||||
myPnt2.SetCoord(aP1_2.x(), aP1_2.y(), aP1_2.z());
|
||||
myPntStatus1 = aPointStatus1_1;
|
||||
myPntStatus2 = aPointStatus1_2;
|
||||
|
||||
myIsDone = Standard_True;
|
||||
theTolerance = myDistance;
|
||||
@@ -584,4 +558,4 @@ NCollection_CellFilter_Action BRepExtrema_VertexInspector::Inspect (const Standa
|
||||
myIsNeedAdd = Standard_False;
|
||||
|
||||
return CellFilter_Keep;
|
||||
}
|
||||
}
|
||||
|
@@ -56,7 +56,6 @@
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <BRepExtrema_ExtCC.hxx>
|
||||
#include <ShapeFix_Edge.hxx>
|
||||
|
||||
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
|
||||
TopoDS_Compound& theComp,
|
||||
@@ -535,26 +534,6 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
|
||||
|
||||
if(bHasNewEdge) {
|
||||
aNewEdge.Orientation(TopAbs_FORWARD);
|
||||
|
||||
// Refer to BrepFill_Sweep.cxx BuildEdge Construct an edge via an iso
|
||||
gp_Pnt P1, P2;
|
||||
Standard_Real p11, p12, p21, p22;
|
||||
P1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aNewEdge)));
|
||||
P2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aNewEdge)));
|
||||
|
||||
TopoDS_Edge aERef = TopoDS::Edge(fit == 1 ? aE1 : aE2);
|
||||
p11 = P1.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
|
||||
p22 = P2.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
|
||||
p12 = P1.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
|
||||
p21 = P2.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
|
||||
|
||||
if (p11 > p12 && p22 > p21) {
|
||||
aNewEdge.Reverse();
|
||||
}
|
||||
|
||||
// for nonPlane surface, we should add pCurve
|
||||
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge();
|
||||
sfe->FixAddPCurve(aNewEdge, TopoDS::Face(aFace), Standard_False);
|
||||
}
|
||||
|
||||
TopTools_ListOfShape aOrderedList;
|
||||
|
@@ -802,7 +802,7 @@ static void GetEdgeTol(const TopoDS_Edge& theEdge,
|
||||
}
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
d2 = 1.05*sqrt(d2);
|
||||
d2 = 1.5*sqrt(d2);
|
||||
theEdTol = d2;
|
||||
}
|
||||
|
||||
@@ -884,6 +884,10 @@ static void UpdShTol(const TopTools_DataMapOfShapeReal& theShToTol,
|
||||
case TopAbs_VERTEX:
|
||||
{
|
||||
const Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aNsh.TShape());
|
||||
//
|
||||
if(aTV->Locked())
|
||||
throw TopoDS_LockedShape("BRep_Builder::UpdateVertex");
|
||||
//
|
||||
if (theVForceUpdate)
|
||||
aTV->Tolerance(aTol);
|
||||
else
|
||||
@@ -961,6 +965,9 @@ static void InternalSameParameter(const TopoDS_Shape& theSh, BRepTools_ReShape&
|
||||
TopExp_Explorer ex2;
|
||||
for(ex2.Init(curface,TopAbs_EDGE); ex2.More(); ex2.Next()){
|
||||
const TopoDS_Edge& E = TopoDS::Edge(ex2.Current());
|
||||
if (BRep_Tool::Degenerated(E))
|
||||
continue;
|
||||
|
||||
TopoDS_Shape aNe = theReshaper.Value(E);
|
||||
Standard_Real aNewEtol = -1;
|
||||
GetEdgeTol(TopoDS::Edge(aNe), curface, aNewEtol);
|
||||
@@ -1705,8 +1712,8 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
|
||||
for (iCur=1; iCur<=nbV; iCur++) {
|
||||
tol=0;
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex(parents.FindKey(iCur));
|
||||
gp_Pnt aPV = BRep_Tool::Pnt(V);
|
||||
Standard_Real aMaxDist = 0.;
|
||||
Bnd_Box box;
|
||||
box.Add(BRep_Tool::Pnt(V));
|
||||
gp_Pnt p3d;
|
||||
for (lConx.Initialize(parents(iCur)); lConx.More(); lConx.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(lConx.Value());
|
||||
@@ -1728,10 +1735,8 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
|
||||
if (!C.IsNull()) { // edge non degenerated
|
||||
p3d = C->Value(par);
|
||||
p3d.Transform(L.Transformation());
|
||||
Standard_Real aDist = p3d.SquareDistance(aPV);
|
||||
if (aDist > aMaxDist)
|
||||
aMaxDist = aDist;
|
||||
}
|
||||
box.Add(p3d);
|
||||
}
|
||||
}
|
||||
else if (cr->IsCurveOnSurface()) {
|
||||
const Handle(Geom_Surface)& Su = cr->Surface();
|
||||
@@ -1743,22 +1748,21 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
|
||||
gp_Pnt2d p2d = PC->Value(par);
|
||||
p3d = Su->Value(p2d.X(),p2d.Y());
|
||||
p3d.Transform(L.Transformation());
|
||||
Standard_Real aDist = p3d.SquareDistance(aPV);
|
||||
if (aDist > aMaxDist)
|
||||
aMaxDist = aDist;
|
||||
box.Add(p3d);
|
||||
if (!PC2.IsNull()) {
|
||||
p2d = PC2->Value(par);
|
||||
p3d = Su->Value(p2d.X(),p2d.Y());
|
||||
p3d.Transform(L.Transformation());
|
||||
aDist = p3d.SquareDistance(aPV);
|
||||
if (aDist > aMaxDist)
|
||||
aMaxDist = aDist;
|
||||
box.Add(p3d);
|
||||
}
|
||||
}
|
||||
itcr.Next();
|
||||
}
|
||||
}
|
||||
tol = Max(tol, sqrt(aMaxDist));
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
box.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
aXmax -= aXmin; aYmax -= aYmin; aZmax -= aZmin;
|
||||
tol = Max(tol,sqrt(aXmax*aXmax+aYmax*aYmax+aZmax*aZmax));
|
||||
tol += 2.*Epsilon(tol);
|
||||
//
|
||||
Standard_Real aVTol = BRep_Tool::Tolerance(V);
|
||||
|
@@ -256,7 +256,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W,
|
||||
myError = BRepLib_NotPlanar;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// build the face and add the wire
|
||||
BRep_Builder B;
|
||||
myError = BRepLib_FaceDone;
|
||||
@@ -264,13 +264,48 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W,
|
||||
Standard_Real tol = Max(1.2*FS.ToleranceReached(), FS.Tolerance());
|
||||
|
||||
B.MakeFace(TopoDS::Face(myShape),FS.Surface(),FS.Location(),tol);
|
||||
Add(W);
|
||||
|
||||
TopoDS_Wire aW;
|
||||
if (OnlyPlane)
|
||||
{
|
||||
// get rid of degenerative edges in the input wire
|
||||
BRep_Builder aB;
|
||||
aB.MakeWire (aW);
|
||||
|
||||
TopoDS_Wire aWForw = W;
|
||||
Standard_Boolean hasDegenerated = Standard_False;
|
||||
aWForw.Orientation (TopAbs_FORWARD);
|
||||
TopoDS_Iterator anIter (aWForw);
|
||||
for (; anIter.More(); anIter.Next())
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge (anIter.Value());
|
||||
|
||||
if (BRep_Tool::Degenerated (aE))
|
||||
hasDegenerated = Standard_True;
|
||||
else
|
||||
aB.Add (aW, aE);
|
||||
}
|
||||
|
||||
if (hasDegenerated) {
|
||||
aW.Orientation (W.Orientation()); // return to original orient
|
||||
aW.Closed (W.Closed());
|
||||
}
|
||||
else {
|
||||
aW = W;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aW = W;
|
||||
}
|
||||
|
||||
Add (aW);
|
||||
//
|
||||
BRepLib::UpdateTolerances(myShape);
|
||||
//
|
||||
BRepLib::SameParameter(myShape, tol, Standard_True);
|
||||
//
|
||||
if (BRep_Tool::IsClosed(W))
|
||||
if (BRep_Tool::IsClosed(aW))
|
||||
CheckInside();
|
||||
}
|
||||
|
||||
|
@@ -336,10 +336,8 @@ static BRepOffset_Error checkSinglePoint(const Standard_Real theUParam,
|
||||
const NCollection_Vector<gp_Pnt>& theBadPoints);
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
static void UpdateTolerance ( TopoDS_Shape& theShape,
|
||||
const TopTools_IndexedMapOfShape& theFaces,
|
||||
const TopoDS_Shape& theInitShape);
|
||||
|
||||
static void UpdateTolerance ( TopoDS_Shape& myShape,
|
||||
const TopTools_IndexedMapOfShape& myFaces);
|
||||
static Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
|
||||
const Handle(Geom_Curve)& theCrv,
|
||||
const Standard_Real theFirst,
|
||||
@@ -1038,16 +1036,8 @@ void BRepOffset_MakeOffset::MakeOffsetShape(const Message_ProgressRange& theRang
|
||||
// MAJ Tolerance edge and Vertex
|
||||
// ----------------------------
|
||||
if (!myOffsetShape.IsNull()) {
|
||||
if (myThickening)
|
||||
{
|
||||
UpdateTolerance(myOffsetShape, myFaces, myShape);
|
||||
}
|
||||
else
|
||||
{
|
||||
TopoDS_Shape aDummy;
|
||||
UpdateTolerance(myOffsetShape, myFaces, aDummy);
|
||||
}
|
||||
BRepLib::UpdateTolerances(myOffsetShape);
|
||||
UpdateTolerance (myOffsetShape,myFaces);
|
||||
BRepLib::UpdateTolerances( myOffsetShape );
|
||||
}
|
||||
|
||||
CorrectConicalFaces();
|
||||
@@ -3175,38 +3165,13 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
|
||||
} //if both edges are arcs of circles
|
||||
if (NewFace.IsNull())
|
||||
{
|
||||
Standard_Real anEdgeTol = BRep_Tool::Tolerance(anEdge);
|
||||
//Tolerances of input shape should not be increased by BRepLib_MakeFace
|
||||
BRepLib_FindSurface aFindPlane(theWire, anEdgeTol, Standard_True); //only plane
|
||||
IsPlanar = Standard_False;
|
||||
if(aFindPlane.Found() && aFindPlane.ToleranceReached() <= anEdgeTol)
|
||||
BRepLib_MakeFace MF(theWire, Standard_True); //Only plane
|
||||
if (MF.Error() == BRepLib_FaceDone)
|
||||
{
|
||||
Standard_Real f, l;
|
||||
Handle(Geom_Curve) aGC = BRep_Tool::Curve(anEdge, f, l);
|
||||
Handle(Geom_Plane) aPln = Handle(Geom_Plane)::DownCast(aFindPlane.Surface());
|
||||
Standard_Real aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
|
||||
if (aMaxDist <= anEdgeTol)
|
||||
{
|
||||
BRepLib_MakeFace MF(aPln->Pln(), theWire);
|
||||
if (MF.IsDone())
|
||||
{
|
||||
NewFace = MF.Face();
|
||||
TopoDS_Iterator anItE(theWire);
|
||||
for (; anItE.More(); anItE.Next())
|
||||
{
|
||||
const TopoDS_Edge& anE = TopoDS::Edge(anItE.Value());
|
||||
if (anE.IsSame(anEdge))
|
||||
continue;
|
||||
aGC = BRep_Tool::Curve(anE, f, l);
|
||||
aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
|
||||
BB.UpdateEdge(anE, aMaxDist);
|
||||
}
|
||||
IsPlanar = Standard_True;
|
||||
}
|
||||
}
|
||||
NewFace = MF.Face();
|
||||
IsPlanar = Standard_True;
|
||||
}
|
||||
//
|
||||
if(!IsPlanar) //Extrusion (by thrusections)
|
||||
else //Extrusion (by thrusections)
|
||||
{
|
||||
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
|
||||
Handle(Geom_TrimmedCurve) TrEdgeCurve =
|
||||
@@ -3220,6 +3185,7 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
|
||||
ThrusecGenerator.AddCurve( TrOffsetCurve );
|
||||
ThrusecGenerator.Perform( Precision::PConfusion() );
|
||||
theSurf = ThrusecGenerator.Surface();
|
||||
//theSurf = new Geom_SurfaceOfLinearExtrusion( TrOffsetCurve, OffsetDir );
|
||||
Standard_Real Uf, Ul, Vf, Vl;
|
||||
theSurf->Bounds(Uf, Ul, Vf, Vl);
|
||||
TopLoc_Location Loc;
|
||||
@@ -3306,14 +3272,8 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
|
||||
BB.Range( anE3, FirstPar, LastPar );
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsPlanar)
|
||||
{
|
||||
// For planar faces these operations are useless,
|
||||
// because there are no curves on surface
|
||||
BRepLib::SameParameter(NewFace);
|
||||
BRepTools::Update(NewFace);
|
||||
}
|
||||
BRepLib::SameParameter(NewFace);
|
||||
BRepTools::Update(NewFace);
|
||||
//Check orientation
|
||||
TopAbs_Orientation anOr = OrientationOfEdgeInFace(anEdge, aFaceOfEdge);
|
||||
TopAbs_Orientation OrInNewFace = OrientationOfEdgeInFace(anEdge, NewFace);
|
||||
@@ -3821,7 +3781,6 @@ void BRepOffset_MakeOffset::EncodeRegularity ()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeMaxDist
|
||||
//purpose :
|
||||
@@ -3848,15 +3807,13 @@ Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
|
||||
}
|
||||
return sqrt(aMaxDist)*1.05;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateTolerance
|
||||
//function : UpDateTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void UpdateTolerance (TopoDS_Shape& S,
|
||||
const TopTools_IndexedMapOfShape& Faces,
|
||||
const TopoDS_Shape& theInitShape)
|
||||
const TopTools_IndexedMapOfShape& Faces)
|
||||
{
|
||||
BRep_Builder B;
|
||||
TopTools_MapOfShape View;
|
||||
@@ -3872,31 +3829,12 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
}
|
||||
}
|
||||
|
||||
// The edges of initial shape are not modified
|
||||
TopTools_MapOfShape aMapInitF;
|
||||
if (!theInitShape.IsNull())
|
||||
{
|
||||
TopExp_Explorer anExpF(theInitShape, TopAbs_FACE);
|
||||
for (; anExpF.More(); anExpF.Next()) {
|
||||
aMapInitF.Add(anExpF.Current());
|
||||
TopExp_Explorer anExpE;
|
||||
for (anExpE.Init(anExpF.Current(), TopAbs_EDGE); anExpE.More(); anExpE.Next()) {
|
||||
View.Add(anExpE.Current());
|
||||
TopoDS_Iterator anItV(anExpE.Current());
|
||||
for (; anItV.More(); anItV.Next())
|
||||
{
|
||||
View.Add(anItV.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real Tol;
|
||||
TopExp_Explorer anExpF(S, TopAbs_FACE);
|
||||
for (; anExpF.More(); anExpF.Next())
|
||||
TopExp_Explorer ExpF;
|
||||
for (ExpF.Init(S, TopAbs_FACE); ExpF.More(); ExpF.Next())
|
||||
{
|
||||
const TopoDS_Shape& F = anExpF.Current();
|
||||
if (Faces.Contains(F) || aMapInitF.Contains(F))
|
||||
const TopoDS_Shape& F = ExpF.Current();
|
||||
if (Faces.Contains(F))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -3905,7 +3843,6 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
for (Exp.Init(F, TopAbs_EDGE); Exp.More(); Exp.Next()) {
|
||||
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
|
||||
Standard_Boolean isUpdated = Standard_False;
|
||||
Standard_Real aCurrTol = BRep_Tool::Tolerance(E);
|
||||
if (aBAS.GetType() == GeomAbs_Plane)
|
||||
{
|
||||
//Edge does not seem to have pcurve on plane,
|
||||
@@ -3913,22 +3850,17 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aCrv = BRep_Tool::Curve(E, aFirst, aLast);
|
||||
Standard_Real aMaxDist = ComputeMaxDist(aBAS.Plane(), aCrv, aFirst, aLast);
|
||||
if (aMaxDist > aCurrTol)
|
||||
{
|
||||
B.UpdateEdge(E, aMaxDist);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
E.Locked (Standard_False);
|
||||
B.UpdateEdge(E, aMaxDist);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
if (View.Add(E))
|
||||
{
|
||||
E.Locked(Standard_False);
|
||||
|
||||
BRepCheck_Edge EdgeCorrector(E);
|
||||
Tol = EdgeCorrector.Tolerance();
|
||||
if (Tol > aCurrTol)
|
||||
{
|
||||
B.UpdateEdge(E, Tol);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
B.UpdateEdge(E, Tol);
|
||||
isUpdated = Standard_True;
|
||||
}
|
||||
if (isUpdated)
|
||||
{
|
||||
@@ -3937,11 +3869,11 @@ void UpdateTolerance (TopoDS_Shape& S,
|
||||
TopExp::Vertices(E, V[0], V[1]);
|
||||
|
||||
for (Standard_Integer i = 0; i <= 1; i++) {
|
||||
V[i].Locked(Standard_False);
|
||||
if (View.Add(V[i])) {
|
||||
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V[i].TShape());
|
||||
TV->Tolerance(0.);
|
||||
BRepCheck_Vertex VertexCorrector(V[i]);
|
||||
V[i].Locked (Standard_False);
|
||||
B.UpdateVertex(V[i], VertexCorrector.Tolerance());
|
||||
// use the occasion to clean the vertices.
|
||||
(TV->ChangePoints()).Clear();
|
||||
|
@@ -4234,133 +4234,6 @@ void BSplCLib::Resolution( Standard_Real& Poles,
|
||||
UTolerance = Tolerance3D / RealSmall();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Intervals
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BSplCLib::Intervals (const TColStd_Array1OfReal& theKnots,
|
||||
const TColStd_Array1OfInteger& theMults,
|
||||
Standard_Integer theDegree,
|
||||
Standard_Boolean isPeriodic,
|
||||
Standard_Integer theContinuity,
|
||||
Standard_Real theFirst,
|
||||
Standard_Real theLast,
|
||||
Standard_Real theTolerance,
|
||||
TColStd_Array1OfReal* theIntervals)
|
||||
{
|
||||
// remove all knots with multiplicity less or equal than (degree - continuity) except first and last
|
||||
Standard_Integer aFirstIndex = isPeriodic ? 1 : FirstUKnotIndex (theDegree, theMults);
|
||||
Standard_Integer aLastIndex = isPeriodic ? theKnots.Size() : LastUKnotIndex (theDegree, theMults);
|
||||
TColStd_Array1OfReal aNewKnots (1, aLastIndex - aFirstIndex + 1);
|
||||
Standard_Integer aNbNewKnots = 0;
|
||||
for (Standard_Integer anIndex = aFirstIndex; anIndex <= aLastIndex; anIndex++)
|
||||
{
|
||||
if (theMults(anIndex) > (theDegree - theContinuity) ||
|
||||
anIndex == aFirstIndex ||
|
||||
anIndex == aLastIndex)
|
||||
{
|
||||
aNbNewKnots++;
|
||||
aNewKnots(aNbNewKnots) = theKnots[anIndex];
|
||||
}
|
||||
}
|
||||
aNewKnots.Resize (1, aNbNewKnots, Standard_True);
|
||||
|
||||
// the range boundaries
|
||||
Standard_Real aCurFirst = theFirst;
|
||||
Standard_Real aCurLast = theLast;
|
||||
Standard_Real aPeriod = 0.0;
|
||||
Standard_Integer aFirstPeriod = 0;
|
||||
Standard_Integer aLastPeriod = 0;
|
||||
// move boundaries into period
|
||||
if (isPeriodic)
|
||||
{
|
||||
Standard_Real aLower = theKnots.First();
|
||||
Standard_Real anUpper = theKnots.Last();
|
||||
aPeriod = anUpper - aLower;
|
||||
|
||||
while (aCurFirst < aLower)
|
||||
{
|
||||
aCurFirst += aPeriod;
|
||||
aFirstPeriod--;
|
||||
}
|
||||
while (aCurLast < aLower)
|
||||
{
|
||||
aCurLast += aPeriod;
|
||||
aLastPeriod--;
|
||||
}
|
||||
while (aCurFirst >= anUpper)
|
||||
{
|
||||
aCurFirst -= aPeriod;
|
||||
aFirstPeriod += 1;
|
||||
}
|
||||
while (aCurLast >= anUpper)
|
||||
{
|
||||
aCurLast -= aPeriod;
|
||||
aLastPeriod += 1;
|
||||
}
|
||||
}
|
||||
// locate the left and nearest knot for boundaries
|
||||
Standard_Integer anIndex1 = 0;
|
||||
Standard_Integer anIndex2 = 0;
|
||||
Standard_Real aDummyDouble;
|
||||
// we use version of LocateParameter that doesn't need multiplicities
|
||||
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurFirst, Standard_False, 1, aNbNewKnots, anIndex1, aDummyDouble);
|
||||
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurLast, Standard_False, 1, aNbNewKnots, anIndex2, aDummyDouble);
|
||||
// the case when the beginning of the range coincides with the next knot
|
||||
if (anIndex1 < aNbNewKnots && Abs(aNewKnots[anIndex1 + 1] - aCurFirst) < theTolerance)
|
||||
{
|
||||
anIndex1 += 1;
|
||||
}
|
||||
// the case when the ending of the range coincides with the current knot
|
||||
if (aNbNewKnots && Abs(aNewKnots[anIndex2] - aCurLast) < theTolerance)
|
||||
{
|
||||
anIndex2 -= 1;
|
||||
}
|
||||
Standard_Integer aNbIntervals = anIndex2 - anIndex1 + 1 + (aLastPeriod - aFirstPeriod) * (aNbNewKnots - 1);
|
||||
|
||||
// fill the interval array
|
||||
if (theIntervals)
|
||||
{
|
||||
theIntervals->Resize (1, aNbIntervals + 1, Standard_False);
|
||||
if (isPeriodic && aLastPeriod != aFirstPeriod)
|
||||
{
|
||||
Standard_Integer anIndex = 1;
|
||||
// part from the begging of range to the end of the first period
|
||||
for (Standard_Integer i = anIndex1; i < aNewKnots.Size(); i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
|
||||
}
|
||||
// full periods
|
||||
for (Standard_Integer aPeriodNum = aFirstPeriod + 1; aPeriodNum < aLastPeriod; aPeriodNum++)
|
||||
{
|
||||
for (Standard_Integer i = 1; i < aNewKnots.Size(); i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aPeriodNum * aPeriod;
|
||||
}
|
||||
}
|
||||
// part from the begging of the last period to the end of range
|
||||
for (Standard_Integer i = 1; i <= anIndex2; i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aLastPeriod * aPeriod;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer anIndex = 1;
|
||||
for (Standard_Integer i = anIndex1; i <= anIndex2; i++, anIndex++)
|
||||
{
|
||||
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
|
||||
}
|
||||
}
|
||||
// update the first position (the begging of range doesn't coincide with the knot at anIndex1 in general)
|
||||
theIntervals->ChangeValue(1) = theFirst;
|
||||
// write the ending of the range (we didn't write it at all)
|
||||
theIntervals->ChangeValue(aNbIntervals + 1) = theLast;
|
||||
}
|
||||
|
||||
return aNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: FlatBezierKnots
|
||||
// purpose :
|
||||
|
@@ -1456,26 +1456,8 @@ public:
|
||||
//! we have |f (u1) - f (u0)| < Tolerance3D
|
||||
Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
|
||||
|
||||
//! Splits the given range to BSpline intervals of given continuity
|
||||
//! @param[in] theKnots the knots of BSpline
|
||||
//! @param[in] theMults the knots' multiplicities
|
||||
//! @param[in] theDegree the degree of BSpline
|
||||
//! @param[in] isPeriodic the periodicity of BSpline
|
||||
//! @param[in] theContinuity the target interval's continuity
|
||||
//! @param[in] theFirst the begin of the target range
|
||||
//! @param[in] theLast the end of the target range
|
||||
//! @param[in] theTolerance the tolerance
|
||||
//! @param[in,out] theIntervals the array to store intervals if isn't nullptr
|
||||
//! @return the number of intervals
|
||||
Standard_EXPORT static Standard_Integer Intervals (const TColStd_Array1OfReal& theKnots,
|
||||
const TColStd_Array1OfInteger& theMults,
|
||||
Standard_Integer theDegree,
|
||||
Standard_Boolean isPeriodic,
|
||||
Standard_Integer theContinuity,
|
||||
Standard_Real theFirst,
|
||||
Standard_Real theLast,
|
||||
Standard_Real theTolerance,
|
||||
TColStd_Array1OfReal* theIntervals);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -1157,97 +1157,82 @@ void BSplCLib::MergeBSplineKnots
|
||||
index,
|
||||
num_knots ;
|
||||
if (StartValue < EndValue - Tolerance) {
|
||||
TColStd_Array1OfReal knots1(1, Knots1.Length());
|
||||
TColStd_Array1OfReal knots2(1, Knots2.Length());
|
||||
degree = Degree1 + Degree2;
|
||||
index = 1;
|
||||
TColStd_Array1OfReal knots1(1,Knots1.Length()) ;
|
||||
TColStd_Array1OfReal knots2(1,Knots2.Length()) ;
|
||||
degree = Degree1 + Degree2 ;
|
||||
index = 1 ;
|
||||
|
||||
for (ii = Knots1.Lower(); ii <= Knots1.Upper(); ii++) {
|
||||
knots1(index) = Knots1(ii);
|
||||
index += 1;
|
||||
for (ii = Knots1.Lower() ; ii <= Knots1.Upper() ; ii++) {
|
||||
knots1(index) = Knots1(ii) ;
|
||||
index += 1 ;
|
||||
}
|
||||
index = 1;
|
||||
index = 1 ;
|
||||
|
||||
for (ii = Knots2.Lower(); ii <= Knots2.Upper(); ii++) {
|
||||
knots2(index) = Knots2(ii);
|
||||
index += 1;
|
||||
for (ii = Knots2.Lower() ; ii <= Knots2.Upper() ; ii++) {
|
||||
knots2(index) = Knots2(ii) ;
|
||||
index += 1 ;
|
||||
}
|
||||
BSplCLib::Reparametrize(StartValue,
|
||||
EndValue,
|
||||
knots1);
|
||||
|
||||
EndValue,
|
||||
knots1) ;
|
||||
|
||||
BSplCLib::Reparametrize(StartValue,
|
||||
EndValue,
|
||||
knots2);
|
||||
num_knots = 0;
|
||||
jj = 1;
|
||||
EndValue,
|
||||
knots2) ;
|
||||
num_knots = 0 ;
|
||||
jj = 1 ;
|
||||
|
||||
for (ii = 1; ii <= knots1.Length(); ii++) {
|
||||
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
|
||||
jj += 1;
|
||||
num_knots += 1;
|
||||
jj += 1 ;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
|
||||
jj += 1;
|
||||
jj += 1 ;
|
||||
}
|
||||
num_knots += 1;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
NewKnots =
|
||||
new TColStd_HArray1OfReal(1, num_knots);
|
||||
NewKnots =
|
||||
new TColStd_HArray1OfReal(1,num_knots) ;
|
||||
NewMults =
|
||||
new TColStd_HArray1OfInteger(1, num_knots);
|
||||
num_knots = 1;
|
||||
jj = 1;
|
||||
new TColStd_HArray1OfInteger(1,num_knots) ;
|
||||
num_knots = 1 ;
|
||||
jj = 1 ;
|
||||
|
||||
for (ii = 1; ii <= knots1.Length(); ii++) {
|
||||
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
|
||||
NewKnots->ChangeArray1()(num_knots) = knots2(jj);
|
||||
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1;
|
||||
jj += 1;
|
||||
num_knots += 1;
|
||||
NewKnots->ChangeArray1()(num_knots) = knots2(jj) ;
|
||||
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1 ;
|
||||
jj += 1 ;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
set_mults_flag = 0;
|
||||
set_mults_flag = 0 ;
|
||||
|
||||
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
|
||||
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj));
|
||||
set_mults_flag = 1;
|
||||
NewMults->ChangeArray1()(num_knots) = degree - continuity;
|
||||
jj += 1;
|
||||
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj)) ;
|
||||
set_mults_flag = 1 ;
|
||||
NewMults->ChangeArray1()(num_knots) = degree - continuity ;
|
||||
jj += 1 ;
|
||||
}
|
||||
|
||||
NewKnots->ChangeArray1()(num_knots) = knots1(ii);
|
||||
if (!set_mults_flag) {
|
||||
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2;
|
||||
NewKnots->ChangeArray1()(num_knots) = knots1(ii) ;
|
||||
if (! set_mults_flag) {
|
||||
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2 ;
|
||||
}
|
||||
num_knots += 1;
|
||||
num_knots += 1 ;
|
||||
}
|
||||
num_knots -= 1;
|
||||
NewMults->ChangeArray1()(1) = degree + 1;
|
||||
NewMults->ChangeArray1()(num_knots) = degree + 1;
|
||||
index = 0;
|
||||
num_knots -= 1 ;
|
||||
NewMults->ChangeArray1()(1) = degree + 1 ;
|
||||
NewMults->ChangeArray1()(num_knots) = degree + 1 ;
|
||||
index = 0 ;
|
||||
|
||||
for (ii = 1; ii <= num_knots; ii++) {
|
||||
index += NewMults->Value(ii);
|
||||
for (ii = 1 ; ii <= num_knots ; ii++) {
|
||||
index += NewMults->Value(ii) ;
|
||||
}
|
||||
NumPoles = index - degree - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
degree = Degree1 + Degree2;
|
||||
num_knots = 2;
|
||||
NewKnots =
|
||||
new TColStd_HArray1OfReal(1, num_knots);
|
||||
NewKnots->ChangeArray1()(1) = StartValue;
|
||||
NewKnots->ChangeArray1()(num_knots) = EndValue;
|
||||
|
||||
NewMults =
|
||||
new TColStd_HArray1OfInteger(1, num_knots);
|
||||
NewMults->ChangeArray1()(1) = degree + 1;
|
||||
NewMults->ChangeArray1()(num_knots) = degree + 1;
|
||||
NumPoles = BSplCLib::NbPoles(degree, Standard_False, NewMults->Array1());
|
||||
NumPoles = index - degree - 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,9 @@ Draft_FaceInfo::Draft_FaceInfo (const Handle(Geom_Surface)& S,\
|
||||
const Standard_Boolean HasNewGeometry):
|
||||
myNewGeom(HasNewGeometry)
|
||||
{
|
||||
myGeom = S;
|
||||
Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
|
||||
if (!T.IsNull()) myGeom = T->BasisSurface();
|
||||
else myGeom = S;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -481,7 +481,7 @@ Standard_Boolean Draft_Modification::Propagate ()
|
||||
Handle(Geom_Surface)::DownCast(S->Transformed(L.Transformation()));
|
||||
|
||||
const Handle(Standard_Type)& typs = S->DynamicType();
|
||||
if (/*typs == STANDARD_TYPE(Geom_CylindricalSurface) ||*/
|
||||
if (typs == STANDARD_TYPE(Geom_CylindricalSurface) ||
|
||||
typs == STANDARD_TYPE(Geom_ConicalSurface)) {
|
||||
Standard_Real umin,umax,vmin,vmax;
|
||||
BRepTools::UVBounds(F,umin,umax,vmin,vmax);
|
||||
@@ -1062,11 +1062,7 @@ void Draft_Modification::Perform ()
|
||||
//Find the first curve to glue
|
||||
TColGeom_SequenceOfCurve Candidates;
|
||||
if (S1->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface) ||
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
|
||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
|
||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
|
||||
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
|
||||
{
|
||||
for (i = 1; i <= i2s.NbLines(); i++)
|
||||
{
|
||||
|
@@ -27,7 +27,7 @@
|
||||
// intended for use from debugger prompt (Command Window in Visual Studio)
|
||||
|
||||
//! Save geometric object identified by pointer to handle
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
|
||||
const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
|
||||
{
|
||||
if (theNameStr == 0 || theHandlePtr == 0)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ Standard_EXPORT const char* DrawTrSurf_Set (const char* theNameStr, void* theHan
|
||||
}
|
||||
|
||||
//! Set point to DRAW variable
|
||||
Standard_EXPORT const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
|
||||
const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
|
||||
{
|
||||
if (theNameStr == 0 || thePntPtr == 0)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ Standard_EXPORT const char* DrawTrSurf_SetPnt (const char* theNameStr, void* the
|
||||
}
|
||||
|
||||
//! Set 2d point to DRAW variable
|
||||
Standard_EXPORT const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
|
||||
const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
|
||||
{
|
||||
if (theNameStr == 0 || thePnt2dPtr == 0)
|
||||
{
|
||||
@@ -102,17 +102,17 @@ Standard_EXPORT const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* t
|
||||
// work with them (DBX could, on SUN Solaris).
|
||||
#ifndef _MSC_VER
|
||||
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
|
||||
const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
|
||||
{
|
||||
return DrawTrSurf_Set (name, (void*)&G);
|
||||
}
|
||||
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
|
||||
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
|
||||
{
|
||||
return DrawTrSurf_SetPnt (theName, (void*)&thePnt);
|
||||
}
|
||||
|
||||
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
|
||||
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
|
||||
{
|
||||
return DrawTrSurf_SetPnt2d (theName, (void*)&thePnt2d);
|
||||
}
|
||||
|
@@ -674,10 +674,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
Extrema_ExtPElC ExtPCir(aPCirc2,
|
||||
Extrema_CurveTool::Circle (*myC[0]),
|
||||
Precision::Confusion(), theUt11, theUt12);
|
||||
if (ExtPCir.NbExt() < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Real aMinSqD = ExtPCir.SquareDistance(1);
|
||||
for (Standard_Integer anExtID = 2; anExtID <= ExtPCir.NbExt(); anExtID++)
|
||||
{
|
||||
|
@@ -58,6 +58,65 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Geom2dAdaptor_Curve, Adaptor2d_Curve2d)
|
||||
|
||||
static void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer);
|
||||
|
||||
static void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer);
|
||||
|
||||
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower = 0,
|
||||
Standard_Real thePeriod = 0,
|
||||
Standard_Integer theIndex1 = 0,
|
||||
Standard_Integer theIndex2 = 0);
|
||||
|
||||
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt);
|
||||
|
||||
static void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals);
|
||||
|
||||
//=======================================================================
|
||||
//function : ShallowCopy
|
||||
//purpose :
|
||||
@@ -295,6 +354,158 @@ GeomAbs_Shape Geom2dAdaptor_Curve::Continuity() const
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinFPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer)
|
||||
{
|
||||
if (theCurFirst >= theLower)
|
||||
{
|
||||
while (theCurFirst >= theUpper)
|
||||
{
|
||||
theCurFirst = theCurFirst - thePeriod;
|
||||
theFPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theFPer++;
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurFirst < theLower)
|
||||
{
|
||||
theCurFirst = theCurFirst + thePeriod;
|
||||
if (Abs(theLower - theCurFirst) > theEps)
|
||||
{
|
||||
theFPer--;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinLPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer)
|
||||
{
|
||||
if (theCurLast >= theLower)
|
||||
{
|
||||
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
|
||||
{
|
||||
theCurLast = theUpper;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast >= theUpper)
|
||||
{
|
||||
theCurLast = theCurLast - thePeriod;
|
||||
theLPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast < theLower)
|
||||
{
|
||||
theCurLast = theCurLast + thePeriod;
|
||||
if (Abs(theLower - theCurLast) > theEps)
|
||||
{
|
||||
theLPer--;
|
||||
}
|
||||
}
|
||||
if (Abs(theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalNbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower,
|
||||
Standard_Real thePeriod,
|
||||
Standard_Integer theIndex1,
|
||||
Standard_Integer theIndex2)
|
||||
{
|
||||
Standard_Real aNewFirst = theFirst;
|
||||
Standard_Real aNewLast = theLast;
|
||||
if (theIndex1 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
|
||||
}
|
||||
if (theIndex2 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
|
||||
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
|
||||
}
|
||||
// Protection against theFirst = UFirst - eps, which located as ULast - eps
|
||||
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
|
||||
{
|
||||
if (Abs(aNewLast - theLower) < Precision::PConfusion())
|
||||
{
|
||||
aNewLast += thePeriod;
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewFirst -= thePeriod;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
|
||||
{
|
||||
theIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(theIndex2)) > theEps)
|
||||
{
|
||||
theIndex2++;
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= theNbInt; i++)
|
||||
{
|
||||
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
|
||||
}
|
||||
return theNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
@@ -302,49 +513,187 @@ GeomAbs_Shape Geom2dAdaptor_Curve::Continuity() const
|
||||
|
||||
Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
{
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve)
|
||||
{
|
||||
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer aDegree = myBSplineCurve->Degree();
|
||||
Standard_Integer aCont;
|
||||
|
||||
switch (S)
|
||||
{
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
Standard_Integer NbSplit;
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve) {
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
if (aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch (S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0:
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
aCont = 1;
|
||||
break;
|
||||
case GeomAbs_C2:
|
||||
aCont = 2;
|
||||
break;
|
||||
case GeomAbs_C3:
|
||||
aCont = 3;
|
||||
break;
|
||||
case GeomAbs_CN:
|
||||
aCont = aDegree;
|
||||
break;
|
||||
default:
|
||||
throw Standard_DomainError ("Geom2dAdaptor_Curve::NbIntervals()");
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter(NbSplit) = Index;
|
||||
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfReal TK(1, Nb);
|
||||
TColStd_Array1OfInteger TM(1, Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
myNbIntervals = 1;
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic())
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_False, myNbIntervals);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aCurFirst = myFirst;
|
||||
Standard_Real aCurLast = myLast;
|
||||
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
}
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (Abs(anUpper - myLast) < Eps))
|
||||
{
|
||||
myNbIntervals = NbInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer aSumPer = Abs(aLPer - aFPer);
|
||||
|
||||
Standard_Real aFirst = 0;
|
||||
if (aLower < 0 && anUpper == 0)
|
||||
{
|
||||
if (Abs(aCurLast) < Eps)
|
||||
{
|
||||
aCurLast = 0;
|
||||
}
|
||||
aFirst = aLower;
|
||||
}
|
||||
|
||||
if (aSumPer <= 1)
|
||||
{
|
||||
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
}
|
||||
|
||||
if (aSumPer != 0)
|
||||
{
|
||||
Standard_Integer aFInt = 0;
|
||||
Standard_Integer aLInt = 0;
|
||||
Standard_Integer aPInt = NbInt;
|
||||
|
||||
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
|
||||
{
|
||||
aFInt = 1;
|
||||
}
|
||||
if ((aCurLast != 0) && (aCurLast != anUpper))
|
||||
{
|
||||
aLInt = 1;
|
||||
}
|
||||
|
||||
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
|
||||
|
||||
if (aCurLast == anUpper)
|
||||
{
|
||||
aLInt = NbInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Abs(aCurLast - aFirst) > Eps)
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
|
||||
|
||||
return BSplCLib::Intervals(myBSplineCurve->Knots(),
|
||||
myBSplineCurve->Multiplicities(),
|
||||
aDegree,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
aCont,
|
||||
myFirst,
|
||||
myLast,
|
||||
anEps,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
else if (myTypeCurve == GeomAbs_OffsetCurve){
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
GeomAbs_Shape BaseS=GeomAbs_C0;
|
||||
switch(S){
|
||||
case GeomAbs_G1:
|
||||
@@ -356,14 +705,208 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
|
||||
default: BaseS = GeomAbs_CN;
|
||||
}
|
||||
Geom2dAdaptor_Curve anAdaptor (Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve(), myFirst, myLast);
|
||||
Geom2dAdaptor_Curve anAdaptor( Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve() );
|
||||
myNbIntervals = anAdaptor.NbIntervals(BaseS);
|
||||
return myNbIntervals;
|
||||
}
|
||||
|
||||
return myNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt)
|
||||
{
|
||||
if (theFlagForFirst)
|
||||
{
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
theFinalIntervals(theNbIntervals + 1) = theIndex2;
|
||||
|
||||
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
|
||||
{
|
||||
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
|
||||
theCurInt++;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SpreadInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals)
|
||||
{
|
||||
Standard_Integer anIndex1 = 0;
|
||||
Standard_Integer anIndex2 = 0;
|
||||
Standard_Real aNewFirst, aNewLast;
|
||||
Standard_Integer anUpper;
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
Standard_True, 1, theNb, anIndex1, aNewFirst);
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
|
||||
Standard_True, 1, theNb, anIndex2, aNewLast);
|
||||
|
||||
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
|
||||
{
|
||||
anIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(anIndex2)) > theEps)
|
||||
{
|
||||
anIndex2++;
|
||||
}
|
||||
theNbIntervals = 1;
|
||||
|
||||
if (anIndex1 == theNb)
|
||||
{
|
||||
anIndex1 = 1;
|
||||
}
|
||||
|
||||
// Count the max number of boundaries of intervals
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + 1;
|
||||
}
|
||||
|
||||
if (theLPer == theFPer)
|
||||
{
|
||||
anUpper = theInter.Upper();
|
||||
}
|
||||
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
|
||||
aFinalIntervals(1) = anIndex1;
|
||||
|
||||
// If first and last are in the same period
|
||||
if ((Abs(theLPer - theFPer) == 0))
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
Standard_Real aCurPeriod = theFPer * thePeriod;
|
||||
|
||||
if (theFirst == aNewFirst && theLast == aNewLast)
|
||||
{
|
||||
aCurPeriod = 0;
|
||||
}
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the first and the last are in neighboring periods
|
||||
if (Abs(theLPer - theFPer) == 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// If the first and the last are far apart
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,53 +915,156 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2dAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
|
||||
void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S ) const
|
||||
{
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve)
|
||||
{
|
||||
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
|
||||
{
|
||||
T( T.Lower() ) = myFirst;
|
||||
T( T.Lower() + 1 ) = myLast;
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer aDegree = myBSplineCurve->Degree();
|
||||
Standard_Integer aCont;
|
||||
|
||||
switch (S)
|
||||
{
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
Standard_Integer NbSplit;
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve) {
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
if (aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch ( S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0:
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
aCont = 1;
|
||||
break;
|
||||
case GeomAbs_C2:
|
||||
aCont = 2;
|
||||
break;
|
||||
case GeomAbs_C3:
|
||||
aCont = 3;
|
||||
break;
|
||||
case GeomAbs_CN:
|
||||
aCont = aDegree;
|
||||
break;
|
||||
default:
|
||||
throw Standard_DomainError ("Geom2dAdaptor_Curve::Intervals()");
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter(NbSplit) = Index;
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
TColStd_Array1OfReal TK(1, Nb);
|
||||
TColStd_Array1OfInteger TM(1, Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic())
|
||||
{
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index1, newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index2, newLast);
|
||||
|
||||
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
if (Abs(newFirst - TK(Index1 + 1)) < Eps) Index1++;
|
||||
if (newLast - TK(Index2) > Eps) Index2++;
|
||||
|
||||
Inter(1) = Index1;
|
||||
myNbIntervals = 1;
|
||||
for (Standard_Integer i = 1; i <= NbInt; i++) {
|
||||
if (Inter(i) > Index1 && Inter(i) < Index2) {
|
||||
myNbIntervals++;
|
||||
Inter(myNbIntervals) = Inter(i);
|
||||
}
|
||||
}
|
||||
Inter(myNbIntervals + 1) = Index2;
|
||||
|
||||
Standard_Integer ii = T.Lower() - 1;
|
||||
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
|
||||
T(ii + I) = TK(Inter(I));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aFirst = myFirst;
|
||||
Standard_Real aLast = myLast;
|
||||
|
||||
Standard_Real aCurFirst = aFirst;
|
||||
Standard_Real aCurLast = aLast;
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
|
||||
|
||||
if (Abs(myFirst - aLower) <= Eps)
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
aFirst = aCurFirst;
|
||||
}
|
||||
if (Abs(myLast - anUpper) <= Eps)
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
aLast = aCurLast;
|
||||
}
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
if (myFirst == aLower)
|
||||
{
|
||||
aFPer = 0;
|
||||
}
|
||||
|
||||
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
|
||||
aCurLast, Eps, T, myNbIntervals);
|
||||
T(T.Lower()) = aFirst;
|
||||
T(T.Lower() + myNbIntervals) = aLast;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
T(T.Lower()) = myFirst;
|
||||
T(T.Lower() + myNbIntervals) = myLast;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
|
||||
|
||||
BSplCLib::Intervals(myBSplineCurve->Knots(),
|
||||
myBSplineCurve->Multiplicities(),
|
||||
aDegree,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
aCont,
|
||||
myFirst,
|
||||
myLast,
|
||||
anEps,
|
||||
&T);
|
||||
}
|
||||
|
||||
else if (myTypeCurve == GeomAbs_OffsetCurve){
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
GeomAbs_Shape BaseS=GeomAbs_C0;
|
||||
switch(S){
|
||||
case GeomAbs_G1:
|
||||
@@ -431,18 +1077,13 @@ void Geom2dAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shap
|
||||
default: BaseS = GeomAbs_CN;
|
||||
}
|
||||
|
||||
Geom2dAdaptor_Curve anAdaptor (Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve(), myFirst, myLast);
|
||||
Geom2dAdaptor_Curve anAdaptor( Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve() );
|
||||
myNbIntervals = anAdaptor.NbIntervals(BaseS);
|
||||
anAdaptor.Intervals(T, BaseS);
|
||||
T( T.Lower() ) = myFirst;
|
||||
T( T.Lower() + myNbIntervals ) = myLast;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
T( T.Lower() ) = myFirst;
|
||||
T( T.Lower() + 1 ) = myLast;
|
||||
}
|
||||
T( T.Lower() ) = myFirst;
|
||||
T( T.Lower() + myNbIntervals ) = myLast;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -515,6 +515,7 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
|
||||
Handle(TColStd_HArray1OfReal) resKnots;
|
||||
Handle(TColStd_HArray1OfInteger) resMults;
|
||||
Standard_Real start_value,end_value;
|
||||
Standard_Real tolerance=Precision::Confusion();
|
||||
Standard_Integer resNbPoles,degree,
|
||||
ii,jj,
|
||||
aStatus;
|
||||
@@ -526,7 +527,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
|
||||
BS->KnotSequence(BSFlatKnots);
|
||||
start_value = BSKnots(1);
|
||||
end_value = BSKnots(BS->NbKnots());
|
||||
Standard_Real tolerance = 10.*Epsilon(Abs(end_value));
|
||||
|
||||
a->Knots(aKnots);
|
||||
a->Poles(aPoles);
|
||||
@@ -565,6 +565,22 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
|
||||
degree,
|
||||
resDenPoles,
|
||||
aStatus);
|
||||
// BSplCLib::FunctionMultiply(law_evaluator,
|
||||
// BS->Degree(),
|
||||
// BSFlatKnots,
|
||||
// BSPoles,
|
||||
// resFlatKnots,
|
||||
// degree,
|
||||
// resNumPoles,
|
||||
// aStatus);
|
||||
// BSplCLib::FunctionMultiply(law_evaluator,
|
||||
// BS->Degree(),
|
||||
// BSFlatKnots,
|
||||
// BSWeights,
|
||||
// resFlatKnots,
|
||||
// degree,
|
||||
// resDenPoles,
|
||||
// aStatus);
|
||||
for (ii=1;ii<=resNbPoles;ii++)
|
||||
for(jj=1;jj<=2;jj++)
|
||||
resPoles(ii).SetCoord(jj,resNumPoles(ii).Coord(jj)/resDenPoles(ii));
|
||||
@@ -1323,22 +1339,24 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
|
||||
Curve1Poles(ii).SetCoord(jj,Curve1Poles(ii).Coord(jj)*Curve1Weights(ii));
|
||||
//POP pour NT
|
||||
Geom2dConvert_reparameterise_evaluator ev (aPolynomialCoefficient);
|
||||
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
|
||||
BSplCLib::FunctionReparameterise(ev,
|
||||
Curve1->Degree(),
|
||||
Curve1FlatKnots,
|
||||
Curve1Poles,
|
||||
FlatKnots,
|
||||
aNewCurveDegree,
|
||||
aNewCurveDegree,
|
||||
NewPoles,
|
||||
aStatus
|
||||
);
|
||||
TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
|
||||
TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
|
||||
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
|
||||
BSplCLib::FunctionReparameterise(ev,
|
||||
Curve1->Degree(),
|
||||
Curve1FlatKnots,
|
||||
Curve1Weights,
|
||||
FlatKnots,
|
||||
aNewCurveDegree,
|
||||
aNewCurveDegree,
|
||||
NewWeights,
|
||||
aStatus
|
||||
);
|
||||
|
@@ -58,6 +58,65 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(GeomAdaptor_Curve, Adaptor3d_Curve)
|
||||
|
||||
static void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer);
|
||||
|
||||
static void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer);
|
||||
|
||||
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower = 0,
|
||||
Standard_Real thePeriod = 0,
|
||||
Standard_Integer theIndex1 = 0,
|
||||
Standard_Integer theIndex2 = 0);
|
||||
|
||||
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt);
|
||||
|
||||
static void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals);
|
||||
|
||||
//=======================================================================
|
||||
//function : ShallowCopy
|
||||
//purpose :
|
||||
@@ -251,6 +310,159 @@ GeomAbs_Shape GeomAdaptor_Curve::Continuity() const
|
||||
return GeomAbs_CN;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinFPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinFPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurFirst,
|
||||
Standard_Integer &theFPer)
|
||||
{
|
||||
if (theCurFirst >= theLower)
|
||||
{
|
||||
while (theCurFirst >= theUpper)
|
||||
{
|
||||
theCurFirst = theCurFirst - thePeriod;
|
||||
theFPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theFPer++;
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurFirst < theLower)
|
||||
{
|
||||
theCurFirst = theCurFirst + thePeriod;
|
||||
if ((Abs(theLower - theCurFirst)) > theEps)
|
||||
{
|
||||
theFPer--;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(theUpper - theCurFirst) <= theEps)
|
||||
{
|
||||
theCurFirst = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefinLPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void DefinLPeriod(const Standard_Real theLower,
|
||||
const Standard_Real theUpper,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Real thePeriod,
|
||||
Standard_Real &theCurLast,
|
||||
Standard_Integer &theLPer)
|
||||
{
|
||||
if (theCurLast >= theLower)
|
||||
{
|
||||
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
|
||||
{
|
||||
theCurLast = theUpper;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast >= theUpper)
|
||||
{
|
||||
theCurLast = theCurLast - thePeriod;
|
||||
theLPer++;
|
||||
}
|
||||
if (Abs(theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (theCurLast < theLower)
|
||||
{
|
||||
theCurLast = theCurLast + thePeriod;
|
||||
if (Abs(theLower - theCurLast) > theEps)
|
||||
{
|
||||
theLPer--;
|
||||
}
|
||||
}
|
||||
if ((theUpper - theCurLast) <= theEps)
|
||||
{
|
||||
theCurLast = theLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalNbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
|
||||
const TColStd_Array1OfInteger& theTM,
|
||||
const TColStd_Array1OfInteger& theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theEps,
|
||||
const Standard_Boolean thePeriodicCur,
|
||||
Standard_Integer theNbIntervals,
|
||||
Standard_Real theLower,
|
||||
Standard_Real thePeriod,
|
||||
Standard_Integer theIndex1,
|
||||
Standard_Integer theIndex2)
|
||||
{
|
||||
Standard_Real aNewFirst = theFirst;
|
||||
Standard_Real aNewLast = theLast;
|
||||
if (theIndex1 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
|
||||
}
|
||||
if (theIndex2 == 0)
|
||||
{
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
|
||||
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
|
||||
}
|
||||
// Protection against theFirst = UFirst - eps, which located as ULast - eps
|
||||
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
|
||||
{
|
||||
if (Abs(aNewLast - theLower) < Precision::PConfusion())
|
||||
{
|
||||
aNewLast += thePeriod;
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewFirst -= thePeriod;
|
||||
}
|
||||
}
|
||||
|
||||
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
|
||||
{
|
||||
theIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(theIndex2)) > theEps)
|
||||
{
|
||||
theIndex2++;
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= theNbInt; i++)
|
||||
{
|
||||
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
|
||||
}
|
||||
return theNbIntervals;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
@@ -258,135 +470,194 @@ GeomAbs_Shape GeomAdaptor_Curve::Continuity() const
|
||||
|
||||
Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
{
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve)
|
||||
{
|
||||
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
Standard_Integer NbSplit;
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve) {
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
|
||||
Standard_Integer aDegree = myBSplineCurve->Degree();
|
||||
Standard_Integer aCont;
|
||||
|
||||
switch (S)
|
||||
{
|
||||
if(aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch (S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0:
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
aCont = 1;
|
||||
break;
|
||||
case GeomAbs_C2:
|
||||
aCont = 2;
|
||||
break;
|
||||
case GeomAbs_C3:
|
||||
aCont = 3;
|
||||
break;
|
||||
case GeomAbs_CN:
|
||||
aCont = aDegree;
|
||||
break;
|
||||
default:
|
||||
throw Standard_DomainError ("GeomAdaptor_Curve::NbIntervals()");
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter(NbSplit) = Index;
|
||||
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
myNbIntervals = 1;
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic())
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_False, myNbIntervals);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aCurFirst = myFirst;
|
||||
Standard_Real aCurLast = myLast;
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
}
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
Standard_Real aNewFirst;
|
||||
Standard_Real aNewLast;
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
|
||||
Standard_True, 1, Nb, Index1, aNewFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
|
||||
Standard_True, 1, Nb, Index2, aNewLast);
|
||||
if ((aNewFirst == myFirst && aNewLast == myLast) && (aFPer != aLPer))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer aSumPer = Abs(aLPer - aFPer);
|
||||
|
||||
Standard_Real aFirst = 0;
|
||||
if (aLower < 0 && anUpper == 0)
|
||||
{
|
||||
if (Abs(aCurLast) < Eps)
|
||||
{
|
||||
aCurLast = 0;
|
||||
}
|
||||
aFirst = aLower;
|
||||
}
|
||||
|
||||
if (aSumPer <= 1)
|
||||
{
|
||||
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
return myNbIntervals;
|
||||
}
|
||||
}
|
||||
|
||||
if (aSumPer != 0)
|
||||
{
|
||||
Standard_Integer aFInt = 0;
|
||||
Standard_Integer aLInt = 0;
|
||||
Standard_Integer aPInt = NbInt;
|
||||
|
||||
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
|
||||
{
|
||||
aFInt = 1;
|
||||
}
|
||||
if ((aCurLast != aLower) && (aCurLast != anUpper))
|
||||
{
|
||||
aLInt = 1;
|
||||
}
|
||||
|
||||
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
|
||||
|
||||
if (aCurLast == anUpper)
|
||||
{
|
||||
aLInt = NbInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Abs(aCurLast - aFirst) > Eps)
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
|
||||
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
|
||||
|
||||
return BSplCLib::Intervals(myBSplineCurve->Knots(),
|
||||
myBSplineCurve->Multiplicities(),
|
||||
aDegree,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
aCont,
|
||||
myFirst,
|
||||
myLast,
|
||||
anEps,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
else if (myTypeCurve == GeomAbs_OffsetCurve) {
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
GeomAbs_Shape BaseS=GeomAbs_C0;
|
||||
switch(S){
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
|
||||
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
|
||||
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
|
||||
default: BaseS = GeomAbs_CN;
|
||||
}
|
||||
GeomAdaptor_Curve C (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve(), myFirst, myLast);
|
||||
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
|
||||
// the number of intervals obtained from the basis to
|
||||
// vvv reflect parameter bounds
|
||||
Standard_Integer iNbBasisInt = C.NbIntervals(BaseS), iInt;
|
||||
if (iNbBasisInt>1)
|
||||
{
|
||||
TColStd_Array1OfReal rdfInter(1,1+iNbBasisInt);
|
||||
C.Intervals(rdfInter,BaseS);
|
||||
for (iInt=1; iInt<=iNbBasisInt; iInt++)
|
||||
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
|
||||
myNbIntervals++;
|
||||
}
|
||||
// akm 05/04/02 ^^^
|
||||
return myNbIntervals;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GeomAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
|
||||
{
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve)
|
||||
{
|
||||
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
|
||||
{
|
||||
T( T.Lower() ) = myFirst;
|
||||
T( T.Lower() + 1 ) = myLast;
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer aDegree = myBSplineCurve->Degree();
|
||||
Standard_Integer aCont;
|
||||
|
||||
switch (S)
|
||||
{
|
||||
case GeomAbs_C1:
|
||||
aCont = 1;
|
||||
break;
|
||||
case GeomAbs_C2:
|
||||
aCont = 2;
|
||||
break;
|
||||
case GeomAbs_C3:
|
||||
aCont = 3;
|
||||
break;
|
||||
case GeomAbs_CN:
|
||||
aCont = aDegree;
|
||||
break;
|
||||
default:
|
||||
throw Standard_DomainError ("GeomAdaptor_Curve::Intervals()");
|
||||
}
|
||||
|
||||
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
|
||||
|
||||
BSplCLib::Intervals(myBSplineCurve->Knots(),
|
||||
myBSplineCurve->Multiplicities(),
|
||||
aDegree,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
aCont,
|
||||
myFirst,
|
||||
myLast,
|
||||
anEps,
|
||||
&T);
|
||||
}
|
||||
|
||||
else if (myTypeCurve == GeomAbs_OffsetCurve){
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
GeomAbs_Shape BaseS=GeomAbs_C0;
|
||||
switch(S){
|
||||
case GeomAbs_G1:
|
||||
@@ -398,7 +669,412 @@ void GeomAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape
|
||||
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
|
||||
default: BaseS = GeomAbs_CN;
|
||||
}
|
||||
GeomAdaptor_Curve C (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve(), myFirst, myLast);
|
||||
GeomAdaptor_Curve C
|
||||
(Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve());
|
||||
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
|
||||
// the number of intervals obtained from the basis to
|
||||
// vvv reflect parameter bounds
|
||||
Standard_Integer iNbBasisInt = C.NbIntervals(BaseS), iInt;
|
||||
if (iNbBasisInt>1)
|
||||
{
|
||||
TColStd_Array1OfReal rdfInter(1,1+iNbBasisInt);
|
||||
C.Intervals(rdfInter,BaseS);
|
||||
for (iInt=1; iInt<=iNbBasisInt; iInt++)
|
||||
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
|
||||
myNbIntervals++;
|
||||
}
|
||||
// akm 05/04/02 ^^^
|
||||
}
|
||||
return myNbIntervals;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Integer theIndex1,
|
||||
const Standard_Integer theIndex2,
|
||||
const Standard_Real theCurPeriod,
|
||||
const Standard_Boolean theFlagForFirst,
|
||||
TColStd_Array1OfReal &theT,
|
||||
TColStd_Array1OfInteger &theFinalIntervals,
|
||||
Standard_Integer &theNbIntervals,
|
||||
Standard_Integer &theCurInt)
|
||||
{
|
||||
if (theFlagForFirst)
|
||||
{
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
|
||||
{
|
||||
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
|
||||
{
|
||||
theNbIntervals++;
|
||||
theFinalIntervals(theNbIntervals) = theInter(anId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
theFinalIntervals(theNbIntervals + 1) = theIndex2;
|
||||
|
||||
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
|
||||
{
|
||||
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
|
||||
theCurInt++;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SpreadInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SpreadInt(const TColStd_Array1OfReal &theTK,
|
||||
const TColStd_Array1OfInteger &theTM,
|
||||
const TColStd_Array1OfInteger &theInter,
|
||||
const Standard_Integer theCurDegree,
|
||||
const Standard_Integer theNb,
|
||||
const Standard_Integer theFPer,
|
||||
const Standard_Integer theLPer,
|
||||
const Standard_Integer theNbInt,
|
||||
const Standard_Real theLower,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real thePeriod,
|
||||
const Standard_Real theLastParam,
|
||||
const Standard_Real theEps,
|
||||
TColStd_Array1OfReal &theT,
|
||||
Standard_Integer &theNbIntervals)
|
||||
{
|
||||
Standard_Integer anIndex1 = 0;
|
||||
Standard_Integer anIndex2 = 0;
|
||||
Standard_Real aNewFirst, aNewLast;
|
||||
Standard_Integer anUpper;
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
|
||||
Standard_True, 1, theNb, anIndex1, aNewFirst);
|
||||
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
|
||||
Standard_True, 1, theNb, anIndex2, aNewLast);
|
||||
|
||||
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
|
||||
{
|
||||
anIndex1++;
|
||||
}
|
||||
if ((aNewLast - theTK(anIndex2)) > theEps)
|
||||
{
|
||||
anIndex2++;
|
||||
}
|
||||
theNbIntervals = 1;
|
||||
|
||||
if (anIndex1 == theNb)
|
||||
{
|
||||
anIndex1 = 1;
|
||||
}
|
||||
|
||||
// Count the max number of boundaries of intervals
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
anUpper = theNb - anIndex1 + anIndex2 + 1;
|
||||
}
|
||||
|
||||
if (theLPer == theFPer)
|
||||
{
|
||||
anUpper = theInter.Upper();
|
||||
}
|
||||
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
|
||||
aFinalIntervals(1) = anIndex1;
|
||||
|
||||
// If first and last are in the same period
|
||||
if ((Abs(theLPer - theFPer) == 0))
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
Standard_Real aCurPeriod = theFPer * thePeriod;
|
||||
|
||||
if (theFirst == aNewFirst && theLast == aNewLast)
|
||||
{
|
||||
aCurPeriod = 0;
|
||||
}
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the first and the last are in neighboring periods
|
||||
if (Abs(theLPer - theFPer) == 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// If the first and the last are far apart
|
||||
if (Abs(theLPer - theFPer) > 1)
|
||||
{
|
||||
Standard_Integer aCurInt = 1;
|
||||
|
||||
if (Abs(theLastParam - theLower) < theEps)
|
||||
{
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For period with first
|
||||
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
|
||||
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
Standard_Integer aNbPer = Abs(theLPer - theFPer);
|
||||
Standard_Integer aCurPer = theFPer + 1;
|
||||
while (aNbPer > 1)
|
||||
{
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
|
||||
aNbPer--;
|
||||
aCurPer++;
|
||||
}
|
||||
// For period with last
|
||||
theNbIntervals++;
|
||||
WriteIntervals(theTK, theInter, theNbInt, 1,
|
||||
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S ) const
|
||||
{
|
||||
Standard_Integer myNbIntervals = 1;
|
||||
Standard_Integer NbSplit;
|
||||
Standard_Real FirstParam = myFirst, LastParam = myLast;
|
||||
|
||||
if (myTypeCurve == GeomAbs_BSplineCurve)
|
||||
{
|
||||
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
|
||||
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
|
||||
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
|
||||
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
|
||||
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
|
||||
|
||||
if (aContPer || aContNotPer) {
|
||||
Standard_Integer Cont;
|
||||
switch (S) {
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0:
|
||||
myNbIntervals = 1;
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
case GeomAbs_C2:
|
||||
case GeomAbs_C3:
|
||||
case GeomAbs_CN:
|
||||
{
|
||||
if (S == GeomAbs_C1) Cont = 1;
|
||||
else if (S == GeomAbs_C2) Cont = 2;
|
||||
else if (S == GeomAbs_C3) Cont = 3;
|
||||
else Cont = myBSplineCurve->Degree();
|
||||
Standard_Integer Degree = myBSplineCurve->Degree();
|
||||
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
|
||||
TColStd_Array1OfInteger Mults(1, NbKnots);
|
||||
myBSplineCurve->Multiplicities(Mults);
|
||||
NbSplit = 1;
|
||||
Standard_Integer Index = FirstIndex;
|
||||
Inter(NbSplit) = Index;
|
||||
Index++;
|
||||
NbSplit++;
|
||||
while (Index < LastIndex)
|
||||
{
|
||||
if (Degree - Mults(Index) < Cont)
|
||||
{
|
||||
Inter(NbSplit) = Index;
|
||||
NbSplit++;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
Inter(NbSplit) = Index;
|
||||
Standard_Integer NbInt = NbSplit - 1;
|
||||
// GeomConvert_BSplineCurveKnotSplitting Convector(myBspl, Cont);
|
||||
// Standard_Integer NbInt = Convector.NbSplits()-1;
|
||||
// TColStd_Array1OfInteger Inter(1,NbInt+1);
|
||||
// Convector.Splitting( Inter);
|
||||
|
||||
Standard_Integer Nb = myBSplineCurve->NbKnots();
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
|
||||
Precision::PConfusion());
|
||||
|
||||
if (!myBSplineCurve->IsPeriodic() || ((Abs(myFirst - myBSplineCurve->FirstParameter()) < Eps) &&
|
||||
(Abs(myLast - myBSplineCurve->LastParameter()) < Eps)))
|
||||
{
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index1, newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1, Nb, Index2, newLast);
|
||||
FirstParam = newFirst;
|
||||
LastParam = newLast;
|
||||
// Protection against myFirst = UFirst - eps, which located as ULast - eps
|
||||
if (myBSplineCurve->IsPeriodic() && (LastParam - FirstParam) < Precision::PConfusion())
|
||||
{
|
||||
if (Abs(LastParam - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
|
||||
LastParam += myBSplineCurve->Period();
|
||||
else
|
||||
FirstParam -= myBSplineCurve->Period();
|
||||
}
|
||||
// On decale eventuellement les indices
|
||||
// On utilise une "petite" tolerance, la resolution ne doit
|
||||
// servir que pour les tres longue courbes....(PRO9248)
|
||||
|
||||
if (Abs(FirstParam - TK(Index1 + 1)) < Eps) Index1++;
|
||||
if (LastParam - TK(Index2) > Eps) Index2++;
|
||||
|
||||
myNbIntervals = 1;
|
||||
|
||||
TColStd_Array1OfInteger aFinalIntervals(1, Inter.Upper());
|
||||
aFinalIntervals(1) = Index1;
|
||||
for (Standard_Integer i = 1; i <= NbInt; i++) {
|
||||
if (Inter(i) > Index1 && Inter(i) < Index2) {
|
||||
myNbIntervals++;
|
||||
aFinalIntervals(myNbIntervals) = Inter(i);
|
||||
}
|
||||
}
|
||||
aFinalIntervals(myNbIntervals + 1) = Index2;
|
||||
|
||||
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
|
||||
T(I) = TK(aFinalIntervals(I));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real aFirst = myFirst;
|
||||
Standard_Real aLast = myLast;
|
||||
|
||||
Standard_Real aCurFirst = aFirst;
|
||||
Standard_Real aCurLast = aLast;
|
||||
|
||||
Standard_Real aPeriod = myBSplineCurve->Period();
|
||||
Standard_Real aLower = myBSplineCurve->FirstParameter();
|
||||
Standard_Real anUpper = myBSplineCurve->LastParameter();
|
||||
|
||||
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
|
||||
|
||||
if (Abs(myFirst - aLower) <= Eps)
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
aFirst = aCurFirst;
|
||||
}
|
||||
|
||||
if (Abs(myLast - anUpper) <= Eps)
|
||||
{
|
||||
aCurLast = anUpper;
|
||||
aLast = aCurLast;
|
||||
}
|
||||
|
||||
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
|
||||
{
|
||||
aCurFirst = aLower;
|
||||
}
|
||||
else
|
||||
{
|
||||
DefinFPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurFirst, aFPer);
|
||||
}
|
||||
DefinLPeriod(aLower, anUpper,
|
||||
Eps, aPeriod, aCurLast, aLPer);
|
||||
|
||||
if (myFirst == aLower)
|
||||
{
|
||||
aFPer = 0;
|
||||
}
|
||||
|
||||
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
|
||||
aCurLast, Eps, T, myNbIntervals);
|
||||
|
||||
T(T.Lower()) = aFirst;
|
||||
T(T.Lower() + myNbIntervals) = aLast;
|
||||
return;
|
||||
}
|
||||
}
|
||||
T(T.Lower()) = myFirst;
|
||||
T(T.Lower() + myNbIntervals) = myLast;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (myTypeCurve == GeomAbs_OffsetCurve){
|
||||
GeomAbs_Shape BaseS=GeomAbs_C0;
|
||||
switch(S){
|
||||
case GeomAbs_G1:
|
||||
case GeomAbs_G2:
|
||||
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
|
||||
break;
|
||||
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
|
||||
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
|
||||
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
|
||||
default: BaseS = GeomAbs_CN;
|
||||
}
|
||||
GeomAdaptor_Curve C
|
||||
(Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve());
|
||||
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
|
||||
// the array of intervals obtained from the basis to
|
||||
// vvv reflect parameter bounds
|
||||
@@ -414,15 +1090,10 @@ void GeomAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape
|
||||
// old - myNbIntervals = C.NbIntervals(BaseS);
|
||||
// old - C.Intervals(T, BaseS);
|
||||
// akm 05/04/02 ^^^
|
||||
T( T.Lower() ) = myFirst;
|
||||
T( T.Lower() + myNbIntervals ) = myLast;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
T( T.Lower() ) = myFirst;
|
||||
T( T.Lower() + 1 ) = myLast;
|
||||
}
|
||||
T( T.Lower() ) = FirstParam;
|
||||
T( T.Lower() + myNbIntervals ) = LastParam;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -276,8 +276,6 @@ GeomFill_SectionPlacement(const Handle(GeomFill_LocationLaw)& L,
|
||||
|
||||
Standard_Integer NbLocalPnts = 10;
|
||||
Standard_Integer NbPnts = (NbKnots-1) * NbLocalPnts;
|
||||
if (NbPnts < 0)
|
||||
NbPnts = 0;
|
||||
if (I1 != I2)
|
||||
NbPnts += NbLocalPnts;
|
||||
if (I3 != I4 && first < BC->Knot(I3))
|
||||
|
@@ -4359,120 +4359,6 @@ static Standard_Integer QACheckBends(Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC26441(Draw_Interpretor& theDi, Standard_Integer theNbArgs, const char** theArgVec)
|
||||
{
|
||||
if (theNbArgs < 3)
|
||||
{
|
||||
theDi << "Syntax error: wrong number of arguments!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
const TopoDS_Shape& aShape = DBRep::Get(theArgVec[1]);
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
theDi << " Null Shape is not allowed here\n";
|
||||
return 1;
|
||||
}
|
||||
const TopoDS_Shape& aRefShape = DBRep::Get(theArgVec[2]);
|
||||
if (aRefShape.IsNull())
|
||||
{
|
||||
theDi << " Null Shape is not allowed here\n";
|
||||
return 1;
|
||||
}
|
||||
if(aShape.ShapeType() != aRefShape.ShapeType())
|
||||
{
|
||||
theDi << " Shape types are not the same\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Real anEps = Precision::Confusion();
|
||||
if (theNbArgs > 3)
|
||||
{
|
||||
anEps = Draw::Atof(theArgVec[3]);
|
||||
}
|
||||
|
||||
Standard_Boolean isAllDiff = Standard_False;
|
||||
if (theNbArgs > 4)
|
||||
{
|
||||
Standard_Integer Inc = Draw::Atoi(theArgVec[4]);
|
||||
if (Inc > 0)
|
||||
isAllDiff = Standard_True;
|
||||
}
|
||||
|
||||
BRep_Builder aBB;
|
||||
TopExp_Explorer anExp, anExpRef;
|
||||
Standard_Real aMaxE = 0., aMaxV = 0.;
|
||||
TopTools_MapOfShape aChecked;
|
||||
TopoDS_Vertex aV[2], aRefV[2];
|
||||
|
||||
//Checking edge and vertex tolerances
|
||||
TopoDS_Compound aBadEdges;
|
||||
aBB.MakeCompound(aBadEdges);
|
||||
TopoDS_Compound aBadVerts;
|
||||
aBB.MakeCompound(aBadVerts);
|
||||
anExp.Init(aShape, TopAbs_EDGE);
|
||||
anExpRef.Init(aRefShape, TopAbs_EDGE);
|
||||
for (; anExpRef.More(); anExpRef.Next())
|
||||
{
|
||||
const TopoDS_Edge& aRefE = TopoDS::Edge(anExpRef.Current());
|
||||
if (!anExp.More())
|
||||
{
|
||||
theDi << " Different number of edges\n";
|
||||
return 1;
|
||||
}
|
||||
const TopoDS_Edge& anE = TopoDS::Edge(anExp.Current());
|
||||
if (!aChecked.Add(anE))
|
||||
continue;
|
||||
Standard_Real aTolRef = BRep_Tool::Tolerance(aRefE);
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(anE);
|
||||
Standard_Real aDiff = aTol - aTolRef;
|
||||
if (isAllDiff && aDiff < 0)
|
||||
aDiff = -aDiff;
|
||||
if (aDiff > anEps)
|
||||
{
|
||||
if (aDiff > aMaxE)
|
||||
aMaxE = aDiff;
|
||||
|
||||
aBB.Add(aBadEdges, anE);
|
||||
}
|
||||
TopExp::Vertices(aRefE, aRefV[0], aRefV[1]);
|
||||
TopExp::Vertices(anE, aV[0], aV[1]);
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (aRefV[i].IsNull())
|
||||
continue;
|
||||
if (!aChecked.Add(aV[i]))
|
||||
continue;
|
||||
aTolRef = BRep_Tool::Tolerance(aRefV[i]);
|
||||
aTol = BRep_Tool::Tolerance(aV[i]);
|
||||
aDiff = aTol - aTolRef;
|
||||
if (aDiff > anEps)
|
||||
{
|
||||
if (aDiff > aMaxV)
|
||||
aMaxV = aDiff;
|
||||
|
||||
aBB.Add(aBadVerts, aV[i]);
|
||||
}
|
||||
}
|
||||
|
||||
anExp.Next();
|
||||
|
||||
}
|
||||
|
||||
if (aMaxE > anEps)
|
||||
{
|
||||
theDi << " Maximal difference for edges : " << aMaxE << "\n";
|
||||
DBRep::Set("BadEdges", aBadEdges);
|
||||
}
|
||||
if (aMaxV > anEps)
|
||||
{
|
||||
theDi << " Maximal difference for vertices : " << aMaxV << "\n";
|
||||
DBRep::Set("BadVerts", aBadVerts);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
@@ -4580,10 +4466,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
"QACheckBends curve [CosMaxAngle [theNbPoints]]",
|
||||
__FILE__,
|
||||
QACheckBends, group);
|
||||
theCommands.Add("OCC26441",
|
||||
"OCC26441 shape ref_shape [tol [all_diff 0/1]] \nif all_diff = 0, only icreasing tolerances is considered" ,
|
||||
__FILE__,
|
||||
OCC26441, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -221,10 +221,6 @@
|
||||
#include <StepVisual_TessellatedCurveSet.hxx>
|
||||
#include <StepVisual_CoordinatesList.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <StepVisual_OverRidingStyledItem.hxx>
|
||||
#include <StepVisual_ContextDependentOverRidingStyledItem.hxx>
|
||||
#include <StepRepr_ShapeRepresentationRelationshipWithTransformation.hxx>
|
||||
#include <StepRepr_ItemDefinedTransformation.hxx>
|
||||
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
@@ -941,306 +937,6 @@ static void propagateColorToParts(const Handle(XCAFDoc_ShapeTool)& theSTool,
|
||||
propagateColorToParts(theSTool, theCTool, anOriginalL);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAssemblyComponentStyle
|
||||
//purpose : auxiliary: set override style for assembly components
|
||||
//=======================================================================
|
||||
|
||||
static void SetAssemblyComponentStyle(const Handle(Transfer_TransientProcess) &theTP,
|
||||
const Handle(XCAFDoc_ColorTool)& theCTool,
|
||||
const STEPConstruct_Styles& theStyles,
|
||||
const Handle(StepVisual_ContextDependentOverRidingStyledItem)& theStyle)
|
||||
{
|
||||
if (theStyle.IsNull()) return;
|
||||
|
||||
Handle(StepVisual_Colour) aSurfCol, aBoundCol, aCurveCol, aRenderCol;
|
||||
Standard_Real aRenderTransp;
|
||||
// check if it is component style
|
||||
Standard_Boolean anIsComponent = Standard_False;
|
||||
if (!theStyles.GetColors(theStyle, aSurfCol, aBoundCol, aCurveCol, aRenderCol, aRenderTransp, anIsComponent))
|
||||
return;
|
||||
|
||||
const Interface_Graph& aGraph = theTP->Graph();
|
||||
TopLoc_Location aLoc; // init;
|
||||
// find shape
|
||||
TopoDS_Shape aShape;
|
||||
Handle(Transfer_Binder) aBinder;
|
||||
Handle(StepShape_ShapeRepresentation) aRepr = Handle(StepShape_ShapeRepresentation)::DownCast(theStyle->ItemAP242 ().Value ());
|
||||
if (aRepr.IsNull())
|
||||
return;
|
||||
Handle(StepRepr_ShapeRepresentationRelationship) aSRR;
|
||||
Interface_EntityIterator aSubs = theTP->Graph().Sharings(aRepr);
|
||||
for (aSubs.Start(); aSubs.More(); aSubs.Next()) {
|
||||
const Handle(Standard_Transient)& aSubsVal = aSubs.Value();
|
||||
if (aSubsVal->IsKind (STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship)))
|
||||
{
|
||||
// NB: C cast is used instead of DownCast() to improve performance on some cases.
|
||||
// This saves ~10% of elapsed time on "testgrid perf de bug29* -parallel 0".
|
||||
aSRR = (StepRepr_ShapeRepresentationRelationship*)(aSubsVal.get());
|
||||
}
|
||||
}
|
||||
|
||||
aBinder = theTP->Find(aSRR);
|
||||
if (!aBinder.IsNull() ) {
|
||||
aShape = TransferBRep::ShapeResult (aBinder);
|
||||
}
|
||||
if (aShape.IsNull())
|
||||
return;
|
||||
|
||||
//get transformation
|
||||
aSubs = aGraph.Shareds (theStyle);
|
||||
aSubs.Start();
|
||||
for(; aSubs.More(); aSubs.Next())
|
||||
{
|
||||
Handle(StepRepr_ShapeRepresentationRelationshipWithTransformation) aRelation = Handle(StepRepr_ShapeRepresentationRelationshipWithTransformation)::DownCast (aSubs.Value ());
|
||||
if(aRelation.IsNull()) continue;
|
||||
|
||||
auto aTransf = aRelation->TransformationOperator ();
|
||||
if(auto anItemTransf = aTransf.ItemDefinedTransformation ())
|
||||
{
|
||||
Handle(StepGeom_Axis2Placement3d) anAxp1 = Handle(StepGeom_Axis2Placement3d)::DownCast(anItemTransf->TransformItem1 ());
|
||||
Handle(StepGeom_Axis2Placement3d) anAxp2 = Handle(StepGeom_Axis2Placement3d)::DownCast(anItemTransf->TransformItem2 ());
|
||||
|
||||
if(!anAxp1.IsNull() && !anAxp2.IsNull())
|
||||
{
|
||||
Handle(Geom_Axis2Placement) anOrig = StepToGeom::MakeAxis2Placement (anAxp1);
|
||||
Handle(Geom_Axis2Placement) aTarg = StepToGeom::MakeAxis2Placement (anAxp2);
|
||||
gp_Ax3 anAx3Orig(anOrig->Ax2());
|
||||
gp_Ax3 anAx3Targ(aTarg->Ax2());
|
||||
|
||||
gp_Trsf aTr1;
|
||||
aTr1.SetTransformation(anAx3Targ, anAx3Orig);
|
||||
TopLoc_Location aLoc1 (aTr1);
|
||||
aLoc = aLoc.Multiplied(aLoc1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aShape.Location( aLoc, Standard_False );
|
||||
|
||||
if(!aSurfCol.IsNull() || !aBoundCol.IsNull() || !aCurveCol.IsNull() || !aRenderCol.IsNull())
|
||||
{
|
||||
Quantity_Color aSCol,aBCol,aCCol,aRCol;
|
||||
Quantity_ColorRGBA aFullSCol;
|
||||
if(!aSurfCol.IsNull()) {
|
||||
theStyles.DecodeColor(aSurfCol,aSCol);
|
||||
aFullSCol = Quantity_ColorRGBA(aSCol);
|
||||
}
|
||||
if(!aBoundCol.IsNull())
|
||||
theStyles.DecodeColor(aBoundCol,aBCol);
|
||||
if(!aCurveCol.IsNull())
|
||||
theStyles.DecodeColor(aCurveCol,aCCol);
|
||||
if(!aRenderCol.IsNull()) {
|
||||
theStyles.DecodeColor(aRenderCol,aRCol);
|
||||
aFullSCol = Quantity_ColorRGBA(aRCol,static_cast<float>(1.0f - aRenderTransp));
|
||||
}
|
||||
|
||||
if(!aSurfCol.IsNull() || !aRenderCol.IsNull())
|
||||
theCTool->SetInstanceColor(aShape,XCAFDoc_ColorSurf,aFullSCol);
|
||||
if(!aBoundCol.IsNull())
|
||||
theCTool->SetInstanceColor(aShape,XCAFDoc_ColorCurv,aBCol);
|
||||
if(!aCurveCol.IsNull())
|
||||
theCTool->SetInstanceColor(aShape,XCAFDoc_ColorCurv,aCCol);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStyle
|
||||
//purpose : auxiliary: set style for parts and instances
|
||||
//=======================================================================
|
||||
|
||||
static void SetStyle(const Handle(XSControl_WorkSession) &theWS,
|
||||
const XCAFDoc_DataMapOfShapeLabel& theMap,
|
||||
const Handle(XCAFDoc_ColorTool)& theCTool,
|
||||
const Handle(XCAFDoc_ShapeTool)& theSTool,
|
||||
const STEPConstruct_Styles& theStyles,
|
||||
const Handle(TColStd_HSequenceOfTransient)& theHSeqOfInvisStyle,
|
||||
const Handle(StepVisual_StyledItem)& theStyle)
|
||||
{
|
||||
if (theStyle.IsNull()) return;
|
||||
|
||||
const Handle(Transfer_TransientProcess) &aTP = theWS->TransferReader()->TransientProcess();
|
||||
if (Handle(StepVisual_OverRidingStyledItem) anOverridingStyle = Handle(StepVisual_OverRidingStyledItem)::DownCast (theStyle))
|
||||
{
|
||||
SetStyle (theWS, theMap, theCTool, theSTool, theStyles, theHSeqOfInvisStyle, anOverridingStyle->OverRiddenStyle ());
|
||||
if (Handle(StepVisual_ContextDependentOverRidingStyledItem) anAssemblyComponentStyle = Handle(StepVisual_ContextDependentOverRidingStyledItem)::DownCast (theStyle))
|
||||
{
|
||||
SetAssemblyComponentStyle (aTP, theCTool, theStyles,anAssemblyComponentStyle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean anIsVisible = Standard_True;
|
||||
// check the visibility of styled item.
|
||||
for (Standard_Integer si = 1; si <= theHSeqOfInvisStyle->Length(); si++) {
|
||||
if (theStyle != theHSeqOfInvisStyle->Value(si))
|
||||
continue;
|
||||
// found that current style is invisible.
|
||||
anIsVisible = Standard_False;
|
||||
break;
|
||||
}
|
||||
Handle(StepVisual_Colour) aSurfCol, aBoundCol, aCurveCol, aRenderCol;
|
||||
Standard_Real aRenderTransp;
|
||||
// check if it is component style
|
||||
Standard_Boolean anIsComponent = Standard_False;
|
||||
if (!theStyles.GetColors(theStyle, aSurfCol, aBoundCol, aCurveCol, aRenderCol, aRenderTransp, anIsComponent) && anIsVisible)
|
||||
return;
|
||||
|
||||
// collect styled items
|
||||
NCollection_Vector<StepVisual_StyledItemTarget> anItems;
|
||||
if (!theStyle->ItemAP242().IsNull()) {
|
||||
anItems.Append(theStyle->ItemAP242());
|
||||
}
|
||||
|
||||
for (Standard_Integer itemIt = 0; itemIt < anItems.Length(); itemIt++) {
|
||||
Standard_Integer anIndex = aTP->MapIndex(anItems.Value(itemIt).Value());
|
||||
TopoDS_Shape aS;
|
||||
if (anIndex > 0) {
|
||||
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
|
||||
aS = TransferBRep::ShapeResult(aBinder);
|
||||
}
|
||||
Standard_Boolean isSkipSHUOstyle = Standard_False;
|
||||
// take shape with real location.
|
||||
while (anIsComponent) {
|
||||
// take SR of NAUO
|
||||
Handle(StepShape_ShapeRepresentation) aSR;
|
||||
findStyledSR(theStyle, aSR);
|
||||
// search for SR along model
|
||||
if (aSR.IsNull())
|
||||
break;
|
||||
Interface_EntityIterator aSubs = theWS->HGraph()->Graph().Sharings(aSR);
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
|
||||
for (aSubs.Start(); aSubs.More(); aSubs.Next()) {
|
||||
aSDR = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSubs.Value());
|
||||
if (aSDR.IsNull())
|
||||
continue;
|
||||
StepRepr_RepresentedDefinition aPDSselect = aSDR->Definition();
|
||||
Handle(StepRepr_ProductDefinitionShape) PDS =
|
||||
Handle(StepRepr_ProductDefinitionShape)::DownCast(aPDSselect.PropertyDefinition());
|
||||
if (PDS.IsNull())
|
||||
continue;
|
||||
StepRepr_CharacterizedDefinition aCharDef = PDS->Definition();
|
||||
|
||||
Handle(StepRepr_AssemblyComponentUsage) ACU =
|
||||
Handle(StepRepr_AssemblyComponentUsage)::DownCast(aCharDef.ProductDefinitionRelationship());
|
||||
if (ACU.IsNull())
|
||||
continue;
|
||||
// PTV 10.02.2003 skip styled item that refer to SHUO
|
||||
if (ACU->IsKind(STANDARD_TYPE(StepRepr_SpecifiedHigherUsageOccurrence))) {
|
||||
isSkipSHUOstyle = Standard_True;
|
||||
break;
|
||||
}
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(ACU);
|
||||
if (NAUO.IsNull())
|
||||
continue;
|
||||
|
||||
TopoDS_Shape aSh;
|
||||
// PTV 10.02.2003 to find component of assembly CORRECTLY
|
||||
STEPConstruct_Tool aTool(theWS);
|
||||
TDF_Label aShLab = STEPCAFControl_Reader::FindInstance(NAUO, theCTool->ShapeTool(), aTool, theMap);
|
||||
aSh = theCTool->ShapeTool()->GetShape(aShLab);
|
||||
if (!aSh.IsNull()) {
|
||||
aS = aSh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isSkipSHUOstyle)
|
||||
continue; // skip styled item which refer to SHUO
|
||||
|
||||
if (aS.IsNull())
|
||||
continue;
|
||||
|
||||
if (!aSurfCol.IsNull() || !aBoundCol.IsNull() || !aCurveCol.IsNull() || !aRenderCol.IsNull() || !anIsVisible)
|
||||
{
|
||||
TDF_Label aL;
|
||||
Standard_Boolean isFound = theSTool->SearchUsingMap(aS, aL, Standard_False, Standard_True);
|
||||
if (!aSurfCol.IsNull() || !aBoundCol.IsNull() || !aCurveCol.IsNull() || !aRenderCol.IsNull())
|
||||
{
|
||||
Quantity_Color aSCol, aBCol, aCCol, aRCol;
|
||||
Quantity_ColorRGBA aFullSCol;
|
||||
if (!aSurfCol.IsNull()) {
|
||||
theStyles.DecodeColor(aSurfCol, aSCol);
|
||||
aFullSCol = Quantity_ColorRGBA(aSCol);
|
||||
}
|
||||
if (!aBoundCol.IsNull())
|
||||
theStyles.DecodeColor(aBoundCol, aBCol);
|
||||
if (!aCurveCol.IsNull())
|
||||
theStyles.DecodeColor(aCurveCol, aCCol);
|
||||
if (!aRenderCol.IsNull()) {
|
||||
theStyles.DecodeColor(aRenderCol, aRCol);
|
||||
aFullSCol = Quantity_ColorRGBA(aRCol, static_cast<float>(1.0f - aRenderTransp));
|
||||
}
|
||||
if (isFound)
|
||||
{
|
||||
if (!aSurfCol.IsNull() || !aRenderCol.IsNull())
|
||||
theCTool->SetColor(aL, aFullSCol, XCAFDoc_ColorSurf);
|
||||
if (!aBoundCol.IsNull())
|
||||
theCTool->SetColor(aL, aBCol, XCAFDoc_ColorCurv);
|
||||
if (!aCurveCol.IsNull())
|
||||
theCTool->SetColor(aL, aCCol, XCAFDoc_ColorCurv);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TopoDS_Iterator it(aS); it.More(); it.Next())
|
||||
{
|
||||
TDF_Label aL1;
|
||||
if (theSTool->SearchUsingMap(it.Value(), aL1, Standard_False, Standard_True))
|
||||
{
|
||||
if (!aSurfCol.IsNull() || !aRenderCol.IsNull())
|
||||
theCTool->SetColor(aL1, aFullSCol, XCAFDoc_ColorSurf);
|
||||
if (!aBoundCol.IsNull())
|
||||
theCTool->SetColor(aL1, aBCol, XCAFDoc_ColorCurv);
|
||||
if (!aCurveCol.IsNull())
|
||||
theCTool->SetColor(aL1, aCCol, XCAFDoc_ColorCurv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!anIsVisible)
|
||||
{
|
||||
// sets the invisibility for shape.
|
||||
if (isFound)
|
||||
theCTool->SetVisibility(aL, Standard_False);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsOverriden
|
||||
//purpose : auxiliary: check that style is overridden
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean IsOverriden(const Interface_Graph& theGraph,
|
||||
const Handle(StepVisual_StyledItem)& theStyle,
|
||||
Standard_Boolean theIsRoot)
|
||||
{
|
||||
Interface_EntityIterator aSubs = theGraph.Sharings (theStyle);
|
||||
aSubs.Start();
|
||||
for(; aSubs.More(); aSubs.Next())
|
||||
{
|
||||
Handle(StepVisual_OverRidingStyledItem) anOverRidingStyle = Handle(StepVisual_OverRidingStyledItem)::DownCast (aSubs.Value ());
|
||||
if(!anOverRidingStyle.IsNull())
|
||||
{
|
||||
if(!theIsRoot)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
// for root style returns true only if it is overridden by other root style
|
||||
auto anItem = anOverRidingStyle->ItemAP242 ().Value ();
|
||||
if(!anItem.IsNull() && anItem->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation)))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadColors
|
||||
//purpose :
|
||||
@@ -1265,36 +961,152 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe
|
||||
Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
|
||||
if (STool.IsNull()) return Standard_False;
|
||||
|
||||
const Interface_Graph& aGraph = Styles.Graph ();
|
||||
|
||||
// parse and search for color attributes
|
||||
Standard_Integer nb = Styles.NbRootStyles();
|
||||
// apply root styles earlier, as they can be overridden
|
||||
// function IsOverriden for root style returns true only if it is overridden by other root style
|
||||
Standard_Boolean anIsRootStyle = Standard_True;
|
||||
for(Standard_Integer i = 1; i <= nb; i++)
|
||||
{
|
||||
Handle(StepVisual_StyledItem) Style = Styles.RootStyle(i);
|
||||
// check that style is overridden by other root style
|
||||
if (!IsOverriden (aGraph, Style, anIsRootStyle))
|
||||
{
|
||||
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
|
||||
}
|
||||
}
|
||||
Standard_Integer nb = Styles.NbStyles();
|
||||
for (Standard_Integer i = 1; i <= nb; i++) {
|
||||
Handle(StepVisual_StyledItem) style = Styles.Style(i);
|
||||
if (style.IsNull()) continue;
|
||||
|
||||
nb = Styles.NbStyles();
|
||||
// apply leaf styles, they can override root styles
|
||||
anIsRootStyle = Standard_False;
|
||||
for(Standard_Integer i = 1; i <= nb; i++)
|
||||
{
|
||||
Handle(StepVisual_StyledItem) Style = Styles.Style(i);
|
||||
// check that style is overridden
|
||||
if (!IsOverriden (aGraph, Style, anIsRootStyle))
|
||||
{
|
||||
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
|
||||
Standard_Boolean IsVisible = Standard_True;
|
||||
// check the visibility of styled item.
|
||||
for (Standard_Integer si = 1; si <= aHSeqOfInvisStyle->Length(); si++) {
|
||||
if (style != aHSeqOfInvisStyle->Value(si))
|
||||
continue;
|
||||
// found that current style is invisible.
|
||||
IsVisible = Standard_False;
|
||||
break;
|
||||
}
|
||||
|
||||
Handle(StepVisual_Colour) SurfCol, BoundCol, CurveCol, RenderCol;
|
||||
Standard_Real RenderTransp;
|
||||
// check if it is component style
|
||||
Standard_Boolean IsComponent = Standard_False;
|
||||
if (!Styles.GetColors(style, SurfCol, BoundCol, CurveCol, RenderCol, RenderTransp, IsComponent) && IsVisible)
|
||||
continue;
|
||||
|
||||
// collect styled items
|
||||
NCollection_Vector<StepVisual_StyledItemTarget> anItems;
|
||||
if (!style->ItemAP242().IsNull()) {
|
||||
anItems.Append(style->ItemAP242());
|
||||
}
|
||||
|
||||
const Handle(Transfer_TransientProcess) &TP = WS->TransferReader()->TransientProcess();
|
||||
for (Standard_Integer itemIt = 0; itemIt < anItems.Length(); itemIt++) {
|
||||
Standard_Integer index = TP->MapIndex(anItems.Value(itemIt).Value());
|
||||
TopoDS_Shape S;
|
||||
if (index > 0) {
|
||||
Handle(Transfer_Binder) binder = TP->MapItem(index);
|
||||
S = TransferBRep::ShapeResult(binder);
|
||||
}
|
||||
Standard_Boolean isSkipSHUOstyle = Standard_False;
|
||||
// take shape with real location.
|
||||
while (IsComponent) {
|
||||
// take SR of NAUO
|
||||
Handle(StepShape_ShapeRepresentation) aSR;
|
||||
findStyledSR(style, aSR);
|
||||
// search for SR along model
|
||||
if (aSR.IsNull())
|
||||
break;
|
||||
Interface_EntityIterator subs = WS->HGraph()->Graph().Sharings(aSR);
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
|
||||
for (subs.Start(); subs.More(); subs.Next()) {
|
||||
aSDR = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value());
|
||||
if (aSDR.IsNull())
|
||||
continue;
|
||||
StepRepr_RepresentedDefinition aPDSselect = aSDR->Definition();
|
||||
Handle(StepRepr_ProductDefinitionShape) PDS =
|
||||
Handle(StepRepr_ProductDefinitionShape)::DownCast(aPDSselect.PropertyDefinition());
|
||||
if (PDS.IsNull())
|
||||
continue;
|
||||
StepRepr_CharacterizedDefinition aCharDef = PDS->Definition();
|
||||
|
||||
Handle(StepRepr_AssemblyComponentUsage) ACU =
|
||||
Handle(StepRepr_AssemblyComponentUsage)::DownCast(aCharDef.ProductDefinitionRelationship());
|
||||
if (ACU.IsNull())
|
||||
continue;
|
||||
// PTV 10.02.2003 skip styled item that refer to SHUO
|
||||
if (ACU->IsKind(STANDARD_TYPE(StepRepr_SpecifiedHigherUsageOccurrence))) {
|
||||
isSkipSHUOstyle = Standard_True;
|
||||
break;
|
||||
}
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(ACU);
|
||||
if (NAUO.IsNull())
|
||||
continue;
|
||||
|
||||
TopoDS_Shape aSh;
|
||||
// PTV 10.02.2003 to find component of assembly CORRECTLY
|
||||
STEPConstruct_Tool Tool(WS);
|
||||
TDF_Label aShLab = FindInstance(NAUO, CTool->ShapeTool(), Tool, myMap);
|
||||
aSh = CTool->ShapeTool()->GetShape(aShLab);
|
||||
if (!aSh.IsNull()) {
|
||||
S = aSh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isSkipSHUOstyle)
|
||||
continue; // skip styled item which refer to SHUO
|
||||
|
||||
if (S.IsNull())
|
||||
continue;
|
||||
|
||||
if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull() || !RenderCol.IsNull() || !IsVisible)
|
||||
{
|
||||
TDF_Label aL;
|
||||
Standard_Boolean isFound = STool->SearchUsingMap(S, aL, Standard_False, Standard_True);
|
||||
if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull() || !RenderCol.IsNull())
|
||||
{
|
||||
Quantity_Color aSCol, aBCol, aCCol, aRCol;
|
||||
Quantity_ColorRGBA aFullSCol;
|
||||
if (!SurfCol.IsNull()) {
|
||||
Styles.DecodeColor(SurfCol, aSCol);
|
||||
aFullSCol = Quantity_ColorRGBA(aSCol);
|
||||
}
|
||||
if (!BoundCol.IsNull())
|
||||
Styles.DecodeColor(BoundCol, aBCol);
|
||||
if (!CurveCol.IsNull())
|
||||
Styles.DecodeColor(CurveCol, aCCol);
|
||||
if (!RenderCol.IsNull()) {
|
||||
Styles.DecodeColor(RenderCol, aRCol);
|
||||
aFullSCol = Quantity_ColorRGBA(aRCol, static_cast<float>(1.0f - RenderTransp));
|
||||
}
|
||||
if (isFound)
|
||||
{
|
||||
if (!SurfCol.IsNull() || !RenderCol.IsNull())
|
||||
CTool->SetColor(aL, aFullSCol, XCAFDoc_ColorSurf);
|
||||
if (!BoundCol.IsNull())
|
||||
CTool->SetColor(aL, aBCol, XCAFDoc_ColorCurv);
|
||||
if (!CurveCol.IsNull())
|
||||
CTool->SetColor(aL, aCCol, XCAFDoc_ColorCurv);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TopoDS_Iterator it(S); it.More(); it.Next())
|
||||
{
|
||||
TDF_Label aL1;
|
||||
if (STool->SearchUsingMap(it.Value(), aL1, Standard_False, Standard_True))
|
||||
{
|
||||
if (!SurfCol.IsNull() || !RenderCol.IsNull())
|
||||
CTool->SetColor(aL1, aFullSCol, XCAFDoc_ColorSurf);
|
||||
if (!BoundCol.IsNull())
|
||||
CTool->SetColor(aL1, aBCol, XCAFDoc_ColorCurv);
|
||||
if (!CurveCol.IsNull())
|
||||
CTool->SetColor(aL1, aCCol, XCAFDoc_ColorCurv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!IsVisible)
|
||||
{
|
||||
// sets the invisibility for shape.
|
||||
if (isFound)
|
||||
CTool->SetVisibility(aL, Standard_False);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CTool->ReverseChainsOfTreeNodes();
|
||||
|
||||
// some colors can be attached to assemblies, propagate them to components
|
||||
|
@@ -68,8 +68,6 @@
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_TransferWriter.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <StepVisual_ContextDependentOverRidingStyledItem.hxx>
|
||||
#include <StepShape_ShapeRepresentation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : STEPConstruct_Styles
|
||||
@@ -126,26 +124,6 @@ Handle(StepVisual_StyledItem) STEPConstruct_Styles::Style (const Standard_Intege
|
||||
return Handle(StepVisual_StyledItem)::DownCast ( myStyles.FindKey(i) );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbRootStyles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer STEPConstruct_Styles::NbRootStyles () const
|
||||
{
|
||||
return myRootStyles.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RootStyle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(StepVisual_StyledItem) STEPConstruct_Styles::RootStyle (const Standard_Integer i) const
|
||||
{
|
||||
return Handle(StepVisual_StyledItem)::DownCast ( myRootStyles.FindKey(i) );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearStyles
|
||||
@@ -156,7 +134,6 @@ void STEPConstruct_Styles::ClearStyles ()
|
||||
{
|
||||
myStyles.Clear();
|
||||
myPSA.Clear();
|
||||
myRootStyles.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -367,15 +344,13 @@ Standard_Boolean STEPConstruct_Styles::LoadStyles ()
|
||||
{
|
||||
myStyles.Clear();
|
||||
myPSA.Clear();
|
||||
myRootStyles.Clear();
|
||||
|
||||
|
||||
// find all MDGPRs and DMs and collect all defined styles in myStyles
|
||||
Handle(Interface_InterfaceModel) model = Model();
|
||||
Standard_Integer nb = model->NbEntities();
|
||||
Handle(Standard_Type) tMDGPR = STANDARD_TYPE(StepVisual_MechanicalDesignGeometricPresentationRepresentation);
|
||||
Handle(Standard_Type) tDM = STANDARD_TYPE(StepVisual_DraughtingModel);
|
||||
Handle(Standard_Type) tSI = STANDARD_TYPE(StepVisual_StyledItem);
|
||||
Handle(Standard_Type) tSR = STANDARD_TYPE(StepShape_ShapeRepresentation);
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
{
|
||||
Handle(Standard_Transient) enti = model->Value(i);
|
||||
@@ -389,26 +364,13 @@ Standard_Boolean STEPConstruct_Styles::LoadStyles ()
|
||||
Handle(StepVisual_StyledItem) style =
|
||||
Handle(StepVisual_StyledItem)::DownCast ( container->ItemsValue(j) );
|
||||
if ( style.IsNull() ) continue;
|
||||
auto anItem = style->ItemAP242 ().Value ();
|
||||
if (!anItem.IsNull() && anItem->IsKind(tSR))
|
||||
{
|
||||
myRootStyles.Add (style);
|
||||
}
|
||||
else
|
||||
{
|
||||
myStyles.Add (style);
|
||||
}
|
||||
myStyles.Add ( style );
|
||||
}
|
||||
}
|
||||
else if (enti->IsKind (STANDARD_TYPE(StepVisual_StyledItem)))
|
||||
else if (enti->DynamicType() == tSI)
|
||||
{
|
||||
Handle(StepVisual_StyledItem) aStyledItem = Handle(StepVisual_StyledItem)::DownCast (enti);
|
||||
auto anItem = aStyledItem->ItemAP242 ().Value ();
|
||||
if (!anItem.IsNull() && anItem->IsKind(tSR) && !myRootStyles.Contains (aStyledItem))
|
||||
{
|
||||
myRootStyles.Add (aStyledItem);
|
||||
}
|
||||
else if (!myStyles.Contains (aStyledItem))
|
||||
if (!myStyles.Contains (aStyledItem))
|
||||
{
|
||||
myStyles.Add (aStyledItem);
|
||||
}
|
||||
|
@@ -69,12 +69,6 @@ public:
|
||||
|
||||
//! Returns style with given index
|
||||
Standard_EXPORT Handle(StepVisual_StyledItem) Style (const Standard_Integer i) const;
|
||||
|
||||
//! Returns number of override styles
|
||||
Standard_EXPORT Standard_Integer NbRootStyles() const;
|
||||
|
||||
//! Returns override style with given index
|
||||
Standard_EXPORT Handle(StepVisual_StyledItem) RootStyle (const Standard_Integer i) const;
|
||||
|
||||
//! Clears all defined styles and PSA sequence
|
||||
Standard_EXPORT void ClearStyles();
|
||||
@@ -165,7 +159,6 @@ private:
|
||||
|
||||
TColStd_IndexedDataMapOfTransientTransient myMapOfStyles;
|
||||
TColStd_IndexedMapOfTransient myStyles;
|
||||
TColStd_IndexedMapOfTransient myRootStyles;
|
||||
TColStd_SequenceOfTransient myPSA;
|
||||
|
||||
|
||||
|
@@ -239,7 +239,6 @@ STEPControl_Controller::STEPControl_Controller ()
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexPositionMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexToleranceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixFaceSize.Tolerance", 't', "1.e-7");
|
||||
|
||||
// ika 28.07.16: Parameter to read all top level solids and shells,
|
||||
// should be used only in case of invalid shape_representation without links to shapes.
|
||||
|
@@ -1217,6 +1217,13 @@ static Standard_Boolean getCylinder(Handle(Geom_Surface)& theInSurface,
|
||||
Handle(Geom_SurfaceOfRevolution) aRS =
|
||||
Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface);
|
||||
Handle(Geom_Curve) aBasis = aRS->BasisCurve();
|
||||
|
||||
while (aBasis->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) aTc =
|
||||
Handle(Geom_TrimmedCurve)::DownCast(aBasis);
|
||||
aBasis = aTc->BasisCurve();
|
||||
}
|
||||
|
||||
if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) {
|
||||
Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis);
|
||||
gp_Dir aDir = aRS->Direction();
|
||||
@@ -1236,6 +1243,13 @@ static Standard_Boolean getCylinder(Handle(Geom_Surface)& theInSurface,
|
||||
Handle(Geom_SurfaceOfLinearExtrusion) aLES =
|
||||
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface);
|
||||
Handle(Geom_Curve) aBasis = aLES->BasisCurve();
|
||||
|
||||
while (aBasis->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) aTc =
|
||||
Handle(Geom_TrimmedCurve)::DownCast(aBasis);
|
||||
aBasis = aTc->BasisCurve();
|
||||
}
|
||||
|
||||
if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis);
|
||||
gp_Dir aDir = aLES->Direction();
|
||||
@@ -2763,26 +2777,6 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
for (Standard_Integer i = 1; i <= aFaceMap.Extent(); i++)
|
||||
TopExp::MapShapesAndAncestors (aFaceMap(i), TopAbs_EDGE, TopAbs_FACE, aGMapEdgeFaces);
|
||||
|
||||
// creating map of face shells for the whole shape to avoid
|
||||
// unification of faces belonging to the different shells
|
||||
DataMapOfShapeMapOfShape aGMapFaceShells;
|
||||
for (TopExp_Explorer anExp (myShape, TopAbs_SHELL); anExp.More(); anExp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aShell = anExp.Current();
|
||||
for (TopoDS_Iterator anItF (aShell); anItF.More(); anItF.Next())
|
||||
{
|
||||
const TopoDS_Shape& aF = anItF.Value();
|
||||
if (TopTools_MapOfShape* pShells = aGMapFaceShells.ChangeSeek (aF))
|
||||
{
|
||||
pShells->Add (aShell);
|
||||
}
|
||||
else
|
||||
{
|
||||
(aGMapFaceShells.Bound (aF, TopTools_MapOfShape()))->Add (aShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// creating map of free boundaries
|
||||
TopTools_MapOfShape aFreeBoundMap;
|
||||
// look at only shells not belonging to solids
|
||||
@@ -2804,7 +2798,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
// unify faces in each shell separately
|
||||
TopExp_Explorer exps;
|
||||
for (exps.Init(myShape, TopAbs_SHELL); exps.More(); exps.Next())
|
||||
IntUnifyFaces(exps.Current(), aGMapEdgeFaces, aGMapFaceShells, aFreeBoundMap);
|
||||
IntUnifyFaces(exps.Current(), aGMapEdgeFaces, aFreeBoundMap);
|
||||
|
||||
// gather all faces out of shells in one compound and unify them at once
|
||||
BRep_Builder aBB;
|
||||
@@ -2815,10 +2809,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
aBB.Add(aCmp, exps.Current());
|
||||
|
||||
if (nbf > 0)
|
||||
{
|
||||
// No connection to shells, thus no need to pass the face-shell map
|
||||
IntUnifyFaces(aCmp, aGMapEdgeFaces, DataMapOfShapeMapOfShape(), aFreeBoundMap);
|
||||
}
|
||||
IntUnifyFaces(aCmp, aGMapEdgeFaces, aFreeBoundMap);
|
||||
|
||||
myShape = myContext->Apply(myShape);
|
||||
}
|
||||
@@ -2841,52 +2832,13 @@ static void SetFixWireModes(ShapeFix_Face& theSff)
|
||||
aFixWire->FixSmallMode() = 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isSameSets
|
||||
//purpose : Compares two sets of shapes. Returns true if they are the same,
|
||||
// false otherwise.
|
||||
//=======================================================================
|
||||
|
||||
template<class Container>
|
||||
static Standard_Boolean isSameSets(const Container* theFShells1,
|
||||
const Container* theFShells2)
|
||||
{
|
||||
// If both are null - no problem
|
||||
if (theFShells1 == nullptr && theFShells2 == nullptr)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
// If only one is null - not the same
|
||||
if (theFShells1 == nullptr || theFShells2 == nullptr)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
// Both not null
|
||||
if (theFShells1->Extent() != theFShells2->Extent())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
// number of shells in each set should be very small in normal cases - max 2.
|
||||
// thus just check if all objects of one are contained in the other and vice versa.
|
||||
for (typename Container::Iterator it1(*theFShells1), it2(*theFShells2);
|
||||
it1.More() && it2.More(); it1.Next(), it2.Next())
|
||||
{
|
||||
if (!theFShells1->Contains(it2.Value()) || !theFShells2->Contains(it1.Value()))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntUnifyFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
|
||||
const DataMapOfShapeMapOfShape& theGMapFaceShells,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
|
||||
const TopTools_MapOfShape& theFreeBoundMap)
|
||||
{
|
||||
// creating map of edge faces for the shape
|
||||
@@ -2935,9 +2887,6 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
Standard_Real Uperiod = (aBaseSurface->IsUPeriodic())? aBaseSurface->UPeriod() : 0.;
|
||||
Standard_Real Vperiod = (aBaseSurface->IsVPeriodic())? aBaseSurface->VPeriod() : 0.;
|
||||
|
||||
// Get shells connected to the face (in normal cases should not be more than 2)
|
||||
const TopTools_MapOfShape* pFShells1 = theGMapFaceShells.Seek (aFace);
|
||||
|
||||
// find adjacent faces to union
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= edges.Length(); i++) {
|
||||
@@ -2986,15 +2935,6 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
if (aProcessed.Contains(aCheckedFace))
|
||||
continue;
|
||||
|
||||
// Get shells connected to the checked face
|
||||
const TopTools_MapOfShape* pFShells2 = theGMapFaceShells.Seek (aCheckedFace);
|
||||
// Faces can be unified only if the shells of faces connected to
|
||||
// these faces are the same. Otherwise, topology would be broken.
|
||||
if (!isSameSets (pFShells1, pFShells2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bCheckNormals) {
|
||||
// get normal of checked face using the same parameter on edge
|
||||
gp_Dir aDN2;
|
||||
|
@@ -70,7 +70,6 @@ class ShapeUpgrade_UnifySameDomain : public Standard_Transient
|
||||
public:
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape, Handle(Geom_Plane), TopTools_ShapeMapHasher> DataMapOfFacePlane;
|
||||
typedef NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> DataMapOfShapeMapOfShape;
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT ShapeUpgrade_UnifySameDomain();
|
||||
@@ -169,8 +168,7 @@ protected:
|
||||
Standard_EXPORT void UnifyEdges();
|
||||
|
||||
void IntUnifyFaces(const TopoDS_Shape& theInpShape,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
|
||||
const DataMapOfShapeMapOfShape& theGMapFaceShells,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
|
||||
const TopTools_MapOfShape& theFreeBoundMap);
|
||||
|
||||
//! Splits the sequence of edges into the sequence of chains
|
||||
|
@@ -34,7 +34,7 @@
|
||||
|
||||
// Primary definitions
|
||||
#define OCC_VERSION_MAJOR 7
|
||||
#define OCC_VERSION_MINOR 8
|
||||
#define OCC_VERSION_MINOR 7
|
||||
#define OCC_VERSION_MAINTENANCE 0
|
||||
|
||||
//! This macro must be commented in official release, and set to non-empty
|
||||
@@ -42,12 +42,12 @@
|
||||
//! - "dev" for development version between releases
|
||||
//! - "beta..." or "rc..." for beta releases or release candidates
|
||||
//! - "project..." for version containing project-specific fixes
|
||||
#define OCC_VERSION_DEVELOPMENT "dev"
|
||||
//#define OCC_VERSION_DEVELOPMENT "dev"
|
||||
|
||||
// Derived (manually): version as real and string (major.minor)
|
||||
#define OCC_VERSION 7.8
|
||||
#define OCC_VERSION_STRING "7.8"
|
||||
#define OCC_VERSION_COMPLETE "7.8.0"
|
||||
#define OCC_VERSION 7.7
|
||||
#define OCC_VERSION_STRING "7.7"
|
||||
#define OCC_VERSION_COMPLETE "7.7.0"
|
||||
|
||||
//! Derived: extended version as string ("major.minor.maintenance.dev")
|
||||
#ifdef OCC_VERSION_DEVELOPMENT
|
||||
|
@@ -48,7 +48,6 @@
|
||||
#include <XCAFDoc_GraphNode.hxx>
|
||||
#include <XCAFDoc_Location.hxx>
|
||||
#include <XCAFDoc_ShapeMapTool.hxx>
|
||||
#include <TopLoc_Datum3D.hxx>
|
||||
|
||||
IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_ShapeTool,TDataStd_GenericEmpty,"xcaf","ShapeTool")
|
||||
|
||||
@@ -1603,33 +1602,6 @@ Standard_Boolean XCAFDoc_ShapeTool::RemoveSHUO (const TDF_Label& L) const
|
||||
//purpose : auxiliary
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean IsEqual (const TopLoc_Location& theLoc1, const TopLoc_Location& theLoc2)
|
||||
{
|
||||
if (theLoc1.IsEqual (theLoc2)) {return Standard_True; }
|
||||
if (theLoc1.IsIdentity() || theLoc2.IsIdentity()) {return Standard_False; }
|
||||
const Handle(TopLoc_Datum3D)& aDatum1 = theLoc1.FirstDatum();
|
||||
const Handle(TopLoc_Datum3D)& aDatum2 = theLoc2.FirstDatum();
|
||||
if (aDatum1 && aDatum2)
|
||||
{
|
||||
NCollection_Mat4<double> aMat41;
|
||||
NCollection_Mat4<double> aMat42;
|
||||
theLoc1.FirstDatum()->Transformation().GetMat4(aMat41);
|
||||
theLoc2.FirstDatum()->Transformation().GetMat4(aMat42);
|
||||
if ( !aMat41.IsEqual (aMat42)) {return Standard_False; }
|
||||
}
|
||||
else if (aDatum1 || aDatum2) {return Standard_False; }
|
||||
if (theLoc1.FirstPower() != theLoc2.FirstPower() ) {return Standard_False; }
|
||||
else { return IsEqual (theLoc1.NextLocation(), theLoc2.NextLocation());}
|
||||
}
|
||||
|
||||
static Standard_Boolean IsSame (const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2)
|
||||
{
|
||||
|
||||
return theShape1.TShape() == theShape2.TShape()
|
||||
&& theShape1.Orientation() == theShape2.Orientation()
|
||||
&& IsEqual (theShape1.Location(), theShape2.Location());
|
||||
}
|
||||
|
||||
static Standard_Boolean checkForShape (const TopoDS_Shape& theShape,
|
||||
const TopoDS_Shape& theCurSh,
|
||||
const TDF_Label& theUserL,
|
||||
@@ -1644,7 +1616,7 @@ static Standard_Boolean checkForShape (const TopoDS_Shape& theShape,
|
||||
aCompLoc = aCompLoc.Multiplied( theCurSh.Location() );
|
||||
aSupLoc = aSupLoc.Multiplied( aCompLoc );
|
||||
aCopySh.Location( aSupLoc, Standard_False );
|
||||
if ( IsSame ( theShape, aCopySh ) ) {
|
||||
if ( aCopySh.IsSame( theShape ) ) {
|
||||
theLabels.Prepend( theUserL );
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -3,8 +3,6 @@
|
||||
#
|
||||
#Create 3 torus
|
||||
|
||||
puts "TODO CR33225 Linux: Error : The area of result shape is 138625, expected 197700"
|
||||
|
||||
ptorus a0 100 20
|
||||
tcopy a0 a1
|
||||
tcopy a0 a2
|
||||
|
24
tests/bugs/caf/bug114
Executable file
24
tests/bugs/caf/bug114
Executable file
@@ -0,0 +1,24 @@
|
||||
puts "==========="
|
||||
puts "OCC114"
|
||||
puts "==========="
|
||||
|
||||
# Max number of iterations for computing memory leackage
|
||||
set i_max 10
|
||||
puts "Amount of iterations is $i_max"
|
||||
|
||||
NewDocument D BinOcaf
|
||||
UndoLimit D 10
|
||||
|
||||
restore [locate_data_file OCC294.brep] s
|
||||
|
||||
set listmem {}
|
||||
for {set i 1} {${i} <= ${i_max}} {incr i} {
|
||||
|
||||
OpenCommand D
|
||||
SetShape D 0:1 s
|
||||
AbortCommand D
|
||||
|
||||
# check memory usage (with tolerance equal to half page size)
|
||||
lappend listmem [meminfo h]
|
||||
checktrend $listmem 50 50 "Memory leak detected"
|
||||
}
|
17
tests/bugs/caf/bug26293_2
Normal file
17
tests/bugs/caf/bug26293_2
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "==========="
|
||||
puts "OCC26293"
|
||||
puts "==========="
|
||||
puts ""
|
||||
#################################
|
||||
# Error opening the document
|
||||
#################################
|
||||
|
||||
Open [locate_data_file bug26293_all_geom.sgd] D
|
||||
vinit
|
||||
for {set i 1} {$i < 1065} {incr i} {
|
||||
if { ![catch {GetShape D 0:1:$i:1:1:2 res$i}] } {
|
||||
vdisplay res$i
|
||||
}
|
||||
}
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
@@ -1,5 +1,3 @@
|
||||
puts "TODO ?CR33225 Windows: Failed class "
|
||||
|
||||
pload QAcommands
|
||||
|
||||
QANTestStlIterators
|
||||
|
@@ -1,4 +1,3 @@
|
||||
puts "TODO ?СК33225 Linux: Checking trend failed "
|
||||
puts "TODO ?OCC7287 Linux: Tcl Exception: Memory leak detected"
|
||||
puts "TODO ?OCC7287 Linux: TEST INCOMPLETE"
|
||||
puts "TODO ?OCC7287 MacOS: Tcl Exception: Memory leak detected"
|
||||
|
@@ -1,4 +1,3 @@
|
||||
puts "TODO ?CR332257287 Linux: Checking trend failed: mean delta per step = 9432.0, sigma = 4220.013270121316, expected delta = 0"
|
||||
puts "TODO ?OCC7287 Linux: Tcl Exception: Memory leak detected"
|
||||
puts "TODO ?OCC7287 Linux: TEST INCOMPLETE"
|
||||
puts "TODO ?OCC7287 MacOS: Tcl Exception: Memory leak detected"
|
||||
|
@@ -1,4 +1,3 @@
|
||||
puts "TODO ?CR33225 Linux: Checking trend failed: mean delta per step = 7408.0, sigma = 2737.917456754312, expected delta = 0"
|
||||
puts "TODO ?OCC7287 Linux: Tcl Exception: Memory leak detected"
|
||||
puts "TODO ?OCC7287 Linux: TEST INCOMPLETE"
|
||||
puts "TODO ?OCC7287 MacOS: Tcl Exception: Memory leak detected"
|
||||
|
@@ -1,71 +0,0 @@
|
||||
puts "========================"
|
||||
puts " 0033171: Modeling Algorithms - Invalid result of faces unification"
|
||||
puts "========================"
|
||||
puts ""
|
||||
|
||||
# make outer prism
|
||||
polyline p 0 0 0 10 0 0 10 10 0 0 10 0 0 0 0
|
||||
mkplane f p
|
||||
prism s f 0 0 5
|
||||
|
||||
# make section shells
|
||||
polyline p1 3 10 0 3 7 0 6 7 0 6 3 0 10 3 0
|
||||
polyline p2 6 7 0 10 7 0
|
||||
polyline p3 8 7 0 8 10 0
|
||||
polyline p4 0 5 0 10 5 0
|
||||
|
||||
prism sh1 p1 0 0 5
|
||||
prism sh2 p2 0 0 5
|
||||
prism sh3 p3 0 0 5
|
||||
prism sh4 p4 0 0 5
|
||||
|
||||
# split the prism
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s
|
||||
baddtools sh1 sh2 sh3 sh4
|
||||
bfillds
|
||||
bsplit r
|
||||
|
||||
checkshape r
|
||||
if {![regexp "This shape seems to be OK" [bopcheck r]]} {
|
||||
puts "Error: invalid shape after split"
|
||||
}
|
||||
|
||||
# try to unify faces in the result compound
|
||||
unifysamedom ru1 r
|
||||
unifysamedom ru2 r +i
|
||||
|
||||
checkshape ru1
|
||||
checkshape ru2
|
||||
|
||||
checknbshapes ru1 -ref [nbshapes r -t] -t
|
||||
checknbshapes ru2 -ref [nbshapes r -t] -t
|
||||
|
||||
if {![regexp "This shape seems to be OK" [bopcheck ru1]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
if {![regexp "This shape seems to be OK" [bopcheck ru2]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
|
||||
# make compound of shells
|
||||
eval compound [explode r] shs
|
||||
|
||||
unifysamedom shsu1 r
|
||||
unifysamedom shsu2 r +i
|
||||
|
||||
checkshape shsu1
|
||||
checkshape shsu2
|
||||
|
||||
checknbshapes shsu1 -ref [nbshapes shs -t] -t
|
||||
checknbshapes shsu2 -ref [nbshapes shs -t] -t
|
||||
|
||||
if {![regexp "This shape seems to be OK" [bopcheck shsu1]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
if {![regexp "This shape seems to be OK" [bopcheck shsu2]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
|
||||
checkview -display ru2 -2d -path ${imagedir}/${test_image}.png
|
@@ -1,57 +0,0 @@
|
||||
puts "========================"
|
||||
puts " 0033171: Modeling Algorithms - Invalid result of faces unification"
|
||||
puts "========================"
|
||||
puts ""
|
||||
|
||||
# make two solids
|
||||
box b1 10 10 5
|
||||
box b2 10 0 0 5 5 5
|
||||
# make shared
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects b1 b2
|
||||
bfillds
|
||||
bbuild r
|
||||
|
||||
checkshape r
|
||||
if {![regexp "This shape seems to be OK" [bopcheck r]]} {
|
||||
puts "Error: invalid shape after fuse"
|
||||
}
|
||||
|
||||
# try to unify faces in the result compound
|
||||
unifysamedom ru1 r
|
||||
unifysamedom ru2 r +i
|
||||
|
||||
checkshape ru1
|
||||
checkshape ru2
|
||||
|
||||
checknbshapes ru1 -ref [nbshapes r -t] -t
|
||||
checknbshapes ru2 -ref [nbshapes r -t] -t
|
||||
|
||||
if {![regexp "This shape seems to be OK" [bopcheck ru1]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
if {![regexp "This shape seems to be OK" [bopcheck ru2]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
|
||||
# make compound of shells
|
||||
eval compound [explode r] shs
|
||||
|
||||
unifysamedom shsu1 r
|
||||
unifysamedom shsu2 r +i
|
||||
|
||||
checkshape shsu1
|
||||
checkshape shsu2
|
||||
|
||||
checknbshapes shsu1 -ref [nbshapes shs -t] -t
|
||||
checknbshapes shsu2 -ref [nbshapes shs -t] -t
|
||||
|
||||
if {![regexp "This shape seems to be OK" [bopcheck shsu1]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
if {![regexp "This shape seems to be OK" [bopcheck shsu2]]} {
|
||||
puts "Error: invalid shape after faces unification"
|
||||
}
|
||||
|
||||
checkview -display ru2 -2d -path ${imagedir}/${test_image}.png
|
18
tests/bugs/mesh/bug32424
Normal file
18
tests/bugs/mesh/bug32424
Normal file
@@ -0,0 +1,18 @@
|
||||
puts "======="
|
||||
puts "0032424: Mesh - Slow triangulation of a simple shape."
|
||||
puts "======="
|
||||
puts ""
|
||||
cpulimit 3
|
||||
|
||||
restore [locate_data_file bug32424.brep] result
|
||||
|
||||
incmesh result 0.17 -a 20
|
||||
|
||||
checktrinfo result -tri 2360 -nod 1302
|
||||
|
||||
vinit
|
||||
vdefaults -autoTriang 0
|
||||
vsetdispmode 1
|
||||
vdisplay result
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
@@ -1,12 +1,7 @@
|
||||
puts "TODO CR33225 Linux: Error : The command is not valid. The area is 0."
|
||||
puts "TODO CR33225 Linux: Error : The area of result shape is 0, expected 177462"
|
||||
puts "TODO CR33225 Linux: is WRONG because number of "
|
||||
|
||||
puts "============"
|
||||
puts "OCC19071"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
#######################################################################
|
||||
# The MakeFuse or the MakePartition function crash together on 2 torus
|
||||
#######################################################################
|
||||
|
@@ -1,5 +1,4 @@
|
||||
puts "TODO CR30351 Windows: Faulty OCC25199: Bad tolerance edge generated by blend algorithm"
|
||||
puts "TODO CR33225 Linux: Faulty OCC25199: Bad tolerance edge generated by blend algorithm"
|
||||
|
||||
puts "============"
|
||||
puts "OCC25199"
|
||||
|
20
tests/bugs/modalg_6/bug26616
Normal file
20
tests/bugs/modalg_6/bug26616
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "========"
|
||||
puts "OCC26616"
|
||||
puts "========"
|
||||
puts ""
|
||||
############################################
|
||||
# Memory leak in IntTools_Context::Hatcher
|
||||
############################################
|
||||
|
||||
restore [locate_data_file OCC26635_t0.brep] t0
|
||||
restore [locate_data_file OCC26635_t1.brep] t1
|
||||
|
||||
bfuse res t0 t1
|
||||
|
||||
set listmem {}
|
||||
for {set i 1} {$i < 10} {incr i} {
|
||||
bfuse res t0 t1
|
||||
|
||||
lappend listmem [meminfo h]
|
||||
checktrend $listmem 0 64 "Memory leak detected"
|
||||
}
|
@@ -3,8 +3,6 @@ puts "OCC27884: Modeling Algorithms - Possible improvement for 2d classifier"
|
||||
puts "================================================================="
|
||||
puts ""
|
||||
|
||||
puts "TODO ?CR33225 Windows: Error: algorithm slowed down"
|
||||
|
||||
pload ALL
|
||||
pload QAcommands
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
puts "TODO ?CR33225 Windows: extra characters after close-quote "
|
||||
|
||||
puts "========"
|
||||
puts "OCC29293"
|
||||
puts "========"
|
||||
|
48
tests/bugs/modalg_7/bug29843_1
Normal file
48
tests/bugs/modalg_7/bug29843_1
Normal file
@@ -0,0 +1,48 @@
|
||||
puts "========"
|
||||
puts "0029843: Modeling Algorithms - Boolean FUSE produces incorrect result"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug29843.brep] s
|
||||
|
||||
explode s
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s_1
|
||||
baddtools s_2
|
||||
bfillds
|
||||
|
||||
bbop r_0 0
|
||||
bbop r_1 1
|
||||
bbop r_2 2
|
||||
bbop r_3 3
|
||||
bbop r_4 4
|
||||
bbuild r_5
|
||||
|
||||
foreach i { 0 1 2 3 4 5} {
|
||||
checkshape r_$i
|
||||
if {![regexp "OK" [bopcheck r_$i]]} {
|
||||
puts "Error: r_$i is self-intersecting shape"
|
||||
}
|
||||
}
|
||||
|
||||
checkprops r_0 -s 9.84429 -v 0.639311
|
||||
checknbshapes r_0 -wire 7 -face 5 -shell 1 -solid 1 -t
|
||||
|
||||
checkprops r_1 -s 2121.39 -v 612.41
|
||||
checknbshapes r_1 -wire 38 -face 32 -shell 2 -solid 1 -t
|
||||
|
||||
checkprops r_2 -s 2113.85 -v 611.569
|
||||
checknbshapes r_2 -wire 32 -face 26 -shell 2 -solid 1 -t
|
||||
|
||||
checkprops r_3 -s 15.9893 -v 0.215264
|
||||
checknbshapes r_3 -wire 11 -face 9 -shell 2 -solid 2 -t
|
||||
|
||||
checkprops r_4 -l 24.9725
|
||||
checksection r_4 -r 2
|
||||
|
||||
checkprops r_5 -s 2139.68 -v 612.402
|
||||
checknbshapes r_5 -wire 44 -face 36 -shell 5 -solid 4 -t
|
||||
|
||||
checkview -display r_0 -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -2,7 +2,7 @@ puts "================================================="
|
||||
puts "0030054: BRepOffset_MakeOffset fails to build joints in intersection mode"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
puts "TODO OCC33166 ALL: Faulty shapes"
|
||||
|
||||
restore [locate_data_file bug30054.brep] a
|
||||
|
||||
thickshell result a 1 i
|
||||
|
25
tests/bugs/modalg_7/bug32934
Normal file
25
tests/bugs/modalg_7/bug32934
Normal file
@@ -0,0 +1,25 @@
|
||||
puts "========"
|
||||
puts "OCC32934"
|
||||
puts "========"
|
||||
puts ""
|
||||
###############################################################################################
|
||||
# BRepExtrema_DistShapeShape BRepExtrema_DistShapeShape returns two solutions instead of one.
|
||||
###############################################################################################
|
||||
|
||||
pload ALL
|
||||
restore [locate_data_file bug32934.brep] edges
|
||||
explode edges E
|
||||
|
||||
distmini di edges_1 edges_2
|
||||
if { ([isdraw di2]) } {
|
||||
puts "Error : result of distmini is wrong"
|
||||
} else {
|
||||
checknbshapes di -vertex 1 -edge 0
|
||||
}
|
||||
|
||||
distmini dii edges_2 edges_1
|
||||
if { ([isdraw dii2]) } {
|
||||
puts "Error : result of distmini is wrong"
|
||||
} else {
|
||||
checknbshapes dii -vertex 1 -edge 0
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
puts "============"
|
||||
puts "0026441: Modeling Algorithms - BRepOffset_MakeOffset affects original shape"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
pload QAcommands
|
||||
restore [locate_data_file bug26440_plate.brep] sh
|
||||
|
||||
tcopy sh sh_ref
|
||||
thickshell result sh 160
|
||||
|
||||
checkprops result -s 2.40831e+07
|
||||
checkshape result
|
||||
|
||||
set nbshapes_expected "
|
||||
Number of shapes in shape
|
||||
VERTEX : 196
|
||||
EDGE : 308
|
||||
WIRE : 110
|
||||
FACE : 110
|
||||
SHELL : 1
|
||||
SOLID : 1
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 0
|
||||
SHAPE : 726
|
||||
"
|
||||
checknbshapes result -ref ${nbshapes_expected} -t -m "solid construction"
|
||||
if { [info exist BadEdges] } {
|
||||
unset BadEdges
|
||||
}
|
||||
if { [info exist BadVerts] } {
|
||||
unset BadVerts
|
||||
}
|
||||
|
||||
OCC26441 sh sh_ref 1.e-7 1
|
||||
|
||||
if { [isdraw BadEdges] || [isdraw BadVerts]} {
|
||||
puts "Error: tolerances of some subshapes of initial shape are changed"
|
||||
}
|
||||
|
@@ -1,72 +0,0 @@
|
||||
puts "================"
|
||||
puts "0032857: Problem when finding the intersection between a new face made after a draft and the inner face of body"
|
||||
puts "================"
|
||||
puts ""
|
||||
# Script reproducing the problematic draft case in FreeCAD issue #2497
|
||||
#Category: Modeling
|
||||
#Title: OCCT Tutorial pocketed ring
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# Set basic dimensions. Problems appear when inner_rad < pocket_center.
|
||||
dset height 10
|
||||
dset inner_rad 39
|
||||
dset outer_rad 50
|
||||
dset pocket_center 40
|
||||
dset pocket_rad 20
|
||||
dset pocket_depth 5
|
||||
|
||||
# Construct base profile (the "my_ring")
|
||||
puts "Constructing my_ring..."
|
||||
|
||||
circle c_inner 0 0 0 0 0 1 inner_rad
|
||||
circle c_outer 0 0 0 0 0 1 outer_rad
|
||||
mkedge e_inner c_inner
|
||||
mkedge e_outer c_outer
|
||||
wire w_inner e_inner
|
||||
wire w_outer e_outer
|
||||
|
||||
plane p0
|
||||
mkface my_ring_inner_base p0 w_inner
|
||||
mkface my_ring_outer_base p0 w_outer
|
||||
|
||||
prism my_ring_inner my_ring_inner_base 0 0 height
|
||||
prism my_ring_outer my_ring_outer_base 0 0 height
|
||||
|
||||
bcut my_ring my_ring_outer my_ring_inner
|
||||
|
||||
# Make the pocket
|
||||
puts "Constructing pocket..."
|
||||
|
||||
circle pocket_base pocket_center 0 0 0 0 1 pocket_rad
|
||||
mkedge pocket_base pocket_base
|
||||
wire pocket_base pocket_base
|
||||
|
||||
mkface pocket_base p0 pocket_base
|
||||
|
||||
prism my_pocket pocket_base 0 0 pocket_depth
|
||||
|
||||
# Make the cut
|
||||
puts "Making the cut"
|
||||
|
||||
bcut slotted_ring my_ring my_pocket
|
||||
|
||||
explode slotted_ring F
|
||||
|
||||
# Make the draft
|
||||
puts "Drafting the face"
|
||||
|
||||
# Found face by trial and error: slotted_ring_3
|
||||
# Perform the draft
|
||||
depouille slotted_ring_with_draft slotted_ring 0 0 -1 slotted_ring_3 44 0 1 0 0 0 1
|
||||
|
||||
#checking result
|
||||
checkshape slotted_ring_with_draft
|
||||
checknbshapes slotted_ring_with_draft -shape 48 -vertex 12 -edge 18 -face 7 -wire 8
|
||||
checkprops slotted_ring_with_draft -s 11466.5 -v 28662.9
|
||||
|
||||
puts "Showing result..."
|
||||
|
||||
# Display result
|
||||
checkview -display slotted_ring_with_draft -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -1,15 +0,0 @@
|
||||
puts "========"
|
||||
puts "0033173: Modeling Algorithms - Regression in BRepExtrema_DistShapeShape causing Standard_OutOfRange"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
set MinDistExpected 7.049107166484117e-07
|
||||
restore [locate_data_file bug33173.brep] s
|
||||
explode s
|
||||
distmini dm s_1 s_2
|
||||
if {[isdraw dm]} {
|
||||
checkreal MinDist $MinDistExpected [dval dm_val] 1.e-7 .01
|
||||
} else {
|
||||
puts "Error: distmini failed"
|
||||
}
|
||||
|
@@ -1,9 +0,0 @@
|
||||
puts "================================"
|
||||
puts "0033179: Modeling Algorithms - Crash in in ShapeFix_Shape with the attached object, when healing for fixing SameParameterFlag"
|
||||
puts "================================"
|
||||
|
||||
restore [locate_data_file bug33179.brep] s
|
||||
|
||||
fsameparameter s
|
||||
checkshape s
|
||||
|
@@ -1,9 +0,0 @@
|
||||
puts "================================"
|
||||
puts "0033187: Modeling Algorithms - Crash in postprocessing of imported shape"
|
||||
puts "================================"
|
||||
|
||||
restore [locate_data_file bug33187.brep] s
|
||||
|
||||
if [catch { fixshape r s } catch_result] {
|
||||
puts "${BugNumber}: Faulty"
|
||||
}
|
@@ -2,9 +2,6 @@ puts "========"
|
||||
puts "OCC162"
|
||||
puts "========"
|
||||
|
||||
puts "TODO ?CR33225 Linux: Checking trend failed "
|
||||
puts "TODO ?CR33225 Linux: Tcl Exception: Memory leak detected"
|
||||
|
||||
pload QAcommands
|
||||
pload XDE
|
||||
|
||||
|
@@ -1,27 +0,0 @@
|
||||
puts "================"
|
||||
puts "OCC27122"
|
||||
puts "================"
|
||||
puts ""
|
||||
#####################################################################
|
||||
# STEP import regression: invalid shapes are produced during model translation due to huge face tolerance
|
||||
#####################################################################
|
||||
|
||||
pload XDE
|
||||
|
||||
# Empty resource file name to take params from InterfaceStatic
|
||||
param "read.step.resource.name" "\"\""
|
||||
# Add FixFaceSize operator
|
||||
param "FromSTEP.exec.op" FixShape,FixFaceSize
|
||||
# Set a tolerance exceeding the size of the problem face to FixFaceSize operator
|
||||
param "FromSTEP.FixFaceSize.Tolerance" 0.0508
|
||||
|
||||
stepread [locate_data_file bug27122_280696.stp] a *
|
||||
|
||||
# restore old params
|
||||
param "read.step.resource.name" STEP
|
||||
param "FromSTEP.exec.op" FixShape
|
||||
param "FromSTEP.FixFaceSize.Tolerance" 1.e-7
|
||||
|
||||
checknbshapes a_1 -t -face 10
|
||||
|
||||
checkview -display a_1 -3d -path ${imagedir}/${test_image}.png
|
@@ -1,58 +0,0 @@
|
||||
puts "===================================="
|
||||
puts "0032977: OCC V7.5, V7.6 cannot read STEP color correctly for the root label, but v6.8 can"
|
||||
puts "===================================="
|
||||
puts ""
|
||||
|
||||
pload ALL
|
||||
|
||||
# Read files
|
||||
# Check colors number
|
||||
|
||||
ReadStep D1 [locate_data_file bug32977_1.stp]
|
||||
set info1 [XStat D1]
|
||||
regexp {Number +of +colors += +([-0-9.+eE]+)} $info1 full nbcolor
|
||||
regexp {Number +of +colors += +[-0-9.+eE]+\n([^\n]*)} $info1 full colors
|
||||
if {[string compare ${colors} "RED BLACK GRAY74 GRAY26 "] != 0} {
|
||||
puts "Error: not expected colors ${colors}"
|
||||
}
|
||||
if {$nbcolor != 4} {
|
||||
puts "Error: not expected number of colors"
|
||||
}
|
||||
|
||||
ReadStep D2 [locate_data_file bug32977_2.step]
|
||||
set info2 [XStat D2]
|
||||
regexp {Number +of +colors += +([-0-9.+eE]+)} $info2 full nbcolor
|
||||
regexp {Number +of +colors += +[-0-9.+eE]+\n([^\n]*)} $info2 full colors
|
||||
if {[string compare ${colors} "LIGHTSTEELBLUE2 WHITE VIOLETRED3 GRAY25 "] != 0} {
|
||||
puts "Error: not expected colors ${colors}"
|
||||
}
|
||||
if {$nbcolor != 4} {
|
||||
puts "Error: not expected number of colors"
|
||||
}
|
||||
|
||||
ReadStep D3 [locate_data_file trj10_pm8-id-214.stp]
|
||||
set info3 [XStat D3]
|
||||
regexp {Number +of +colors += +([-0-9.+eE]+)} $info3 full nbcolor
|
||||
regexp {Number +of +colors += +[-0-9.+eE]+\n([^\n]*)} $info3 full colors
|
||||
if {[string compare ${colors} "MAGENTA RED ORANGERED ORANGE DEEPSKYBLUE2 GREEN "] != 0} {
|
||||
puts "Error: not expected colors ${colors}"
|
||||
}
|
||||
if {$nbcolor != 6} {
|
||||
puts "Error: not expected number of colors"
|
||||
}
|
||||
|
||||
vinit View1
|
||||
XDisplay D1 -dispmode 1
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}1.png
|
||||
|
||||
vclear
|
||||
XDisplay D2 -dispmode 1
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}2.png
|
||||
|
||||
vclear
|
||||
XDisplay D3 -dispmode 1
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}3.png
|
||||
|
@@ -1,5 +1,4 @@
|
||||
puts "TODO OCC24156 MacOS: Error: unsupported locale specification"
|
||||
puts "TODO CR33225 Linux: Error: unsupported locale specification"
|
||||
|
||||
# Test for issue #22898 and other functionality that can be affected by locale.
|
||||
# Just run multiple conversions of the shape to and from different formats and
|
||||
|
@@ -8,10 +8,10 @@ CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) So
|
||||
NBSHAPES : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 492 ( 492 )
|
||||
STATSHAPE : Solid = 57 ( 57 ) Shell = 57 ( 57 ) Face = 1894 ( 1894 ) FreeWire = 0 ( 0 )
|
||||
TOLERANCE : MaxTol = 1e-007 ( 1e-007 ) AvgTol = 1e-007 ( 1e-007 )
|
||||
LABELS : N0Labels = 5 ( 5 ) N1Labels = 32 ( 32 ) N2Labels = 0 ( 0 ) TotalLabels = 37 ( 37 ) NameLabels = 36 ( 36 ) ColorLabels = 4 ( 4 ) LayerLabels = 0 ( 0 )
|
||||
LABELS : N0Labels = 5 ( 5 ) N1Labels = 31 ( 31 ) N2Labels = 0 ( 0 ) TotalLabels = 36 ( 36 ) NameLabels = 36 ( 36 ) ColorLabels = 3 ( 3 ) LayerLabels = 0 ( 0 )
|
||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||
NCOLORS : NColors = 4 ( 4 )
|
||||
COLORS : Colors = CYAN GREEN RED YELLOW ( CYAN GREEN RED YELLOW )
|
||||
NCOLORS : NColors = 3 ( 3 )
|
||||
COLORS : Colors = CYAN GREEN YELLOW ( CYAN GREEN YELLOW )
|
||||
NLAYERS : NLayers = 0 ( 0 )
|
||||
LAYERS : Layers = ( )
|
||||
|
||||
|
@@ -8,10 +8,10 @@ CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) So
|
||||
NBSHAPES : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 492 ( 492 )
|
||||
STATSHAPE : Solid = 57 ( 57 ) Shell = 57 ( 57 ) Face = 1894 ( 1894 ) FreeWire = 0 ( 0 )
|
||||
TOLERANCE : MaxTol = 1e-007 ( 1e-007 ) AvgTol = 1e-007 ( 1e-007 )
|
||||
LABELS : N0Labels = 5 ( 5 ) N1Labels = 32 ( 32 ) N2Labels = 0 ( 0 ) TotalLabels = 37 ( 37 ) NameLabels = 36 ( 36 ) ColorLabels = 4 ( 4 ) LayerLabels = 0 ( 0 )
|
||||
LABELS : N0Labels = 5 ( 5 ) N1Labels = 31 ( 31 ) N2Labels = 0 ( 0 ) TotalLabels = 36 ( 36 ) NameLabels = 36 ( 36 ) ColorLabels = 3 ( 3 ) LayerLabels = 0 ( 0 )
|
||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||
NCOLORS : NColors = 4 ( 4 )
|
||||
COLORS : Colors = CYAN GREEN RED YELLOW ( CYAN GREEN RED YELLOW )
|
||||
NCOLORS : NColors = 3 ( 3 )
|
||||
COLORS : Colors = CYAN GREEN YELLOW ( CYAN GREEN YELLOW )
|
||||
NLAYERS : NLayers = 0 ( 0 )
|
||||
LAYERS : Layers = ( )
|
||||
|
||||
|
16
tests/de_mesh/gltf_write/010
Normal file
16
tests/de_mesh/gltf_write/010
Normal file
@@ -0,0 +1,16 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadGltf D0 [locate_data_file bug32867_010.glb]
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on -mergefaces
|
||||
WriteGltf D0 "$aGltfFile2" -draco on
|
||||
|
||||
ReadGltf D1 "$aGltfFile1"
|
||||
ReadGltf D "$aGltfFile2"
|
16
tests/de_mesh/gltf_write/Diamond
Normal file
16
tests/de_mesh/gltf_write/Diamond
Normal file
@@ -0,0 +1,16 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadGltf D0 [locate_data_file bug32867_Diamond.glb]
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on
|
||||
WriteGltf D0 "$aGltfFile2" -draco on -mergefaces
|
||||
|
||||
ReadGltf D1 "$aGltfFile1"
|
||||
ReadGltf D "$aGltfFile2"
|
18
tests/de_mesh/gltf_write/as1draco
Normal file
18
tests/de_mesh/gltf_write/as1draco
Normal file
@@ -0,0 +1,18 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadStep D0 [locate_data_file as1-oc-214-mat.stp]
|
||||
XGetOneShape ss D0
|
||||
incmesh ss 1.0
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on
|
||||
WriteGltf D0 "$aGltfFile2" -draco on -mergefaces
|
||||
|
||||
ReadGltf D1 "$aGltfFile1"
|
||||
ReadGltf D "$aGltfFile2"
|
16
tests/de_mesh/gltf_write/bearing
Normal file
16
tests/de_mesh/gltf_write/bearing
Normal file
@@ -0,0 +1,16 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
restore [locate_data_file bearing.brep] b
|
||||
incmesh b 0.1
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf b "$aGltfFile1" -draco on
|
||||
WriteGltf b "$aGltfFile2" -draco on -mergefaces
|
||||
|
||||
ReadGltf D0 "$aGltfFile1"
|
||||
ReadGltf D "$aGltfFile2"
|
16
tests/de_mesh/gltf_write/bull
Normal file
16
tests/de_mesh/gltf_write/bull
Normal file
@@ -0,0 +1,16 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadGltf D0 [locate_data_file bug32867_bull.glb]
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on
|
||||
WriteGltf D0 "$aGltfFile2" -draco on -mergefaces
|
||||
|
||||
ReadGltf D1 "$aGltfFile1"
|
||||
ReadGltf D "$aGltfFile2"
|
13
tests/de_mesh/gltf_write/bull_parallel
Normal file
13
tests/de_mesh/gltf_write/bull_parallel
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadGltf D0 [locate_data_file bug32867_bull.glb]
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on -parallel
|
||||
|
||||
ReadGltf D "$aGltfFile1"
|
18
tests/de_mesh/gltf_write/screw
Normal file
18
tests/de_mesh/gltf_write/screw
Normal file
@@ -0,0 +1,18 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadStep D0 [locate_data_file screw.step]
|
||||
XGetOneShape ss D0
|
||||
incmesh ss 1.0
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on -mergefaces
|
||||
WriteGltf D0 "$aGltfFile2" -draco on
|
||||
|
||||
ReadGltf D1 "$aGltfFile1"
|
||||
ReadGltf D "$aGltfFile2"
|
17
tests/de_mesh/gltf_write/soapbox
Normal file
17
tests/de_mesh/gltf_write/soapbox
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
ReadStep D0 [locate_data_file ec_soapbox-A.stp]
|
||||
XGetOneShape ss D0
|
||||
incmesh ss 1.0
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on
|
||||
WriteGltf D0 "$aGltfFile2" -draco on -mergefaces
|
||||
|
||||
ReadGltf D1 "$aGltfFile1"
|
||||
ReadGltf D "$aGltfFile2"
|
20
tests/de_mesh/gltf_write/test
Normal file
20
tests/de_mesh/gltf_write/test
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadGltf D0 [locate_data_file bug32867_test.glb]
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
set aGltfFile2 "${imagedir}/${casename}_tmp2.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on
|
||||
WriteGltf D0 "$aGltfFile2" -draco on -mergefaces
|
||||
|
||||
ReadGltf D1 "$aGltfFile1"
|
||||
XGetOneShape s1 D1
|
||||
checktrinfo s1 -tri 9366
|
||||
ReadGltf D "$aGltfFile2"
|
||||
XGetOneShape s2 D
|
||||
checktrinfo s2 -tri 9366
|
8
tests/heal/checkshape/bug32448_10
Normal file
8
tests/heal/checkshape/bug32448_10
Normal file
@@ -0,0 +1,8 @@
|
||||
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_6101"
|
||||
puts "=========="
|
||||
puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
|
||||
puts "=========="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file OCC54.brep] b
|
||||
checkshape b -exact -parallel
|
@@ -4,7 +4,7 @@ puts "====================================="
|
||||
puts ""
|
||||
|
||||
set viewname ""
|
||||
set length 6.30139
|
||||
set length 6.30238
|
||||
|
||||
restore [locate_data_file bug27341_hlrsave.brep] a
|
||||
COMPUTE_HLR $viewname $algotype
|
||||
|
@@ -1,4 +1,4 @@
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 7.9487, expected 8.05281"
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 8.06872, expected 8.05281"
|
||||
|
||||
puts "====================================="
|
||||
puts "OCC27341: Incorrect exact HLR results"
|
||||
|
@@ -4,7 +4,7 @@ puts "====================================="
|
||||
puts ""
|
||||
|
||||
set viewname "vbottom"
|
||||
set length 8.40196
|
||||
set length 8.39744
|
||||
|
||||
restore [locate_data_file bug27341_hlrsave.brep] a
|
||||
COMPUTE_HLR $viewname $algotype
|
||||
|
@@ -1,4 +1,4 @@
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 7.4452, expected 7.39488"
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 7.44464, expected 7.39488"
|
||||
|
||||
puts "====================================="
|
||||
puts "OCC27341: Incorrect exact HLR results"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 9.08401, expected 9.47163"
|
||||
puts "TODO OCC30286 ALL: Error : The length of result shape is 9.10542, expected 9.47163"
|
||||
|
||||
puts "====================================="
|
||||
puts "OCC27341: Incorrect exact HLR results"
|
||||
|
@@ -4,7 +4,7 @@ puts "====================================="
|
||||
puts ""
|
||||
|
||||
set viewname "vleft"
|
||||
set length 7.64618
|
||||
set length 7.64599
|
||||
|
||||
restore [locate_data_file bug27341_hlrsave.brep] a
|
||||
COMPUTE_HLR $viewname $algotype
|
||||
|
@@ -4,7 +4,7 @@ puts "====================================="
|
||||
puts ""
|
||||
|
||||
set viewname "vright"
|
||||
set length 9.30402
|
||||
set length 9.30381
|
||||
|
||||
restore [locate_data_file bug27341_hlrsave.brep] a
|
||||
COMPUTE_HLR $viewname $algotype
|
||||
|
@@ -1,5 +1,5 @@
|
||||
puts "TODO OCC30286 Windows: Error : The length of result shape is 404.004, expected 404.386"
|
||||
puts "TODO CR33225 Linux: Error : The length of result shape is 404.004, expected 404.386"
|
||||
puts "TODO OCC30286 Linux: Error : The length of result shape is 404.492, expected 404.386"
|
||||
|
||||
polyline f1 0 0 0 0 -10 0 100 -10 0 100 0 0 0 0 0
|
||||
polyline f2 100 0 0 110 0 0 110 100 0 100 100 0 100 0 0
|
||||
|
10
tests/mkface/mkplane/bug33156
Normal file
10
tests/mkface/mkplane/bug33156
Normal file
@@ -0,0 +1,10 @@
|
||||
puts "============="
|
||||
puts "0033156: Modeling Algorithms - Planar face creation problem"
|
||||
puts "============="
|
||||
|
||||
brestore [locate_data_file bug33156_face.brep] Face
|
||||
|
||||
explode Face W
|
||||
#Face_1
|
||||
|
||||
mkplane result Face_1 1
|
@@ -1,6 +1,6 @@
|
||||
puts "TODO OCC26556 ALL: Error : The volume"
|
||||
puts "TODO OCC26556 ALL: Faulty shapes"
|
||||
puts "TODO OCC26556 ALL: Error : The area"
|
||||
puts "TODO OCC23748 ALL: ERROR. offsetperform operation not done."
|
||||
puts "TODO OCC23748 ALL: Error: The command cannot be built"
|
||||
puts "TODO OCC26556 ALL: Error : The offset cannot be built."
|
||||
|
||||
pcone s 5 0 12 270
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
puts "TODO OCC25406 ALL: Error : The volume of result shape is"
|
||||
puts "TODO OCC25406 ALL: Error: bsection of the result and s is not equal to zero"
|
||||
puts "TODO OCC25406 ALL: Faulty shapes"
|
||||
|
||||
ellipse w1 0 0 0 15 10
|
||||
mkedge w1 w1 0 pi/2
|
||||
|
@@ -1,4 +1,5 @@
|
||||
puts "TODO OCC23068 ALL: Error : The volume of result shape "
|
||||
puts "TODO OCC25406 ALL: Error: bsection of the result and s is not equal to zero"
|
||||
|
||||
pcone s 5 0 12 270
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
puts "TODO OCC23068 ALL: Error : The volume of result shape is"
|
||||
puts "TODO OCC23068 ALL: Error: bsection of the result and s is not equal to zero"
|
||||
puts "TODO OCC23068 ALL: Faulty shapes"
|
||||
|
||||
ellipse w1 0 0 0 15 10
|
||||
mkedge w1 w1 0 pi/2
|
||||
|
43
tests/opengl/data/background/skydome
Normal file
43
tests/opengl/data/background/skydome
Normal file
@@ -0,0 +1,43 @@
|
||||
puts "============"
|
||||
puts "0032606: Visualization - add a shader for sky"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
set THE_DIM 256
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
psphere s 1
|
||||
|
||||
vinit View1 -width 768 -height 512
|
||||
vcamera -persp -fovy 120
|
||||
|
||||
chrono t restart
|
||||
vbackground -skydome -size $THE_DIM -cloud 0.3 -sunDir 1.0 0.5 0.0 -time 10 -fog 0.3
|
||||
chrono t show
|
||||
vaxo
|
||||
vdump $imagedir/${casename}_day.png
|
||||
|
||||
chrono t restart
|
||||
vbackground -skydome -size $THE_DIM -cloud 0.3 -sunDir 1.0 -0.5 0.0 -time -10 -fog 0.05
|
||||
chrono t show
|
||||
vaxo
|
||||
vdump $imagedir/${casename}_night.png
|
||||
|
||||
chrono t restart
|
||||
vbackground -skydome -size $THE_DIM -cloud 0.15 -sunDir 1.0 0.15 0.0 -time 10
|
||||
chrono t show
|
||||
vaxo
|
||||
vdump $imagedir/${casename}_sunset.png
|
||||
|
||||
chrono t restart
|
||||
vbackground -skydome -size $THE_DIM
|
||||
chrono t show
|
||||
vaxo
|
||||
vdump $imagedir/${casename}_defaults.png
|
||||
|
||||
vdisplay -dispMode 1 s
|
||||
vfit
|
||||
vaspects s -material SILVER
|
||||
vrenderparams -shadingModel pbr
|
||||
vlight headlight -enabled 0
|
||||
vdump $imagedir/${casename}_pbr.png
|
33
tests/opengl/data/general/bug25679
Normal file
33
tests/opengl/data/general/bug25679
Normal file
@@ -0,0 +1,33 @@
|
||||
puts "========"
|
||||
puts "OCC25679: Visualization, TKOpenGl - View frustum culling clips wrong objects"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
set LINES_IN_ROW 50
|
||||
|
||||
set aNoCulling $imagedir/${casename}_without.png
|
||||
set aWithCulling $imagedir/${casename}_with.png
|
||||
set aDiff $imagedir/${casename}_diff.png
|
||||
|
||||
vinit View1
|
||||
|
||||
for {set i 0} {$i < $LINES_IN_ROW} {incr i} {
|
||||
for {set j 0} {$j < $LINES_IN_ROW} {incr j} {
|
||||
set aLineName "line"
|
||||
append aLineName [expr $i * $LINES_IN_ROW + $j]
|
||||
vline $aLineName 0 0 0 1 0 0
|
||||
vsetlocation $aLineName [expr $i * 3] [expr $j * 3] 0
|
||||
}
|
||||
}
|
||||
|
||||
vfit
|
||||
|
||||
vrenderparams -frustumculling on
|
||||
vdump $aWithCulling
|
||||
vrenderparams -frustumculling off
|
||||
vdump $aNoCulling
|
||||
|
||||
set aDiffRes [diffimage $aWithCulling $aNoCulling 0.1 0 0 $aDiff]
|
||||
if {$aDiffRes != 0} { puts "ERROR : Test failed: there is a difference between images rendered with and without frustum culling" }
|
53
tests/opengl/data/raytrace/bug25201
Normal file
53
tests/opengl/data/raytrace/bug25201
Normal file
@@ -0,0 +1,53 @@
|
||||
puts "========"
|
||||
puts "OCC25201: Visualization - Implementing soft shadows and ambient occlusion in OCCT ray-tracing core"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# custom shapes
|
||||
set aShape1 [locate_data_file occ/Top.brep]
|
||||
set aShape2 [locate_data_file occ/Bottom.brep]
|
||||
|
||||
# setup 3D viewer content
|
||||
vinit name=View1 w=512 h=512
|
||||
vglinfo
|
||||
|
||||
vvbo 0
|
||||
vsetdispmode 1
|
||||
vbackground -gradient B4C8FF B4B4B4 -gradientMode VERTICAL
|
||||
vtextureenv on 4
|
||||
restore $aShape1 s1
|
||||
restore $aShape2 s2
|
||||
vdisplay s1 s2
|
||||
vsetmaterial s1 Gold
|
||||
vsetmaterial s2 Silver
|
||||
vsetlocation s1 0.0 0.1 0.0
|
||||
vlight -change 0 -dir 0.667 -0.667 -0.333 -smoothAngle 6 -intensity 100
|
||||
vturnview 3.0 -1.2 -0.1
|
||||
vfit
|
||||
|
||||
# activate path tracing
|
||||
vrenderparams -raytrace
|
||||
vrenderparams -gi
|
||||
vrenderparams -rayDepth 12
|
||||
|
||||
set aModeNum 0
|
||||
|
||||
vbsdf s1 roughness 6400
|
||||
|
||||
vfps 200
|
||||
vdump $imagedir/${casename}_${aModeNum}.png
|
||||
incr aModeNum
|
||||
|
||||
vsetmaterial s1 glass
|
||||
vbsdf s1 absorpcoeff 1.0
|
||||
|
||||
vfps 200
|
||||
vdump $imagedir/${casename}_${aModeNum}.png
|
||||
incr aModeNum
|
||||
|
||||
vsetmaterial s2 plaster
|
||||
|
||||
vfps 200
|
||||
vdump $imagedir/${casename}_${aModeNum}.png
|
||||
incr aModeNum
|
10
tests/opengl/data/raytrace/dof_mono
Normal file
10
tests/opengl/data/raytrace/dof_mono
Normal file
@@ -0,0 +1,10 @@
|
||||
puts "========"
|
||||
puts "Ray Tracing - check depth-of-field"
|
||||
puts "========"
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_cube.tcl
|
||||
|
||||
vrenderparams -ray -gi -rayDepth 10 -iss
|
||||
vrenderparams -aperture 0.1 -focal 2.0
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}.png
|
16
tests/opengl/data/raytrace/dof_stereo
Normal file
16
tests/opengl/data/raytrace/dof_stereo
Normal file
@@ -0,0 +1,16 @@
|
||||
puts "========"
|
||||
puts "Ray Tracing - check depth-of-field"
|
||||
puts "========"
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_cube.tcl
|
||||
|
||||
vrenderparams -ray -gi -rayDepth 10 -iss
|
||||
vrenderparams -aperture 0.1 -focal 2.0
|
||||
|
||||
# activate stereo
|
||||
vstereo on
|
||||
vstereo -mode anaglyph
|
||||
vcamera -iod 0.1
|
||||
vfit
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}.png -stereo blend
|
34
tests/opengl/data/raytrace/normal_map
Normal file
34
tests/opengl/data/raytrace/normal_map
Normal file
@@ -0,0 +1,34 @@
|
||||
puts "========"
|
||||
puts "0031275: Visualization, TKOpenGl - handle normal-map texture with Path-Tracing"
|
||||
puts "========"
|
||||
|
||||
pload XDE OCAF MODELING VISUALIZATION
|
||||
Close D -silent
|
||||
ReadGltf D [locate_data_file bug31275_SphereWithNormalMap.glb]
|
||||
|
||||
vclear
|
||||
vinit v -w 1024 -h 1024
|
||||
vbackground -cubemap [locate_data_file Circus_CubeMap_V.png]
|
||||
vcamera -persp
|
||||
vlight -clear
|
||||
vlight -add ambient
|
||||
XDisplay -dispmode 1 D
|
||||
vback
|
||||
vfit
|
||||
|
||||
vrenderparams -ignoreNormalMap on
|
||||
vrenderparams -ray -gi -rayDepth 10
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}_without_normal_map.png
|
||||
|
||||
vrenderparams -ignoreNormalMap off
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}_with_normal_map_back.png
|
||||
|
||||
vfront
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}_with_normal_map_front.png
|
||||
|
||||
vlight -add positional -pos 0 0 0 -head 1 -intensity 10
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}_point_light.png
|
43
tests/opengl/data/raytrace/pbr_spheres
Normal file
43
tests/opengl/data/raytrace/pbr_spheres
Normal file
@@ -0,0 +1,43 @@
|
||||
puts "========"
|
||||
puts "0031225: Visualization, TKOpenGl - support cubemap for environment texture within Ray-Tracing"
|
||||
puts "Spheres grid with different roughness values"
|
||||
puts "========"
|
||||
|
||||
cpulimit 600
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/vis_pbr_spheres.tcl
|
||||
|
||||
vrenderparams -ray -gi -rayDepth 10
|
||||
vcamera -ortho
|
||||
vfit
|
||||
vlight -change 1 -intensity 0.0001
|
||||
vfps 200
|
||||
vdump $::imagedir/${::casename}_ortho0.png
|
||||
|
||||
vlight -change 1 -intensity 0.3
|
||||
vfps 200
|
||||
vdump $::imagedir/${::casename}_ortho30.png
|
||||
|
||||
vcamera -persp
|
||||
vfit
|
||||
vlight -change 1 -intensity 0.0001
|
||||
vfps 200
|
||||
vdump $::imagedir/${::casename}_persp0.png
|
||||
|
||||
vlight -change 1 -intensity 0.3
|
||||
vfps 200
|
||||
vdump $::imagedir/${::casename}_persp30.png
|
||||
|
||||
set aCubeMap [locate_data_file Circus_CubeMap_V.png]
|
||||
vlight -change 1 -intensity 1
|
||||
vbackground -cubemap $aCubeMap
|
||||
vcamera -ortho
|
||||
vfps 200
|
||||
vdump $::imagedir/${::casename}_orthoenv.png
|
||||
|
||||
vcamera -persp
|
||||
vfps 200
|
||||
vdump $::imagedir/${::casename}_perspenv.png
|
13
tests/opengl/data/raytrace/sample_ball_alpha
Normal file
13
tests/opengl/data/raytrace/sample_ball_alpha
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "============"
|
||||
puts "Visualization - Path Tracing, Ball sample"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_ball.tcl
|
||||
|
||||
vtexture ball 21 -scale 0.1 0.1
|
||||
vsetmaterial ball plaster
|
||||
vbsdf ball -coatFresnel Constant 0.0
|
||||
|
||||
vfps 100
|
||||
vdump $imagedir/${casename}_zoom.png
|
20
tests/opengl/data/raytrace/sample_ball_iss
Normal file
20
tests/opengl/data/raytrace/sample_ball_iss
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "============"
|
||||
puts "Visualization - Path Tracing, Ball sample (ISS mode)"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
cpulimit 1000
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_ball.tcl
|
||||
|
||||
vrenderparams -iss -nbtiles 64
|
||||
vfps 1024
|
||||
vdump $imagedir/${casename}_iss_64.png
|
||||
|
||||
vrenderparams -iss -nbtiles 256
|
||||
vfps 256
|
||||
vdump $imagedir/${casename}_iss_256.png
|
||||
|
||||
vrenderparams -iss -nbtiles 1024
|
||||
vfps 64
|
||||
vdump $imagedir/${casename}_iss_1024.png
|
13
tests/opengl/data/raytrace/sample_ball_wood
Normal file
13
tests/opengl/data/raytrace/sample_ball_wood
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "============"
|
||||
puts "0031135: Visualization, TKOpenGl - texture sRGB -> linear conversion is applied twice by Path Tracer"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_ball.tcl
|
||||
|
||||
vtexture ball 11 -scale 0.1 0.1
|
||||
vsetmaterial ball plaster
|
||||
vbsdf ball -coatFresnel Constant 0.0
|
||||
|
||||
vfps 100
|
||||
vdump $imagedir/${casename}_zoom.png
|
8
tests/opengl/data/raytrace/sample_cube
Normal file
8
tests/opengl/data/raytrace/sample_cube
Normal file
@@ -0,0 +1,8 @@
|
||||
puts "============"
|
||||
puts "Visualization - Path Tracing, Cube sample"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_cube.tcl
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}.png
|
22
tests/opengl/data/raytrace/sample_cube_clamp
Normal file
22
tests/opengl/data/raytrace/sample_cube_clamp
Normal file
@@ -0,0 +1,22 @@
|
||||
puts "============"
|
||||
puts "Visualization - Path Tracing, Cube sample with radiance clamping"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_cube.tcl
|
||||
|
||||
vrenderparams -maxrad 1.0
|
||||
vfps 100
|
||||
vdump $imagedir/${casename}_1.png
|
||||
|
||||
vrenderparams -maxrad 2.0
|
||||
vfps 100
|
||||
vdump $imagedir/${casename}_2.png
|
||||
|
||||
vrenderparams -maxrad 10.0
|
||||
vfps 100
|
||||
vdump $imagedir/${casename}_10.png
|
||||
|
||||
vrenderparams -maxrad 100.0
|
||||
vfps 100
|
||||
vdump $imagedir/${casename}_100.png
|
19
tests/opengl/data/raytrace/sample_cube_twosided
Normal file
19
tests/opengl/data/raytrace/sample_cube_twosided
Normal file
@@ -0,0 +1,19 @@
|
||||
puts "============"
|
||||
puts "Visualization - Path Tracing, Cube sample"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_cube.tcl
|
||||
|
||||
vaxo
|
||||
vfit
|
||||
vfps 100
|
||||
|
||||
# Dump image produced with one-sided BSDFs
|
||||
vdump $imagedir/${casename}_onesided.png
|
||||
|
||||
vrenderparams -twoside
|
||||
vfps 100
|
||||
|
||||
# Dump image produced with two-sided BSDFs
|
||||
vdump $imagedir/${casename}_twosided.png
|
7
tests/opengl/data/raytrace/sample_materials
Normal file
7
tests/opengl/data/raytrace/sample_materials
Normal file
@@ -0,0 +1,7 @@
|
||||
puts "============"
|
||||
puts "Visualization - Path Tracing, Materials sample"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_materials.tcl
|
||||
vdump $imagedir/${casename}_materials.png
|
14
tests/opengl/data/raytrace/tone_mapping
Normal file
14
tests/opengl/data/raytrace/tone_mapping
Normal file
@@ -0,0 +1,14 @@
|
||||
puts "========"
|
||||
puts "Ray Tracing - check tone mapping"
|
||||
puts "========"
|
||||
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_cube.tcl
|
||||
|
||||
vrenderparams -ray -gi -rayDepth 10 -iss
|
||||
|
||||
vrenderparams -tonemapping filmic
|
||||
vrenderparams -exposure -1.0
|
||||
vrenderparams -whitepoint 7.0
|
||||
vfit
|
||||
vfps 200
|
||||
vdump ${imagedir}/${casename}.png
|
34
tests/opengl/data/shading/pbr_spheres
Normal file
34
tests/opengl/data/shading/pbr_spheres
Normal file
@@ -0,0 +1,34 @@
|
||||
puts "========"
|
||||
puts "0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model"
|
||||
puts "Spheres grid with different roughness values"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/vis_pbr_spheres.tcl
|
||||
|
||||
vcamera -ortho
|
||||
vfit
|
||||
vlight -change 1 -intensity 0.0001
|
||||
vdump $::imagedir/${::casename}_ortho0.png
|
||||
vlight -change 1 -intensity 0.3
|
||||
vdump $::imagedir/${::casename}_ortho30.png
|
||||
vcamera -persp
|
||||
vfit
|
||||
vlight -change 1 -intensity 0.0001
|
||||
vdump $::imagedir/${::casename}_persp0.png
|
||||
vlight -change 1 -intensity 0.3
|
||||
vdump $::imagedir/${::casename}_persp30.png
|
||||
|
||||
set aCubeMap [locate_data_file Circus_CubeMap_V.png]
|
||||
vlight -change 1 -intensity 1
|
||||
vbackground -cubemap $aCubeMap
|
||||
vcamera -ortho
|
||||
vdump $::imagedir/${::casename}_orthoenv.png
|
||||
vcamera -persp
|
||||
vdump $::imagedir/${::casename}_perspenv.png
|
68
tests/opengl/data/shading/shading_models
Normal file
68
tests/opengl/data/shading/shading_models
Normal file
@@ -0,0 +1,68 @@
|
||||
puts "========"
|
||||
puts "Test various Shading Models assigned per-object"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
#if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
||||
|
||||
# setup viewer
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1 -width 912 -height 912
|
||||
|
||||
# define spheres with a rough triangulation to easily distinguish Shading Models
|
||||
psphere p0 10
|
||||
copytranslate p11 p0 0 0 0
|
||||
copytranslate p12 p0 40 0 0
|
||||
copytranslate p21 p0 0 20 0
|
||||
copytranslate p22 p0 40 20 0
|
||||
copytranslate p31 p0 0 40 0
|
||||
copytranslate p32 p0 40 40 0
|
||||
compound p11 p12 p21 p22 p31 p32 ss
|
||||
incmesh ss 1
|
||||
vdefaults -autoTriang 0
|
||||
|
||||
# display objects
|
||||
vdisplay -dispMode 1 p11 p12 p21 p22 p31 p32
|
||||
vdrawparray p41 triangles v 0 55 0 v 0 75 0 v 20 55 0 v 0 55 0 v 0 75 0 v 0 55 20 v 0 55 0 v 0 55 20 v 20 55 0 v 0 75 0 v 0 55 20 v 20 55 0
|
||||
vdrawparray p42 triangles v 40 55 0 v 40 75 0 v 60 55 0 v 40 55 0 v 40 75 0 v 40 55 20 v 40 55 0 v 40 55 20 v 60 55 0 v 40 75 0 v 40 55 20 v 60 55 0
|
||||
vtop
|
||||
vrotate -0.9 0.1 0
|
||||
vfit
|
||||
|
||||
vcaps -ffp 1
|
||||
vdump $::imagedir/${::casename}_defaults_ffp.png
|
||||
|
||||
vcaps -ffp 0
|
||||
vdump $::imagedir/${::casename}_defaults.png
|
||||
|
||||
# customize shading models
|
||||
vaspects p11 -setShadingModel VERTEX
|
||||
vdrawtext t11 Graphic3d_TOSM_VERTEX -pos 10 5 10 -color RED -aspect BOLD
|
||||
vaspects p12 -setShadingModel FRAGMENT
|
||||
vdrawtext t12 Graphic3d_TOSM_FRAGMENT -pos 50 5 10 -color RED -aspect BOLD
|
||||
|
||||
vaspects p21 -setShadingModel PBR
|
||||
vdrawtext t21 Graphic3d_TOSM_PBR -pos 10 25 10 -color RED -aspect BOLD
|
||||
vaspects p22 -setShadingModel PBR_FACET
|
||||
vdrawtext t22 Graphic3d_TOSM_PBR_FACET -pos 50 25 10 -color RED -aspect BOLD
|
||||
|
||||
vaspects p31 -setShadingModel UNLIT
|
||||
vdrawtext t31 Graphic3d_TOSM_UNLIT -pos 10 45 10 -color RED -aspect BOLD
|
||||
vaspects p32 -setShadingModel FACET
|
||||
vdrawtext t32 Graphic3d_TOSM_FACET -pos 50 45 10 -color RED -aspect BOLD
|
||||
vaspects p41 -setShadingModel VERTEX
|
||||
vdrawtext t41 Graphic3d_TOSM_VERTEX -pos 10 65 10 -color RED -aspect BOLD
|
||||
vaspects p42 -setShadingModel FACET
|
||||
vdrawtext t42 Graphic3d_TOSM_FACET -pos 50 65 10 -color RED -aspect BOLD
|
||||
vdisplay -topmost t11 t12 t21 t22 t31 t32 t41 t42
|
||||
|
||||
vcaps -ffp 1
|
||||
vdump $::imagedir/${::casename}_ffp.png
|
||||
|
||||
vcaps -ffp 0
|
||||
vlight -change 1 -intensity 0.1
|
||||
vrenderparams -shadingModel pbr
|
||||
vdump $::imagedir/${::casename}.png
|
36
tests/opengl/data/textures/cubemap_dds
Normal file
36
tests/opengl/data/textures/cubemap_dds
Normal file
@@ -0,0 +1,36 @@
|
||||
puts "============"
|
||||
puts "0031478: Visualization, TKOpenGl - allow uploading Cubemap in compressed DDS format when supported by GPU"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
if { $::tcl_platform(os) == "Darwin" } {
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
vcaps -core
|
||||
}
|
||||
if { [vdriver -default] == "TKOpenGles" } {
|
||||
puts "Skipping test case 'DDS texture': OpenGL ES does not support sRGB S3TC_DXT1 texture format"
|
||||
return
|
||||
}
|
||||
|
||||
set aCubeMapPNG [locate_data_file cubemap_labels.png]
|
||||
set aCubeMapDDS [locate_data_file cubemap_labels.dds]
|
||||
|
||||
box b 1 2 3
|
||||
psphere s 1
|
||||
|
||||
vclear
|
||||
vinit View1 -w 512 -h 512
|
||||
vcamera -fovy 100
|
||||
vzbufftrihedron
|
||||
#vdisplay -dispMode 1 b
|
||||
vdisplay -dispMode 1 s
|
||||
vfit
|
||||
|
||||
vrenderparams -shadingModel pbr
|
||||
vbackground -cubemap $aCubeMapPNG -invertedz
|
||||
vdump $imagedir/${casename}_png.png
|
||||
|
||||
vbackground -cubemap $aCubeMapDDS -invertedz
|
||||
vdump $imagedir/${casename}_dds.png
|
25
tests/opengl/data/textures/cubemap_ibl
Normal file
25
tests/opengl/data/textures/cubemap_ibl
Normal file
@@ -0,0 +1,25 @@
|
||||
puts "============"
|
||||
puts "0032590: Visualization, V3d_View - improve API for setting Image Based Lighting"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
set aCubeMapLabs [locate_data_file cubemap_labels.png]
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/vis_pbr_spheres.tcl
|
||||
vcamera -fovy 100
|
||||
|
||||
vbackground -cubemap $aCubeMapLabs -pbrEnv noIBL
|
||||
vdump $imagedir/${casename}_1.png
|
||||
|
||||
vbackground -pbrEnv IBL
|
||||
vdump $imagedir/${casename}_2.png
|
||||
|
||||
vbackground BLACK -pbrEnv KEEP
|
||||
vdump $imagedir/${casename}_3.png
|
31
tests/opengl/data/textures/pbr_tangent_normal
Normal file
31
tests/opengl/data/textures/pbr_tangent_normal
Normal file
@@ -0,0 +1,31 @@
|
||||
puts "========"
|
||||
puts "0031302: Visualization, TKOpenGl - wrong tangent space calculation for normal maps"
|
||||
puts "Test for tangent space orientation."
|
||||
puts "========"
|
||||
|
||||
pload XDE OCAF MODELING VISUALIZATION
|
||||
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
|
||||
vinit v -w 1024 -h 1024
|
||||
vcamera -persp
|
||||
vbackground -cubemap [locate_data_file Circus_CubeMap_V.png]
|
||||
vrenderparams -shadingModel PBR
|
||||
|
||||
vlight -clear
|
||||
vlight -add ambient
|
||||
|
||||
Close D -silent
|
||||
ReadGltf D [locate_data_file bug31302_NormalTangentTest.gltf]
|
||||
XDisplay -dispmode 1 D
|
||||
|
||||
vfront
|
||||
vfit
|
||||
vdump $imagedir/${casename}_front.png
|
||||
|
||||
vback
|
||||
vdump $imagedir/${casename}_back.png
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user