mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
2 Commits
CR0_IILS_P
...
CR0_CI_740
Author | SHA1 | Date | |
---|---|---|---|
|
29e7bc7067 | ||
|
e104cc79c3 |
@@ -86,8 +86,7 @@ typedef enum
|
||||
MT_BoundaryEdge = 4, //!< Boundary edge (related to a single face)
|
||||
MT_SharedEdge = 5, //!< Shared edge (related to several faces)
|
||||
MT_WireFrameFace = 6, //!< Wireframe face
|
||||
MT_ShadedFace = 7, //!< Shaded face
|
||||
MT_SeamEdge = 8 //!< Seam edge between faces
|
||||
MT_ShadedFace = 7 //!< Shaded face
|
||||
} IVtk_MeshType;
|
||||
|
||||
//! @enum IVtk_DisplayMode Display modes for 3D shapes
|
||||
|
@@ -719,85 +719,6 @@ static Standard_Integer VtkSetDisplayMode (Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : VtkSetBoundaryDraw
|
||||
// Purpose :
|
||||
// Draw args : ivtksetboundingdraw [name] draw on/off(0,1)
|
||||
//================================================================
|
||||
static Standard_Integer VtkSetBoundaryDraw(Draw_Interpretor& theDI,
|
||||
Standard_Integer theArgNum,
|
||||
const char** theArgs)
|
||||
{
|
||||
// Check viewer
|
||||
if (!GetInteractor()->IsEnabled())
|
||||
{
|
||||
theDI << theArgs[0] << " error: call ivtkinit before\n";
|
||||
return 1; // TCL_ERROR
|
||||
}
|
||||
|
||||
// Check arguments
|
||||
if (theArgNum != 2 && theArgNum != 3)
|
||||
{
|
||||
theDI << theArgs[0] << " error: expects 1 or 2 arguments\n";
|
||||
return 1; // TCL_ERROR
|
||||
}
|
||||
|
||||
vtkSmartPointer<vtkActor> anActor;
|
||||
// Set disp mode for all objects
|
||||
if (theArgNum == 2)
|
||||
{
|
||||
// Get mode
|
||||
Standard_Integer toDraw = Draw::Atoi(theArgs[1]);
|
||||
DoubleMapOfActorsAndNames::Iterator anIter(GetMapOfActors());
|
||||
while (anIter.More())
|
||||
{
|
||||
anActor = anIter.Key1();
|
||||
IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource(anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline(anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode(DM_Shading);
|
||||
aFilter->SetFaceBoundaryDraw((toDraw == 0)? false : true);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
anIter.Next();
|
||||
}
|
||||
}
|
||||
// Set disp mode for named object
|
||||
else
|
||||
{
|
||||
Standard_Integer toDraw = atoi(theArgs[2]);
|
||||
TCollection_AsciiString aName = theArgs[1];
|
||||
if (GetMapOfActors().IsBound2(aName))
|
||||
{
|
||||
anActor = GetMapOfActors().Find2(aName);
|
||||
vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc = IVtkTools_ShapeObject::GetShapeSource(anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline(anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode(DM_Shading);
|
||||
aFilter->SetFaceBoundaryDraw((toDraw == 0) ? false : true);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redraw window
|
||||
GetInteractor()->Render();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//================================================================
|
||||
// Function : VtkSetSelectionMode
|
||||
// Purpose :
|
||||
@@ -1277,13 +1198,6 @@ void IVtkDraw::Commands (Draw_Interpretor& theCommands)
|
||||
"if name is not defined.",
|
||||
__FILE__, VtkSetDisplayMode, group);
|
||||
|
||||
theCommands.Add("ivtksetboundingdraw",
|
||||
"ivtksetboundingdraw usage:\n"
|
||||
"ivtksetboundingdraw [name] draw on/off (0,1)"
|
||||
"\n\t\t: Sets or unsets boundaries drawing for shading display mode to the object with name 'name' or to all objects"
|
||||
"if name is not defined.",
|
||||
__FILE__, VtkSetBoundaryDraw, group);
|
||||
|
||||
theCommands.Add("ivtksetselmode",
|
||||
"ivtksetselmode usage:\n"
|
||||
" ivtksetselmode [name] mode on/off(0,1)"
|
||||
|
@@ -180,19 +180,15 @@ void IVtkOCC_ShapeMesher::addEdges()
|
||||
TopAbs_FACE,
|
||||
anEdgesMap);
|
||||
|
||||
TopTools_IndexedMapOfShape anEdgesList;
|
||||
TopExp::MapShapes(GetShapeObj()->GetShape(), TopAbs_EDGE, anEdgesList);
|
||||
|
||||
int aNbFaces;
|
||||
IVtk_MeshType aType;
|
||||
myEdgesTypes.Clear();
|
||||
|
||||
TopTools_IndexedMapOfShape::const_iterator aEdgeIt;
|
||||
for (aEdgeIt = anEdgesList.cbegin(); aEdgeIt != anEdgesList.cend(); aEdgeIt++)
|
||||
TopExp_Explorer anEdgeIter (GetShapeObj()->GetShape(), TopAbs_EDGE);
|
||||
for (; anEdgeIter.More(); anEdgeIter.Next())
|
||||
{
|
||||
const TopoDS_Edge& anOcctEdge = TopoDS::Edge (*aEdgeIt);
|
||||
const TopTools_ListOfShape& aFaceList = anEdgesMap.FindFromKey(anOcctEdge);
|
||||
aNbFaces = aFaceList.Extent();
|
||||
const TopoDS_Edge& anOcctEdge = TopoDS::Edge (anEdgeIter.Current());
|
||||
aNbFaces = anEdgesMap.FindFromKey (anOcctEdge).Extent();
|
||||
if (aNbFaces == 0)
|
||||
{
|
||||
aType = MT_FreeEdge;
|
||||
@@ -203,21 +199,7 @@ void IVtkOCC_ShapeMesher::addEdges()
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isSame = false;
|
||||
TopTools_ListOfShape::const_iterator aFaceIt;
|
||||
for (aFaceIt = aFaceList.cbegin(); aFaceIt != aFaceList.cend(); aFaceIt++) {
|
||||
TopExp_Explorer aIt((*aFaceIt), TopAbs_EDGE);
|
||||
int aCount = 0;
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
if (aIt.Current().IsSame(anOcctEdge))
|
||||
aCount++;
|
||||
}
|
||||
if (aCount == 2) {
|
||||
isSame = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
aType = isSame? MT_SeamEdge : MT_SharedEdge;
|
||||
aType = MT_SharedEdge;
|
||||
}
|
||||
addEdge (anOcctEdge, GetShapeObj()->GetSubShapeId (anOcctEdge), aType);
|
||||
myEdgesTypes.Bind (anOcctEdge, aType);
|
||||
|
@@ -35,8 +35,7 @@ vtkStandardNewMacro(IVtkTools_DisplayModeFilter)
|
||||
//============================================================================
|
||||
IVtkTools_DisplayModeFilter::IVtkTools_DisplayModeFilter()
|
||||
: myDisplayMode (DM_Wireframe),
|
||||
myDoDisplaySharedVertices (false),
|
||||
myDrawFaceBoundaries( false )
|
||||
myDoDisplaySharedVertices (false)
|
||||
{
|
||||
// Filter according to values in subshapes types array.
|
||||
myIdsArrayName = IVtkVTK_ShapeData::ARRNAME_MESH_TYPES();
|
||||
@@ -48,16 +47,15 @@ IVtkTools_DisplayModeFilter::IVtkTools_DisplayModeFilter()
|
||||
aTypes.Add (MT_FreeEdge);
|
||||
aTypes.Add (MT_BoundaryEdge);
|
||||
aTypes.Add (MT_SharedEdge);
|
||||
aTypes.Add (MT_SeamEdge);
|
||||
aTypes.Add (MT_WireFrameFace);
|
||||
|
||||
myModesDefinition[DM_Wireframe] = aTypes;
|
||||
myModesDefinition.Bind (DM_Wireframe, aTypes);
|
||||
|
||||
aTypes.Clear();
|
||||
aTypes.Add (MT_FreeVertex);
|
||||
aTypes.Add (MT_ShadedFace);
|
||||
|
||||
myModesDefinition[DM_Shading] = aTypes;
|
||||
myModesDefinition.Bind (DM_Shading, aTypes);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@@ -75,7 +73,7 @@ int IVtkTools_DisplayModeFilter::RequestData (vtkInformation *theRequest,
|
||||
vtkInformationVector **theInputVector,
|
||||
vtkInformationVector *theOutputVector)
|
||||
{
|
||||
SetData (myModesDefinition[myDisplayMode]);
|
||||
SetData (myModesDefinition.Find (myDisplayMode));
|
||||
return Superclass::RequestData (theRequest, theInputVector, theOutputVector);
|
||||
}
|
||||
|
||||
@@ -106,20 +104,24 @@ void IVtkTools_DisplayModeFilter::SetDisplaySharedVertices (const bool theDoDisp
|
||||
if (myDoDisplaySharedVertices != theDoDisplay)
|
||||
{
|
||||
myDoDisplaySharedVertices = theDoDisplay;
|
||||
vtkIdType aVertexType = MT_SharedVertex;
|
||||
NCollection_DataMap<IVtk_DisplayMode, IVtk_IdTypeMap>::Iterator aModes (myModesDefinition);
|
||||
NCollection_DataMap<IVtk_DisplayMode, IVtk_IdTypeMap> aNewModes;
|
||||
IVtk_IdTypeMap aModeTypes;
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (; aModes.More(); aModes.Next())
|
||||
{
|
||||
aModeTypes = myModesDefinition[i];
|
||||
if (theDoDisplay && !aModeTypes.Contains(MT_SharedVertex))
|
||||
aModeTypes = aModes.Value();
|
||||
if (theDoDisplay && !aModeTypes.Contains(aVertexType))
|
||||
{
|
||||
aModeTypes.Add (MT_SharedVertex);
|
||||
aModeTypes.Add (aVertexType);
|
||||
}
|
||||
else if (!theDoDisplay && aModeTypes.Contains (MT_SharedVertex))
|
||||
else if (!theDoDisplay && aModeTypes.Contains (aVertexType))
|
||||
{
|
||||
aModeTypes.Remove (MT_SharedVertex);
|
||||
aModeTypes.Remove (aVertexType);
|
||||
}
|
||||
myModesDefinition[i] = aModeTypes;
|
||||
aNewModes.Bind (aModes.Key(), aModeTypes);
|
||||
}
|
||||
myModesDefinition = aNewModes;
|
||||
Modified();
|
||||
}
|
||||
}
|
||||
@@ -146,42 +148,3 @@ IVtk_DisplayMode IVtkTools_DisplayModeFilter::GetDisplayMode () const
|
||||
return myDisplayMode;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: meshTypesForMode
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
const IVtk_IdTypeMap& IVtkTools_DisplayModeFilter::MeshTypesForMode(IVtk_DisplayMode theMode) const
|
||||
{
|
||||
return myModesDefinition[theMode];
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: setMeshTypesForMode
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
void IVtkTools_DisplayModeFilter::SetMeshTypesForMode(IVtk_DisplayMode theMode, const IVtk_IdTypeMap& theMeshTypes)
|
||||
{
|
||||
myModesDefinition[theMode] = theMeshTypes;
|
||||
Modified();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: SetFaceBoundaryDraw
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
void IVtkTools_DisplayModeFilter::SetFaceBoundaryDraw(bool theToDraw)
|
||||
{
|
||||
myDrawFaceBoundaries = theToDraw;
|
||||
if (theToDraw) {
|
||||
myModesDefinition[DM_Shading].Add(MT_BoundaryEdge);
|
||||
myModesDefinition[DM_Shading].Add(MT_SharedEdge);
|
||||
}
|
||||
else {
|
||||
if (myModesDefinition[DM_Shading].Contains(MT_BoundaryEdge))
|
||||
myModesDefinition[DM_Shading].Remove(MT_BoundaryEdge);
|
||||
|
||||
if (myModesDefinition[DM_Shading].Contains(MT_SharedEdge))
|
||||
myModesDefinition[DM_Shading].Remove(MT_SharedEdge);
|
||||
}
|
||||
Modified();
|
||||
}
|
||||
|
@@ -20,15 +20,11 @@
|
||||
#include <IVtkTools_SubPolyDataFilter.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
#include <array>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4251) // avoid warning C4251: "class needs to have dll-interface..."
|
||||
#endif
|
||||
|
||||
typedef std::array<IVtk_IdTypeMap, 2> IVtk_DisplayModeArray;
|
||||
|
||||
//! @class IVtkTools_DisplayModeFilter
|
||||
//! @brief Cells filter according to the selected display mode by mesh parts types.
|
||||
//! This filter is used to get parts of a shape according to different
|
||||
@@ -50,18 +46,6 @@ public:
|
||||
//! Get current display mode.
|
||||
IVtk_DisplayMode GetDisplayMode() const;
|
||||
|
||||
//! Returns list of displaying mesh element types for the given display mode
|
||||
const IVtk_IdTypeMap& MeshTypesForMode(IVtk_DisplayMode theMode) const;
|
||||
|
||||
//! Set a list of displaying mesh element types for the given display mode
|
||||
void SetMeshTypesForMode(IVtk_DisplayMode theMode, const IVtk_IdTypeMap& theMeshTypes);
|
||||
|
||||
//! Draw Boundary of faces for shading mode
|
||||
void SetFaceBoundaryDraw(bool theToDraw);
|
||||
|
||||
//! Returns True if drawing Boundary of faces for shading mode is defined.
|
||||
bool FaceBoundaryDraw() const { return myDrawFaceBoundaries; }
|
||||
|
||||
protected:
|
||||
//! Filter cells according to the given set of ids.
|
||||
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||
@@ -71,10 +55,9 @@ protected:
|
||||
|
||||
protected:
|
||||
//! Display mode defining mesh types to pass through this filter.
|
||||
IVtk_DisplayMode myDisplayMode;
|
||||
IVtk_DisplayModeArray myModesDefinition;
|
||||
bool myDoDisplaySharedVertices;
|
||||
bool myDrawFaceBoundaries;
|
||||
IVtk_DisplayMode myDisplayMode;
|
||||
NCollection_DataMap<IVtk_DisplayMode, IVtk_IdTypeMap> myModesDefinition;
|
||||
bool myDoDisplaySharedVertices;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -25,12 +25,14 @@
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <Extrema_ExtPC2d.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <Geom2dInt_GInter.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_ElementarySurface.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
@@ -281,6 +283,13 @@ Standard_Boolean ShapeFix_ComposeShell::Status (const ShapeExtend_Status status)
|
||||
#define ITP_ENDSEG 32 // stop of tangential segment
|
||||
#define ITP_TANG 64 // tangential point
|
||||
|
||||
enum ShapeFix_MakeCut
|
||||
{
|
||||
ShapeFix_NoCut,
|
||||
ShapeFix_CutHead,
|
||||
ShapeFix_CutTail
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : PointLineDeviation
|
||||
//purpose : auxilary
|
||||
@@ -809,6 +818,7 @@ static Standard_Real GetGridResolution(const Handle(TColStd_HArray1OfReal) Split
|
||||
ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wire,
|
||||
TColStd_SequenceOfInteger& indexes,
|
||||
const TColStd_SequenceOfReal& values,
|
||||
const TopTools_MapOfShape& theVerts,
|
||||
TopTools_SequenceOfShape& vertices,
|
||||
const TColStd_SequenceOfInteger &SegmentCodes,
|
||||
const Standard_Boolean isCutByU,
|
||||
@@ -822,6 +832,7 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
ShapeAnalysis_Edge sae;
|
||||
Standard_Integer start = 1;
|
||||
TopAbs_Orientation anWireOrient = wire.Orientation();
|
||||
Standard_Integer aLastSplitted = 0;
|
||||
gp_Trsf T;
|
||||
if ( ! myLoc.IsIdentity() ) T = myLoc.Inverted().Transformation();
|
||||
|
||||
@@ -837,6 +848,7 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
std::cout << "Error: ShapeFix_ComposeShell::SplitWire: edge dismissed" << std::endl;
|
||||
#endif
|
||||
i--;
|
||||
aLastSplitted = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -855,6 +867,7 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
result.AddEdge ( 0, edge, iumin, iumax, ivmin, ivmax );
|
||||
if(code!=0 || wire.Orientation()!=TopAbs_EXTERNAL) // pdn 0 code handling for extertnal wires
|
||||
DefinePatch ( result, code, isCutByU, cutIndex );
|
||||
aLastSplitted = 0;
|
||||
continue;
|
||||
}
|
||||
//find non-manifold vertices on edge
|
||||
@@ -948,11 +961,14 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
Standard_Integer NbEdgesStart = result.NbEdges();
|
||||
Standard_Boolean splitted = Standard_False;
|
||||
Standard_Real currPar=lastPar; //SK
|
||||
Standard_Integer aCurSplitted = 0;
|
||||
for ( Standard_Integer j = start; j <= stop; prevPar = currPar, j++ ) {
|
||||
if ( ! splitted && j >= stop ) {// no splitting at all
|
||||
// code = SegmentCodes ( j >1 ? j-1 : SegmentCodes.Length() ); // classification code
|
||||
break;
|
||||
}
|
||||
ShapeFix_MakeCut aCutPart = ShapeFix_NoCut;
|
||||
Standard_Boolean isCutChecked = Standard_False;
|
||||
currPar = ( j < stop ? values.Value(j) : lastPar );
|
||||
//fix for case when pcurve is periodic and first parameter of edge is more than 2P
|
||||
//method ShapeBuild_Edge::CopyRanges shift pcurve to range 0-2P and parameters of cutting
|
||||
@@ -985,50 +1001,82 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
currPnt = myGrid->Value ( currPnt2d );
|
||||
if ( currPnt.Distance ( lastVPnt ) <= lastVTol &&
|
||||
lastPnt.Distance ( currPnt ) <= tol &&
|
||||
// Tolerance is increased to prevent degenerated cuts in cases where all vertex
|
||||
// tolerance is covered by distance of the edge curve from vertex point.
|
||||
// Doubled to prevent edge being fully covered by its vertices tolerance (invalid edge).
|
||||
CheckByCurve3d ( lastVPnt, c3d, f3d+(currPar-firstPar)*(l3d-f3d)/span2d,
|
||||
T, lastVTol ) &&
|
||||
lastPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar+lastPar)) ) ) <= tol ) {
|
||||
V = lastV;
|
||||
Standard_Real uRes = myUResolution;
|
||||
Standard_Real vRes = myVResolution;
|
||||
if(isCutByU) {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->UJointValues(),cutIndex)/tol;
|
||||
uRes = Min(myUResolution,gridRes);
|
||||
T, lastVTol + 2 * Precision::Confusion() ) &&
|
||||
lastPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar+lastPar)) ) ) <= tol )
|
||||
{
|
||||
if (theVerts.Contains(lastV))
|
||||
{
|
||||
GeomAdaptor_Curve AC(c3d, currPar, (edge.Orientation() == TopAbs_REVERSED) ? firstPar : lastPar);
|
||||
Standard_Real L = GCPnts_AbscissaPoint::Length(AC, Precision::Confusion());
|
||||
if (L < BRep_Tool::Tolerance(lastV))
|
||||
aCutPart = ShapeFix_CutTail;
|
||||
isCutChecked = Standard_True;
|
||||
}
|
||||
else {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->VJointValues(),cutIndex)/tol;
|
||||
vRes = Min(myVResolution,gridRes);
|
||||
if (aCutPart == ShapeFix_NoCut)
|
||||
{
|
||||
V = lastV;
|
||||
Standard_Real uRes = myUResolution;
|
||||
Standard_Real vRes = myVResolution;
|
||||
if (isCutByU) {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->UJointValues(), cutIndex) / tol;
|
||||
uRes = Min(myUResolution, gridRes);
|
||||
}
|
||||
else {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->VJointValues(), cutIndex) / tol;
|
||||
vRes = Min(myVResolution, gridRes);
|
||||
}
|
||||
if (IsCoincided(lastPnt2d, currPnt2d, uRes, vRes, tol) &&
|
||||
IsCoincided(lastPnt2d, C2d->Value(0.5*(currPar + lastPar)), uRes, vRes, tol))
|
||||
{
|
||||
doCut = Standard_False;
|
||||
}
|
||||
}
|
||||
if ( IsCoincided ( lastPnt2d, currPnt2d, uRes, vRes, tol ) &&
|
||||
IsCoincided ( lastPnt2d, C2d->Value(0.5*(currPar+lastPar)), uRes, vRes, tol ) )
|
||||
doCut = Standard_False;
|
||||
}
|
||||
else if ( currPnt.Distance ( prevVPnt ) <= prevVTol &&
|
||||
prevPnt.Distance ( currPnt ) <= tol &&
|
||||
CheckByCurve3d ( prevVPnt, c3d, f3d+(currPar-firstPar)*(l3d-f3d)/span2d,
|
||||
T, prevVTol ) &&
|
||||
prevPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar+prevPar)) ) ) <= tol ) {
|
||||
V = prevV;
|
||||
Standard_Real uRes = myUResolution;
|
||||
Standard_Real vRes = myVResolution;
|
||||
if(isCutByU) {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->UJointValues(),cutIndex)/tol;
|
||||
uRes = Min(myUResolution,gridRes);
|
||||
// Tolerance is increased to prevent degenerated cuts in cases where all vertex
|
||||
// tolerance is covered by distance of the edge curve from vertex point.
|
||||
// Doubled to prevent edge being fully covered by its vertices tolerance (invalid edge).
|
||||
CheckByCurve3d ( prevVPnt, c3d, f3d + (currPar - firstPar)*(l3d - f3d) / span2d,
|
||||
T, prevVTol + 2 * Precision::Confusion()) &&
|
||||
prevPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar + prevPar)) ) ) <= tol )
|
||||
{
|
||||
if (theVerts.Contains(prevV))
|
||||
{
|
||||
GeomAdaptor_Curve AC(c3d, (edge.Orientation() == TopAbs_REVERSED) ? lastPar : firstPar, currPar);
|
||||
Standard_Real L = GCPnts_AbscissaPoint::Length(AC, Precision::Confusion());
|
||||
if (L < BRep_Tool::Tolerance(prevV))
|
||||
aCutPart = ShapeFix_CutHead;
|
||||
isCutChecked = Standard_True;
|
||||
}
|
||||
else {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->VJointValues(),cutIndex)/tol;
|
||||
vRes = Min(myVResolution,gridRes);
|
||||
}
|
||||
if ( IsCoincided ( prevPnt2d, currPnt2d, uRes, vRes, tol ) &&
|
||||
IsCoincided ( prevPnt2d, C2d->Value(0.5*(currPar+prevPar)), uRes, vRes, tol ) ) {
|
||||
vertices.Append ( prevV );
|
||||
code = SegmentCodes ( j ); // classification code - update for next segment
|
||||
continue; // no splitting at this point, go to next one
|
||||
if (aCutPart == ShapeFix_NoCut)
|
||||
{
|
||||
V = prevV;
|
||||
Standard_Real uRes = myUResolution;
|
||||
Standard_Real vRes = myVResolution;
|
||||
if (isCutByU) {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->UJointValues(), cutIndex) / tol;
|
||||
uRes = Min(myUResolution, gridRes);
|
||||
}
|
||||
else {
|
||||
Standard_Real gridRes = GetGridResolution(myGrid->VJointValues(), cutIndex) / tol;
|
||||
vRes = Min(myVResolution, gridRes);
|
||||
}
|
||||
if (IsCoincided(prevPnt2d, currPnt2d, uRes, vRes, tol) &&
|
||||
IsCoincided(prevPnt2d, C2d->Value(0.5*(currPar + prevPar)), uRes, vRes, tol)) {
|
||||
vertices.Append(prevV);
|
||||
code = SegmentCodes(j); // classification code - update for next segment
|
||||
continue; // no splitting at this point, go to next one
|
||||
}
|
||||
}
|
||||
}
|
||||
//:abv 28.05.02: OCC320 Sample_2: if maxtol = 1e-7, the vertex tolerance
|
||||
// is actually ignored - protect against new vertex on degenerated edge
|
||||
else if ( BRep_Tool::Degenerated(edge) && prevV.IsSame(lastV) ) {
|
||||
else if (BRep_Tool::Degenerated(edge) && prevV.IsSame(lastV)) {
|
||||
V = prevV;
|
||||
}
|
||||
}
|
||||
@@ -1039,10 +1087,40 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
if ( V.IsNull() ) {
|
||||
B.MakeVertex ( V, currPnt.Transformed(myLoc.Transformation()), tolEdge );
|
||||
vertices.Append ( V );
|
||||
if (!isCutChecked)
|
||||
{
|
||||
Standard_Real aVTol;
|
||||
if (theVerts.Contains(prevV))
|
||||
{
|
||||
aVTol = BRep_Tool::Tolerance(prevV);
|
||||
if (currPnt.SquareDistance(prevVPnt) < aVTol * aVTol)
|
||||
{
|
||||
GeomAdaptor_Curve AC(c3d, (edge.Orientation() == TopAbs_REVERSED) ? lastPar : firstPar, currPar);
|
||||
Standard_Real L = GCPnts_AbscissaPoint::Length(AC, Precision::Confusion());
|
||||
if (L < aVTol)
|
||||
aCutPart = ShapeFix_CutHead;
|
||||
}
|
||||
}
|
||||
else if (theVerts.Contains(lastV))
|
||||
{
|
||||
aVTol = BRep_Tool::Tolerance(lastV);
|
||||
if (currPnt.SquareDistance(lastVPnt) < aVTol * aVTol)
|
||||
{
|
||||
GeomAdaptor_Curve AC(c3d, currPar, (edge.Orientation() == TopAbs_REVERSED) ? firstPar : lastPar);
|
||||
Standard_Real L = GCPnts_AbscissaPoint::Length(AC, Precision::Confusion());
|
||||
if (L < aVTol)
|
||||
aCutPart = ShapeFix_CutTail;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else adjusted to end, fill all resting vertices
|
||||
else if ( ! doCut ) {
|
||||
for ( ; j < stop; j++ ) vertices.Append ( lastV );
|
||||
for (; j < stop; j++)
|
||||
{
|
||||
vertices.Append(lastV);
|
||||
aCurSplitted++;
|
||||
}
|
||||
if ( ! splitted ) break; // no splitting at all
|
||||
currPar = lastPar;
|
||||
}
|
||||
@@ -1132,8 +1210,21 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
code = ( ( isCutByU == (j == 1) ) ? 1 : 2 );
|
||||
}
|
||||
|
||||
result.AddEdge ( 0, newEdge, iumin, iumax, ivmin, ivmax );
|
||||
DefinePatch ( result, code, isCutByU, cutIndex );
|
||||
if (aCutPart == ShapeFix_CutHead)
|
||||
{
|
||||
V.Orientation(TopAbs_FORWARD);
|
||||
Context()->Replace(prevV, V);
|
||||
// also replce this vertice in the sequence
|
||||
for (Standard_Integer iV = 1; aLastSplitted > 0; aLastSplitted--, iV++)
|
||||
{
|
||||
vertices.ChangeValue(vertices.Length() - iV) = V;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.AddEdge(0, newEdge, iumin, iumax, ivmin, ivmax);
|
||||
DefinePatch(result, code, isCutByU, cutIndex);
|
||||
}
|
||||
|
||||
// Changing prev parameters
|
||||
prevV = V;
|
||||
@@ -1141,8 +1232,16 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
prevVPnt = BRep_Tool::Pnt ( V );
|
||||
prevPnt = currPnt;
|
||||
prevPnt2d = currPnt2d;
|
||||
|
||||
if (aCutPart == ShapeFix_CutTail)
|
||||
{
|
||||
Context()->Replace(lastV, V);
|
||||
for (; j + 1 < stop; j++) vertices.Append(lastV);
|
||||
break;
|
||||
}
|
||||
}
|
||||
start = stop;
|
||||
aLastSplitted = aCurSplitted;
|
||||
|
||||
if ( splitted ) {
|
||||
// record replacement in context
|
||||
@@ -1203,6 +1302,8 @@ Standard_Boolean ShapeFix_ComposeShell::SplitByLine (ShapeFix_WireSegment &wire,
|
||||
TColStd_SequenceOfReal IntEdgePar; // parameter of intersection point on edge
|
||||
TColStd_SequenceOfReal IntLinePar; // parameter of intersection point on line
|
||||
|
||||
TopTools_MapOfShape exactVertices; // vertices that line passes through
|
||||
|
||||
Standard_Boolean isnonmanifold = (wire.Orientation() == TopAbs_INTERNAL);
|
||||
//gka correction for non-manifold vertices SAMTECH
|
||||
if(wire.IsVertex()) {
|
||||
@@ -1319,6 +1420,7 @@ Standard_Boolean ShapeFix_ComposeShell::SplitByLine (ShapeFix_WireSegment &wire,
|
||||
IntLinePar.Append ( ParamPointsOnLine ( pos, prevPos, line ) ); // !! - maybe compute exactly ?
|
||||
IntEdgePar.Append ( isreversed ? l : f );
|
||||
IntEdgeInd.Append ( iedge );
|
||||
exactVertices.Add (sae.FirstVertex(E));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1397,6 +1499,7 @@ Standard_Boolean ShapeFix_ComposeShell::SplitByLine (ShapeFix_WireSegment &wire,
|
||||
IntLinePar.Append ( ParamPointsOnLine ( pos, firstPos, line ) );
|
||||
IntEdgePar.Append ( isreversed ? f : l );
|
||||
IntEdgeInd.Append ( iedge );
|
||||
exactVertices.Add (sae.LastVertex(E));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1534,7 +1637,7 @@ Standard_Boolean ShapeFix_ComposeShell::SplitByLine (ShapeFix_WireSegment &wire,
|
||||
//=======================================
|
||||
// Split edges in the wire by intersection points and fill vertices array
|
||||
TopTools_SequenceOfShape IntVertices;
|
||||
wire = SplitWire ( wire, IntEdgeInd, IntEdgePar, IntVertices,
|
||||
wire = SplitWire ( wire, IntEdgeInd, IntEdgePar, exactVertices, IntVertices,
|
||||
aNewSegCodes, isCutByU, cutIndex );
|
||||
|
||||
// add all data to input arrays
|
||||
@@ -1580,7 +1683,8 @@ void ShapeFix_ComposeShell::SplitByLine (ShapeFix_SequenceOfWireSegment &wires,
|
||||
|
||||
// merge null-length tangential segments into one-point tangencies or intersections
|
||||
for ( i = 1; i < SplitLinePar.Length(); i++ ) {
|
||||
if ( Abs ( SplitLinePar(i+1) - SplitLinePar(i) ) > ::Precision::PConfusion() && !SplitLineVertex(i).IsSame(SplitLineVertex(i+1)) ) continue;
|
||||
Standard_Boolean isSameVertex = SplitLineVertex(i).IsSame(SplitLineVertex(i + 1));
|
||||
if ( Abs ( SplitLinePar(i+1) - SplitLinePar(i) ) > ::Precision::PConfusion() && !isSameVertex) continue;
|
||||
if ( ( SplitLineCode(i) & ITP_ENDSEG &&
|
||||
SplitLineCode(i+1) & ITP_BEGSEG ) ||
|
||||
( SplitLineCode(i) & ITP_BEGSEG &&
|
||||
@@ -1591,6 +1695,17 @@ void ShapeFix_ComposeShell::SplitByLine (ShapeFix_SequenceOfWireSegment &wires,
|
||||
SplitLineCode.Remove(i+1);
|
||||
SplitLineVertex.Remove(i+1);
|
||||
}
|
||||
else if (isSameVertex &&
|
||||
((SplitLineCode (i) & ITP_TANG &&
|
||||
SplitLineCode (i + 1) & ITP_INTER) ||
|
||||
(SplitLineCode (i) & ITP_INTER &&
|
||||
SplitLineCode (i + 1) & ITP_TANG)))
|
||||
{
|
||||
SplitLineCode.SetValue(i, IOR_BOTH | ITP_INTER );
|
||||
SplitLinePar.Remove(i + 1);
|
||||
SplitLineCode.Remove(i + 1);
|
||||
SplitLineVertex.Remove(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// go along line, split it by intersection points and create edges
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
class ShapeExtend_CompositeSurface;
|
||||
class ShapeAnalysis_TransferParameters;
|
||||
class ShapeExtend_WireData;
|
||||
@@ -98,7 +99,10 @@ public:
|
||||
//! Here face defines both set of wires and way of getting
|
||||
//! pcurves. Precision is used (together with tolerance of edges)
|
||||
//! for handling subtle cases, such as tangential intersections.
|
||||
Standard_EXPORT void Init (const Handle(ShapeExtend_CompositeSurface)& Grid, const TopLoc_Location& L, const TopoDS_Face& Face, const Standard_Real Prec);
|
||||
Standard_EXPORT void Init (const Handle(ShapeExtend_CompositeSurface)& Grid,
|
||||
const TopLoc_Location& L,
|
||||
const TopoDS_Face& Face,
|
||||
const Standard_Real Prec);
|
||||
|
||||
//! Returns (modifiable) flag for special 'closed'
|
||||
//! mode which forces ComposeShell to consider
|
||||
@@ -139,7 +143,8 @@ public:
|
||||
//! and all pcurves on the initial (pseudo)face are reassigned to
|
||||
//! that surface. If several wires are one inside another, single
|
||||
//! face is created.
|
||||
Standard_EXPORT void DispatchWires (TopTools_SequenceOfShape& faces, ShapeFix_SequenceOfWireSegment& wires) const;
|
||||
Standard_EXPORT void DispatchWires (TopTools_SequenceOfShape& faces,
|
||||
ShapeFix_SequenceOfWireSegment& wires) const;
|
||||
|
||||
//! Sets tool for transfer parameters from 3d to 2d and vice versa.
|
||||
Standard_EXPORT void SetTransferParamTool (const Handle(ShapeAnalysis_TransferParameters)& TransferParam);
|
||||
@@ -165,7 +170,13 @@ protected:
|
||||
//! between two intersections: tells if segment is on left or right side
|
||||
//! of cutting line, or tangent to it (by several points recomputed to 3d,
|
||||
//! distance is compared with tolerance of corresponding edge).
|
||||
Standard_EXPORT Standard_Integer ComputeCode (const Handle(ShapeExtend_WireData)& wire, const gp_Lin2d& line, const Standard_Integer begInd, const Standard_Integer endInd, const Standard_Real begPar, const Standard_Real endPar, const Standard_Boolean IsInternal = Standard_False);
|
||||
Standard_EXPORT Standard_Integer ComputeCode (const Handle(ShapeExtend_WireData)& wire,
|
||||
const gp_Lin2d& line,
|
||||
const Standard_Integer begInd,
|
||||
const Standard_Integer endInd,
|
||||
const Standard_Real begPar,
|
||||
const Standard_Real endPar,
|
||||
const Standard_Boolean IsInternal = Standard_False);
|
||||
|
||||
//! Splits edges in the wire by given indices of edges and
|
||||
//! parameters on them. Returns resulting wire and vertices
|
||||
@@ -178,7 +189,14 @@ protected:
|
||||
//! NOTE: If edge is splitted, it is replaced by wire, and
|
||||
//! order of edges in the wire corresponds to FORWARD orientation
|
||||
//! of the edge.
|
||||
Standard_EXPORT ShapeFix_WireSegment SplitWire (ShapeFix_WireSegment& wire, TColStd_SequenceOfInteger& indexes, const TColStd_SequenceOfReal& values, TopTools_SequenceOfShape& vertices, const TColStd_SequenceOfInteger& segcodes, const Standard_Boolean cutbyu, const Standard_Integer cutindex);
|
||||
Standard_EXPORT ShapeFix_WireSegment SplitWire (ShapeFix_WireSegment& wire,
|
||||
TColStd_SequenceOfInteger& indexes,
|
||||
const TColStd_SequenceOfReal& values,
|
||||
const TopTools_MapOfShape& theVerts,
|
||||
TopTools_SequenceOfShape& vertices,
|
||||
const TColStd_SequenceOfInteger& segcodes,
|
||||
const Standard_Boolean cutbyu,
|
||||
const Standard_Integer cutindex);
|
||||
|
||||
//! Split edges in the wire by cutting line.
|
||||
//! Wires with FORWARD or REVERSED orientation are considered
|
||||
@@ -191,7 +209,13 @@ protected:
|
||||
//! Method fills sequences of parameters of intersection points
|
||||
//! of cutting line with all edges, their types, and corresponding
|
||||
//! vertices (including ones created during splitting edges).
|
||||
Standard_EXPORT Standard_Boolean SplitByLine (ShapeFix_WireSegment& wire, const gp_Lin2d& line, const Standard_Boolean cutbyu, const Standard_Integer cutindex, TColStd_SequenceOfReal& SplitLinePar, TColStd_SequenceOfInteger& SplitLineCode, TopTools_SequenceOfShape& SplitLineVertex);
|
||||
Standard_EXPORT Standard_Boolean SplitByLine (ShapeFix_WireSegment& wire,
|
||||
const gp_Lin2d& line,
|
||||
const Standard_Boolean cutbyu,
|
||||
const Standard_Integer cutindex,
|
||||
TColStd_SequenceOfReal& SplitLinePar,
|
||||
TColStd_SequenceOfInteger& SplitLineCode,
|
||||
TopTools_SequenceOfShape& SplitLineVertex);
|
||||
|
||||
//! Split edges in the sequence of wires by cutting line.
|
||||
//! Wires with FORWARD or REVERSED orientation are considered
|
||||
@@ -206,7 +230,10 @@ protected:
|
||||
//! All modifications (splitting) are recorded in context,
|
||||
//! except splitting of wires marked as EXTERNAL
|
||||
//! (they are supposed to be former cutting lines).
|
||||
Standard_EXPORT void SplitByLine (ShapeFix_SequenceOfWireSegment& seqw, const gp_Lin2d& line, const Standard_Boolean cutbyu, const Standard_Integer cutindex);
|
||||
Standard_EXPORT void SplitByLine (ShapeFix_SequenceOfWireSegment& seqw,
|
||||
const gp_Lin2d& line,
|
||||
const Standard_Boolean cutbyu,
|
||||
const Standard_Integer cutindex);
|
||||
|
||||
//! Split initial set of (closed) wires by grid of lines corresponding
|
||||
//! to joints between patches on the composite surface.
|
||||
@@ -231,12 +258,15 @@ protected:
|
||||
//! taking EXTERNAL as necessary in fork points. Forks are detected
|
||||
//! by common vertices. In fork point, most left way is seleccted
|
||||
//! among all possible ways.
|
||||
Standard_EXPORT void CollectWires (ShapeFix_SequenceOfWireSegment& wires, ShapeFix_SequenceOfWireSegment& seqw);
|
||||
Standard_EXPORT void CollectWires (ShapeFix_SequenceOfWireSegment& wires,
|
||||
ShapeFix_SequenceOfWireSegment& seqw);
|
||||
|
||||
//! Creates new faces on one path of grid. It dispatches given loops
|
||||
//! (wires) into one or several faces depending on their mutual
|
||||
//! position.
|
||||
Standard_EXPORT void MakeFacesOnPatch (TopTools_SequenceOfShape& faces, const Handle(Geom_Surface)& surf, TopTools_SequenceOfShape& loops) const;
|
||||
Standard_EXPORT void MakeFacesOnPatch (TopTools_SequenceOfShape& faces,
|
||||
const Handle(Geom_Surface)& surf,
|
||||
TopTools_SequenceOfShape& loops) const;
|
||||
|
||||
TopAbs_Orientation myOrient;
|
||||
TopoDS_Shape myResult;
|
||||
|
@@ -64,6 +64,7 @@ math_GaussLeastSquare.lxx
|
||||
math_GaussMultipleIntegration.cxx
|
||||
math_GaussMultipleIntegration.hxx
|
||||
math_GaussMultipleIntegration.lxx
|
||||
math_GaussPoints.hxx
|
||||
math_GaussSetIntegration.cxx
|
||||
math_GaussSetIntegration.hxx
|
||||
math_GaussSetIntegration.lxx
|
||||
|
28
src/math/math_GaussPoints.hxx
Normal file
28
src/math/math_GaussPoints.hxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef math_GaussPoints_HeaderFile
|
||||
#define math_GaussPoints_HeaderFile
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
|
||||
extern const Standard_Real Point[157];
|
||||
extern const Standard_Real Weight[157];
|
||||
|
||||
math_Vector GPoints(const Standard_Integer Index);
|
||||
|
||||
math_Vector GWeights(const Standard_Integer Index);
|
||||
|
||||
#endif
|
@@ -1,5 +1,3 @@
|
||||
puts "TODO All: Faulty shapes in variables faulty_1 to faulty_"
|
||||
|
||||
puts "========"
|
||||
puts "OCC22919"
|
||||
puts "========"
|
||||
|
4
tests/bugs/heal/bug31202
Normal file
4
tests/bugs/heal/bug31202
Normal file
@@ -0,0 +1,4 @@
|
||||
restore [locate_data_file bug31202.brep] shape
|
||||
fixshape result shape 0.000001137 0.0001137
|
||||
checkshape result
|
||||
checknbshapes result -edge 4
|
@@ -1,6 +1,5 @@
|
||||
# !!!! This file is generated automatically, do not edit manually! See end script
|
||||
puts "TODO CR23096 ALL: TPSTAT : Faulty"
|
||||
puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
|
||||
|
||||
|
||||
set filename bm1_sy_exhaust.stp
|
||||
|
@@ -1,19 +0,0 @@
|
||||
puts "============="
|
||||
puts "boundary_draw"
|
||||
puts "============="
|
||||
puts ""
|
||||
#######################################################
|
||||
# Tests boundary draw flag changing in the IVtk view
|
||||
#######################################################
|
||||
|
||||
set anImage1 $imagedir/${casename}_1.png
|
||||
set anImage2 $imagedir/${casename}_2.png
|
||||
|
||||
ivtkinit
|
||||
box b 1 1 1
|
||||
ivtkdisplay b
|
||||
ivtksetboundingdraw 1
|
||||
ivtkdump $anImage1
|
||||
|
||||
ivtksetboundingdraw 0
|
||||
ivtkdump $anImage2
|
Reference in New Issue
Block a user