mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
140
src/BRepMesh/BRepMesh.cdl
Executable file
140
src/BRepMesh/BRepMesh.cdl
Executable file
@@ -0,0 +1,140 @@
|
||||
-- File: BRepMesh.cdl
|
||||
-- Created: Wed Sep 22 17:34:57 1993
|
||||
-- Author: Didier PIFFAULT
|
||||
-- <dpf@zerox>
|
||||
---Copyright: Matra Datavision 1993, 1994
|
||||
|
||||
|
||||
package BRepMesh
|
||||
|
||||
---Purpose: Instantiated package for the class of packages
|
||||
-- MeshAlgo, and so on ...
|
||||
|
||||
---Level : Advanced.
|
||||
-- All methods of all classes will be advanced.
|
||||
|
||||
|
||||
uses Standard,
|
||||
gp,
|
||||
Bnd,
|
||||
TColStd,
|
||||
TColgp,
|
||||
GCPnts,
|
||||
BRepAdaptor,
|
||||
BRepTopAdaptor,
|
||||
MeshDS,
|
||||
MeshAlgo,
|
||||
TCollection,
|
||||
MMgt,
|
||||
TopoDS,
|
||||
TopAbs,
|
||||
TopExp,
|
||||
TopTools,
|
||||
Poly,
|
||||
Geom2d,
|
||||
GeomAbs,
|
||||
GeomAdaptor
|
||||
|
||||
|
||||
is
|
||||
|
||||
enumeration Status is
|
||||
---Purpose: Discribes the wires discretisation.
|
||||
NoError,
|
||||
OpenWire,
|
||||
SelfIntersectingWire,
|
||||
Failure,
|
||||
ReMesh
|
||||
|
||||
end Status;
|
||||
|
||||
enumeration FactoryError is
|
||||
FE_NOERROR,
|
||||
FE_LIBRARYNOTFOUND,
|
||||
FE_FUNCTIONNOTFOUND,
|
||||
FE_CANNOTCREATEALGO
|
||||
end FactoryError;
|
||||
|
||||
class Vertex;
|
||||
|
||||
class Edge;
|
||||
|
||||
class Triangle;
|
||||
|
||||
class ShapeTool;
|
||||
|
||||
deferred class DiscretRoot;
|
||||
class DiscretFactory;
|
||||
--
|
||||
pointer PDiscretRoot to DiscretRoot from BRepMesh;
|
||||
--
|
||||
|
||||
class Delaun instantiates Delaunay from MeshAlgo(Vertex from BRepMesh,
|
||||
Edge from BRepMesh,
|
||||
Triangle from BRepMesh);
|
||||
|
||||
class DataMapOfVertexInteger instantiates DataMap from TCollection
|
||||
(Vertex from TopoDS, Integer from Standard, ShapeMapHasher from TopTools);
|
||||
|
||||
class ListOfVertex instantiates List from TCollection
|
||||
(Vertex from BRepMesh);
|
||||
|
||||
class ListOfXY instantiates List from TCollection (XY from gp);
|
||||
|
||||
class DataMapOfIntegerListOfXY instantiates DataMap from TCollection
|
||||
(Integer from Standard, ListOfXY from BRepMesh, MapIntegerHasher from TColStd);
|
||||
|
||||
|
||||
class VertexHasher instantiates MapHasher from TCollection(Vertex from BRepMesh);
|
||||
|
||||
class IndexedMapOfVertex instantiates IndexedMap from TCollection
|
||||
(Vertex from BRepMesh, VertexHasher from BRepMesh);
|
||||
|
||||
|
||||
class DataMapOfShapeReal instantiates DataMap from TCollection
|
||||
(Shape from TopoDS,
|
||||
Real from Standard,
|
||||
ShapeMapHasher from TopTools);
|
||||
|
||||
class BiPoint;
|
||||
|
||||
class Array1OfBiPoint instantiates Array1 from TCollection
|
||||
(BiPoint from BRepMesh);
|
||||
|
||||
class FastDiscret;
|
||||
|
||||
class FaceAttribute;
|
||||
|
||||
class DataMapOfFaceAttribute instantiates DataMap from TCollection
|
||||
(Face from TopoDS,
|
||||
FaceAttribute from BRepMesh,
|
||||
ShapeMapHasher from TopTools);
|
||||
|
||||
private class FastDiscretFace;
|
||||
|
||||
private class Classifier;
|
||||
imported ClassifierPtr; -- smart pointer on Classifier
|
||||
|
||||
class IncrementalMesh from BRepMesh;
|
||||
---Purpose: meshes faces from a Shape only if necessary.
|
||||
|
||||
---- classes moved from MeshShape
|
||||
class GeomTool;
|
||||
|
||||
class DataMapOfIntegerPnt instantiates
|
||||
DataMap from TCollection (Integer from Standard,
|
||||
Pnt from gp,
|
||||
MapIntegerHasher from TColStd);
|
||||
|
||||
class PairOfPolygon;
|
||||
|
||||
class DataMapOfShapePairOfPolygon instantiates
|
||||
DataMap from TCollection(Shape from TopoDS,
|
||||
PairOfPolygon from BRepMesh,
|
||||
ShapeMapHasher from TopTools);
|
||||
|
||||
Mesh(S: Shape from TopoDS; d: Real from Standard);
|
||||
---Purpose: call to incremental mesh.
|
||||
|
||||
|
||||
end BRepMesh;
|
17
src/BRepMesh/BRepMesh.cxx
Executable file
17
src/BRepMesh/BRepMesh.cxx
Executable file
@@ -0,0 +1,17 @@
|
||||
// File: BRepMesh.cxx
|
||||
// Created: Wed Aug 7 10:19:24 1996
|
||||
// Author: Laurent PAINNOT
|
||||
// <lpa@penox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BRepMesh.ixx>
|
||||
#include <BRepMesh_IncrementalMesh.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
|
||||
void BRepMesh::Mesh(const TopoDS_Shape& S,
|
||||
const Standard_Real d)
|
||||
{
|
||||
BRepMesh_IncrementalMesh M(S, d);
|
||||
|
||||
}
|
34
src/BRepMesh/BRepMesh_BiPoint.cdl
Executable file
34
src/BRepMesh/BRepMesh_BiPoint.cdl
Executable file
@@ -0,0 +1,34 @@
|
||||
-- File: BRepMesh_BiPoint.cdl
|
||||
-- Created: Thu Sep 18 10:33:17 1997
|
||||
-- Author: Christophe MARION
|
||||
-- <cma@partox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
class BiPoint from BRepMesh
|
||||
|
||||
uses
|
||||
Address from Standard,
|
||||
Real from Standard,
|
||||
Integer from Standard
|
||||
|
||||
is
|
||||
Create
|
||||
returns BiPoint from BRepMesh;
|
||||
---C++: inline
|
||||
|
||||
Create(X1,Y1,X2,Y2 : Real from Standard)
|
||||
returns BiPoint from BRepMesh;
|
||||
|
||||
Indices(me) returns Address from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Coordinates(me) returns Address from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
myIndices : Integer from Standard[2];
|
||||
myCoordinates : Real from Standard[6];
|
||||
|
||||
end BiPoint;
|
35
src/BRepMesh/BRepMesh_BiPoint.cxx
Executable file
35
src/BRepMesh/BRepMesh_BiPoint.cxx
Executable file
@@ -0,0 +1,35 @@
|
||||
// File: BRepMesh_BiPoint.cxx
|
||||
// Created: Thu Sep 18 10:34:24 1997
|
||||
// Author: Christophe MARION
|
||||
// <cma@partox.paris1.matra-dtv.fr>
|
||||
|
||||
//#define No_Exception
|
||||
|
||||
#include <BRepMesh_BiPoint.ixx>
|
||||
|
||||
#define PntX1 myCoordinates[0]
|
||||
#define PntY1 myCoordinates[1]
|
||||
#define PntX2 myCoordinates[2]
|
||||
#define PntY2 myCoordinates[3]
|
||||
#define VectX myCoordinates[4]
|
||||
#define VectY myCoordinates[5]
|
||||
|
||||
#define MinSg myIndices[0]
|
||||
#define MaxSg myIndices[1]
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_BiPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepMesh_BiPoint::BRepMesh_BiPoint (const Standard_Real X1,
|
||||
const Standard_Real Y1,
|
||||
const Standard_Real X2,
|
||||
const Standard_Real Y2)
|
||||
{
|
||||
PntX1 = X1;
|
||||
PntY1 = Y1;
|
||||
PntX2 = X2;
|
||||
PntY2 = Y2;
|
||||
}
|
||||
|
30
src/BRepMesh/BRepMesh_BiPoint.lxx
Executable file
30
src/BRepMesh/BRepMesh_BiPoint.lxx
Executable file
@@ -0,0 +1,30 @@
|
||||
// File: BRepMesh_BiPoint.lxx
|
||||
// Created: Thu Sep 18 10:33:49 1997
|
||||
// Author: Christophe MARION
|
||||
// <cma@partox.paris1.matra-dtv.fr>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_BiPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline BRepMesh_BiPoint::BRepMesh_BiPoint ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Indices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Address BRepMesh_BiPoint::Indices () const
|
||||
{ return (Standard_Address)myIndices; }
|
||||
|
||||
//=======================================================================
|
||||
//function : Coordinates
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Address BRepMesh_BiPoint::Coordinates () const
|
||||
{ return (Standard_Address)myCoordinates; }
|
||||
|
9
src/BRepMesh/BRepMesh_CMPLRS.edl
Executable file
9
src/BRepMesh/BRepMesh_CMPLRS.edl
Executable file
@@ -0,0 +1,9 @@
|
||||
@ifnotdefined (%BRepMesh_CMPLRS_EDL) then
|
||||
|
||||
@set %BRepMesh_CMPLRS_EDL="";
|
||||
|
||||
@if ( %Station != "sun" ) then
|
||||
@string %CMPLRS_CXX_INCLUDE = %CMPLRS_CXX_INCLUDE %CSF_TBB_INCLUDES;
|
||||
@endif;
|
||||
|
||||
@endif;
|
81
src/BRepMesh/BRepMesh_Classifier.cdl
Executable file
81
src/BRepMesh/BRepMesh_Classifier.cdl
Executable file
@@ -0,0 +1,81 @@
|
||||
-- File: BRepMesh_Classifier.cdl
|
||||
-- Created: Thu Jun 26 11:38:02 1997
|
||||
-- Author: Laurent PAINNOT
|
||||
-- <lpa@penox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
private class Classifier from BRepMesh
|
||||
|
||||
|
||||
|
||||
uses
|
||||
Pnt2d from gp,
|
||||
SequenceOfPnt2d from TColgp,
|
||||
Face from TopoDS,
|
||||
State from TopAbs,
|
||||
SequenceOfInteger from TColStd,
|
||||
SeqOfPtr from BRepTopAdaptor,
|
||||
DataMapOfShapePairOfPolygon from BRepMesh,
|
||||
IndexedMapOfInteger from TColStd,
|
||||
IndexedMapOfVertex from BRepMesh,
|
||||
Status from BRepMesh,
|
||||
DataStructureOfDelaun from BRepMesh
|
||||
|
||||
is
|
||||
|
||||
Create (F : Face from TopoDS;
|
||||
Tol : Real from Standard;
|
||||
edges : DataMapOfShapePairOfPolygon from BRepMesh;
|
||||
themap : IndexedMapOfInteger from TColStd;
|
||||
Str : IndexedMapOfVertex from BRepMesh;
|
||||
Umin, Umax, Vmin, Vmax: Real from Standard)
|
||||
returns Classifier from BRepMesh;
|
||||
|
||||
|
||||
Create (F : Face from TopoDS;
|
||||
Tol : Real from Standard;
|
||||
edges : DataMapOfShapePairOfPolygon from BRepMesh;
|
||||
themap : IndexedMapOfInteger from TColStd;
|
||||
Str : DataStructureOfDelaun from BRepMesh;
|
||||
Umin, Umax, Vmin, Vmax: Real from Standard)
|
||||
returns Classifier from BRepMesh;
|
||||
|
||||
|
||||
Perform(me; Puv: Pnt2d from gp)
|
||||
returns State from TopAbs;
|
||||
|
||||
|
||||
State (me)
|
||||
returns Status from BRepMesh;
|
||||
---C++: inline
|
||||
|
||||
NaturalRestriction(me)
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
Destroy(me: in out);
|
||||
---C++: alias ~
|
||||
|
||||
|
||||
AnalizeWire (me: in out; theSeqPnt2d : in SequenceOfPnt2d from TColgp;
|
||||
Umin, Umax, Vmin, Vmax: in Real from Standard)
|
||||
is private;
|
||||
-- Private method called from constructor after some (piece of) wire
|
||||
-- has been explored and put into <theSeqPnt2d>.
|
||||
-- Here it is triangulated if it is a hole and anyway added to the bulk.
|
||||
|
||||
fields
|
||||
|
||||
TabClass : SeqOfPtr from BRepTopAdaptor;
|
||||
TabOrien : SequenceOfInteger from TColStd;
|
||||
Toluv : Real from Standard;
|
||||
Face : Face from TopoDS;
|
||||
U1 : Real from Standard;
|
||||
V1 : Real from Standard;
|
||||
U2 : Real from Standard;
|
||||
V2 : Real from Standard;
|
||||
myState : Status from BRepMesh;
|
||||
isnatural : Boolean from Standard;
|
||||
|
||||
end Classifier from BRepMesh;
|
852
src/BRepMesh/BRepMesh_Classifier.cxx
Executable file
852
src/BRepMesh/BRepMesh_Classifier.cxx
Executable file
@@ -0,0 +1,852 @@
|
||||
// File: BRepMesh_Classifier.cxx
|
||||
// Created: Thu Jun 26 14:54:02 1997
|
||||
// Author: Laurent PAINNOT
|
||||
// <lpa@penox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BRepMesh_Classifier.ixx>
|
||||
|
||||
// Kernel
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <TColStd_ListOfTransient.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_DataMapOfIntegerInteger.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
// Geometry
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <Geom2dInt_Geom2dCurveTool.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
// Topology
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <CSLib_Class2d.hxx>
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
// BRepMesh
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
#include <BRepMesh_Array1OfBiPoint.hxx>
|
||||
#include <BRepMesh_PairOfPolygon.hxx>
|
||||
|
||||
#ifdef DEB_MESH
|
||||
static Standard_Integer debwire;
|
||||
static Standard_Integer debedge;
|
||||
static Standard_Integer debclass = 0;
|
||||
#endif
|
||||
static const Standard_Real MIN_DIST = 2.E-5; //EPA: real mesh is created in the grid 10E5x10E5, so intersection should be cheched
|
||||
// with double of discretization.
|
||||
static const Standard_Real PARALL_COND = Sin(PI/3.0);
|
||||
static const Standard_Real RESOLUTION = 1.0E-16; //OCC319
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean IsLine(const Handle(Geom2d_Curve)& C2d)
|
||||
{
|
||||
Standard_Boolean IsALine = Standard_False;
|
||||
if ( C2d->IsKind(STANDARD_TYPE(Geom2d_Line)) )
|
||||
{
|
||||
IsALine = Standard_True;
|
||||
}
|
||||
else if ( C2d->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve)) )
|
||||
{
|
||||
Handle(Geom2d_BSplineCurve) BS = *((Handle(Geom2d_BSplineCurve)*)&C2d);
|
||||
IsALine = (BS->NbPoles() == 2);
|
||||
}
|
||||
else if ( C2d->IsKind(STANDARD_TYPE(Geom2d_BezierCurve)) )
|
||||
{
|
||||
Handle(Geom2d_BezierCurve) Bz = *((Handle(Geom2d_BezierCurve)*)&C2d);
|
||||
IsALine = (Bz->NbPoles() == 2);
|
||||
}
|
||||
else if ( C2d->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)) )
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) Curv = *((Handle(Geom2d_TrimmedCurve)*)&C2d);
|
||||
IsALine = IsLine(Curv->BasisCurve());
|
||||
}
|
||||
return IsALine;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AnalizeWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepMesh_Classifier::AnalizeWire (const TColgp_SequenceOfPnt2d& theSeqPnt2d,
|
||||
const Standard_Real Umin, const Standard_Real Umax,
|
||||
const Standard_Real Vmin, const Standard_Real Vmax)
|
||||
{
|
||||
const Standard_Integer nbpnts = theSeqPnt2d.Length();
|
||||
if (nbpnts < 2) return;
|
||||
|
||||
// Accumulate angle
|
||||
TColgp_Array1OfPnt2d PClass(1,nbpnts);
|
||||
Standard_Integer i, ii;
|
||||
Standard_Real theangle = 0.0;
|
||||
gp_Pnt2d p1 = theSeqPnt2d(1), p2 = theSeqPnt2d(2), p3;
|
||||
PClass(1) = p1;
|
||||
PClass(2) = p2;
|
||||
for (i = 1; i <= nbpnts; i++)
|
||||
{
|
||||
ii = i + 2;
|
||||
if (ii > nbpnts)
|
||||
{
|
||||
p3 = PClass(ii-nbpnts);
|
||||
}
|
||||
else
|
||||
{
|
||||
p3 = theSeqPnt2d.Value(ii);
|
||||
PClass(ii) = p3;
|
||||
}
|
||||
gp_Vec2d A(p1,p2), B(p2,p3);
|
||||
if (A.SquareMagnitude() > 1.e-16 && B.SquareMagnitude() > 1.e-16)
|
||||
{
|
||||
const Standard_Real a = A.Angle(B);
|
||||
const Standard_Real aa = Abs(a);
|
||||
// Check if vectors are opposite
|
||||
if (aa > Precision::Angular() && (PI - aa) > Precision::Angular())
|
||||
{
|
||||
theangle += a;
|
||||
p1 = p2;
|
||||
}
|
||||
}
|
||||
p2 = p3;
|
||||
}
|
||||
// Check for zero angle - treat self intersecting wire as outer
|
||||
if (Abs(theangle) < Precision::Angular()) theangle = 0.0;
|
||||
|
||||
TabClass.Append((void *)new CSLib_Class2d(PClass,Toluv,Toluv,Umin,Vmin,Umax,Vmax));
|
||||
TabOrien.Append((theangle < 0.0) ? 0 : 1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_Classifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
||||
const Standard_Real TolUV,
|
||||
const BRepMesh_DataMapOfShapePairOfPolygon& edges,
|
||||
const TColStd_IndexedMapOfInteger& themap,
|
||||
const BRepMesh_IndexedMapOfVertex& Str,
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Umax,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vmax):
|
||||
Toluv(TolUV), Face(aFace),
|
||||
myState(BRepMesh_NoError),
|
||||
isnatural(Standard_False)
|
||||
{
|
||||
//-- impasse sur les surfs definies sur plus d une periode
|
||||
|
||||
//-- once definition
|
||||
Face.Orientation(TopAbs_FORWARD);
|
||||
|
||||
TopoDS_Edge edge;
|
||||
BRepTools_WireExplorer WireExplorer;
|
||||
//TopExp_Explorer FaceExplorer;
|
||||
TopoDS_Iterator FaceExplorer;
|
||||
|
||||
TColgp_SequenceOfPnt2d aWirePoints, aWire;
|
||||
TColStd_SequenceOfInteger aWireLength;
|
||||
|
||||
|
||||
//-- twice definitions
|
||||
TopAbs_Orientation anOr = TopAbs_FORWARD;
|
||||
Standard_Boolean falsewire = Standard_False;
|
||||
Standard_Integer i, index, firstindex = 0, lastindex = 0, nbedges = 0;
|
||||
#ifdef DEB_MESH
|
||||
debwire = 0;
|
||||
#endif
|
||||
|
||||
for(FaceExplorer.Initialize(Face); FaceExplorer.More(); FaceExplorer.Next())
|
||||
{
|
||||
#ifdef DEB_MESH
|
||||
if (debclass) { debwire++; cout <<endl; cout << "#wire no "<<debwire; debedge = 0;}
|
||||
#endif
|
||||
if(FaceExplorer.Value().ShapeType() != TopAbs_WIRE)
|
||||
continue;
|
||||
// For each wire we create a data map, linking vertices (only
|
||||
// the ends of edges) with their positions in the sequence of
|
||||
// all 2d points from this wire.
|
||||
// When we meet some vertex for the second time - the piece
|
||||
// of sequence is treated for a HOLE and quits the sequence.
|
||||
// Actually, we must unbind the vertices belonging to the
|
||||
// loop from the map, but since they can't appear twice on the
|
||||
// valid wire, leave them for a little speed up.
|
||||
nbedges = 0;
|
||||
TColgp_SequenceOfPnt2d SeqPnt2d;
|
||||
TColStd_DataMapOfIntegerInteger NodeInSeq;
|
||||
// Start traversing the wire
|
||||
for (WireExplorer.Init(TopoDS::Wire(FaceExplorer.Value()),Face); WireExplorer.More(); WireExplorer.Next())
|
||||
{
|
||||
edge = WireExplorer.Current();
|
||||
#ifdef DEB_MESH
|
||||
if (debclass) { debedge++; cout << endl; cout << "#edge no "<<debedge <<endl;}
|
||||
#endif
|
||||
anOr = edge.Orientation();
|
||||
if (anOr != TopAbs_FORWARD && anOr != TopAbs_REVERSED) continue;
|
||||
if (edges.IsBound(edge))
|
||||
{
|
||||
// Retrieve polygon
|
||||
// Define the direction for adding points to SeqPnt2d
|
||||
Standard_Integer iFirst,iLast,iIncr;
|
||||
const BRepMesh_PairOfPolygon& pair = edges.Find(edge);
|
||||
Handle(Poly_PolygonOnTriangulation) NOD;
|
||||
if (anOr == TopAbs_FORWARD)
|
||||
{
|
||||
NOD = pair.First();
|
||||
iFirst = 1;
|
||||
iLast = NOD->NbNodes();
|
||||
iIncr = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NOD = pair.Last();
|
||||
iFirst = NOD->NbNodes();
|
||||
iLast = 1;
|
||||
iIncr = -1;
|
||||
}
|
||||
const TColStd_Array1OfInteger& indices = NOD->Nodes();
|
||||
|
||||
// indexFirst and nodeLast are the indices of first and last
|
||||
// vertices of the edge in IndexedMap <Str>
|
||||
const Standard_Integer indexFirst = themap.FindKey(indices(iFirst));
|
||||
const Standard_Integer indexLast = themap.FindKey(indices(iLast));
|
||||
|
||||
// Skip degenerated edge : OCC481(apo)
|
||||
if (indexLast == indexFirst && (iLast-iFirst) == iIncr) continue;
|
||||
|
||||
// If there's a gap between edges -> raise <falsewire> flag
|
||||
if (nbedges)
|
||||
{
|
||||
if (indexFirst != lastindex)
|
||||
{
|
||||
falsewire = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else firstindex = indexFirst;
|
||||
lastindex = indexLast;
|
||||
|
||||
// Record first vertex (to detect loops)
|
||||
NodeInSeq.Bind(indexFirst,SeqPnt2d.Length()+1);
|
||||
|
||||
// Add vertices in sequence
|
||||
for (i = iFirst; i != iLast; i += iIncr)
|
||||
{
|
||||
index = (i == iFirst)? indexFirst : themap.FindKey(indices(i));
|
||||
|
||||
gp_Pnt2d vp(Str(index).Coord());
|
||||
SeqPnt2d.Append(vp);
|
||||
#ifdef DEB_MESH
|
||||
if (debclass) cout<<"point p"<<index<<" "<<vp.X()<<" "<< vp.Y()<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Now, is there a loop?
|
||||
if (NodeInSeq.IsBound(indexLast))
|
||||
{
|
||||
// Yes, treat it separately as a hole
|
||||
// 1. Divide points into main wire and a loop
|
||||
const Standard_Integer iWireStart = NodeInSeq(indexLast);
|
||||
if(iWireStart < SeqPnt2d.Length()) {
|
||||
SeqPnt2d.Split(iWireStart, aWire);
|
||||
//OCC319-> the operation will be done later
|
||||
// 2. Proceed the loop
|
||||
//AnalizeWire(aLoop, Umin, Umax, Vmin, Vmax, aWirePoints, aWireLength, NbBiPoint);
|
||||
aWireLength.Append(aWire.Length());
|
||||
aWirePoints.Append(aWire);
|
||||
//<-OCC319
|
||||
}
|
||||
}
|
||||
|
||||
nbedges++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbedges)
|
||||
{
|
||||
// Isn't it open?
|
||||
if (falsewire || (firstindex != lastindex) || SeqPnt2d.Length() > 1)
|
||||
{
|
||||
myState = BRepMesh_OpenWire;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEB_MESH
|
||||
cout <<"Warning : empty wire" <<endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Check natural restriction
|
||||
const Standard_Integer nbwires = aWireLength.Length();
|
||||
if (nbwires == 1 && nbedges == 4)
|
||||
{
|
||||
Handle(Geom2d_Curve) C2d;
|
||||
Standard_Real pfbid, plbid;
|
||||
isnatural = Standard_True;
|
||||
for(FaceExplorer.Initialize(Face); FaceExplorer.More(); FaceExplorer.Next())
|
||||
{
|
||||
if(FaceExplorer.Value().ShapeType() != TopAbs_WIRE)
|
||||
continue;
|
||||
TopoDS_Iterator aEdgeIt(FaceExplorer.Value());
|
||||
for( ; aEdgeIt.More(); aEdgeIt.Next())
|
||||
{
|
||||
edge = TopoDS::Edge(aEdgeIt.Value());
|
||||
if(anOr == TopAbs_FORWARD || anOr == TopAbs_REVERSED)
|
||||
{
|
||||
C2d = BRep_Tool::CurveOnSurface(edge,Face,pfbid,plbid);
|
||||
//OCC316(APO): if(!IsLine(C2d)) { isnatural = Standard_False; break; }
|
||||
if(!C2d.IsNull() && !IsLine(C2d)) { isnatural = Standard_False; break; }
|
||||
else
|
||||
{ // sont-ce des isos:
|
||||
gp_Pnt2d P1, P2;
|
||||
C2d->D0(pfbid, P1);
|
||||
C2d->D0(plbid, P2);
|
||||
if ((Abs(P1.X()-P2.X()) > 1.e-04) && (Abs(P1.Y()-P2.Y()) > 1.e-04)) { isnatural = Standard_False; break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer NbBiPoint = aWirePoints.Length();
|
||||
BRepMesh_Array1OfBiPoint BiPoints(0,NbBiPoint);
|
||||
|
||||
BRepMesh_BiPoint *BP;
|
||||
Standard_Real *Coordinates1;
|
||||
Standard_Real x1, y1, x2, y2, xstart, ystart;
|
||||
Standard_Integer j, l = 1;
|
||||
BP = &(BiPoints.ChangeValue(1));
|
||||
|
||||
// Fill array of segments (bi-points)
|
||||
for (i = 1; i <= nbwires; i++)
|
||||
{
|
||||
const Standard_Integer len = aWireLength(i) + 1;
|
||||
for (j = 1; j <= len; j++)
|
||||
{
|
||||
// Obtain last point of the segment
|
||||
if (j == len)
|
||||
{
|
||||
x2 = xstart;
|
||||
y2 = ystart;
|
||||
}
|
||||
else
|
||||
{
|
||||
const gp_Pnt2d& PT = aWirePoints(l); l++;
|
||||
x2 = PT.X();
|
||||
y2 = PT.Y();
|
||||
}
|
||||
// Build segment (bi-point)
|
||||
if (j == 1)
|
||||
{
|
||||
xstart = x2;
|
||||
ystart = y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Coordinates1 = ((Standard_Real*)(BP->Coordinates())); BP++;
|
||||
Coordinates1[0] = x1;
|
||||
Coordinates1[1] = y1;
|
||||
Coordinates1[2] = x2;
|
||||
Coordinates1[3] = y2;
|
||||
Coordinates1[4] = x2 - x1;
|
||||
Coordinates1[5] = y2 - y1;
|
||||
}
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real *Coordinates2;
|
||||
Standard_Real A1, B1, C1, A2, B2, C2, AB, BC, CA, xc, yc;
|
||||
Standard_Real mu1, d, mu2;
|
||||
Standard_Integer ik, ikEnd = 0, jk, jkEnd;
|
||||
Standard_Real x11, x12, y11, y12, x21, x22, y21, y22;
|
||||
for(i = 1; i <= nbwires; i++)
|
||||
{
|
||||
ik = ikEnd + 1; ikEnd += aWireLength(i);
|
||||
// Explore first wire
|
||||
for (; ik <= ikEnd; ik++)
|
||||
{
|
||||
Coordinates1 = ((Standard_Real*)(BiPoints.ChangeValue(ik).Coordinates()));
|
||||
x11 = Coordinates1[0];
|
||||
y11 = Coordinates1[1];
|
||||
x12 = Coordinates1[2];
|
||||
y12 = Coordinates1[3];
|
||||
A1 = Coordinates1[5];
|
||||
B1 = -Coordinates1[4];
|
||||
C1 = - x11*A1 - y11*B1;
|
||||
//mu1 = Sqrt(A1*A1+B1*B1);
|
||||
mu1 = A1*A1+B1*B1;
|
||||
for (j = i; j <= nbwires; j++)
|
||||
{
|
||||
//for i==j the algorithm check current wire on selfintersection
|
||||
if (j == i)
|
||||
{
|
||||
jk = ik + 2; jkEnd = ikEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
jk = jkEnd + 1; jkEnd = jk + aWireLength(j) - 1;
|
||||
}
|
||||
// Explore second wire
|
||||
for (; jk <= jkEnd; jk++)
|
||||
{
|
||||
// don't check end's segment of the wire on selfrestriction
|
||||
if (jk == ikEnd) continue;
|
||||
Coordinates2 = ((Standard_Real*)(BiPoints.ChangeValue(jk).Coordinates()));
|
||||
x21 = Coordinates2[0];
|
||||
y21 = Coordinates2[1];
|
||||
x22 = Coordinates2[2];
|
||||
y22 = Coordinates2[3];
|
||||
A2 = Coordinates2[5];
|
||||
B2 = -Coordinates2[4];
|
||||
C2 = - x21*A2 - y21*B2;
|
||||
//mu2 = Sqrt(A2*A2+B2*B2);
|
||||
mu2 = A2*A2+B2*B2;
|
||||
//different segments may have common vertex (see OCC287 bug for example)
|
||||
//if(x22 == x11 && y22 == y11){ myState = BRepMesh_OpenWire; return;}
|
||||
AB = A1*B2 - A2*B1;
|
||||
//check on minimal of distance between current segment and points of another linear segments - OCC319
|
||||
//d = Abs(A1*x22 + B1*y22 + C1);
|
||||
d = A1*x22 + B1*y22 + C1;
|
||||
if(i != j && // if compared wires are different &&
|
||||
AB*AB > PARALL_COND*PARALL_COND*mu1*mu2 && // angle between two segments greater then PARALL_COND &&
|
||||
d*d < MIN_DIST*MIN_DIST*mu1 && // distance between vertex of the segment and other one's less then MIN_DIST
|
||||
(x22-x11)*(x22-x12) < 0.0 && (y22-y11)*(y22-y12) < 0.0)
|
||||
{
|
||||
myState = BRepMesh_SelfIntersectingWire; return;
|
||||
}
|
||||
//look for intersection of two linear segments
|
||||
if(Abs(AB) <= RESOLUTION) continue; //current segments seem parallel - no intersection
|
||||
//calculate coordinates of point of the intersection
|
||||
BC = B1*C2 - B2*C1; xc = BC/AB;
|
||||
CA = C1*A2 - C2*A1; yc = CA/AB;
|
||||
if( Abs(xc-x11) > RESOLUTION && Abs(xc-x12) > RESOLUTION &&
|
||||
Abs(yc-y11) > RESOLUTION && Abs(yc-y12) > RESOLUTION &&
|
||||
Abs(xc-x21) > RESOLUTION && Abs(xc-x22) > RESOLUTION &&
|
||||
Abs(yc-y21) > RESOLUTION && Abs(yc-y22) > RESOLUTION )
|
||||
{
|
||||
//check on belonging of intersection point to the both of segments
|
||||
if((xc-x11)*(xc-x12) < 0.0 && (yc-y11)*(yc-y12) < 0.0 &&
|
||||
(xc-x21)*(xc-x22) < 0.0 && (yc-y21)*(yc-y22) < 0.0)
|
||||
{
|
||||
//different segments may have common vertex (why "<" but "<=")
|
||||
myState = BRepMesh_SelfIntersectingWire; return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find holes
|
||||
for (i = nbwires; i >= 1; i--)
|
||||
{
|
||||
NbBiPoint = aWirePoints.Length() - aWireLength(i) + 1;
|
||||
aWirePoints.Split(NbBiPoint, aWire);
|
||||
AnalizeWire(aWire, Umin, Umax, Vmin, Vmax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Wind code duplication
|
||||
|
||||
BRepMesh_Classifier::BRepMesh_Classifier(const TopoDS_Face& aFace,
|
||||
const Standard_Real TolUV,
|
||||
const BRepMesh_DataMapOfShapePairOfPolygon& edges,
|
||||
const TColStd_IndexedMapOfInteger& themap,
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& Str,
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Umax,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vmax):
|
||||
Toluv(TolUV), Face(aFace),
|
||||
myState(BRepMesh_NoError),
|
||||
isnatural(Standard_False)
|
||||
{
|
||||
//-- impasse sur les surfs definies sur plus d une periode
|
||||
|
||||
//-- once definition
|
||||
Face.Orientation(TopAbs_FORWARD);
|
||||
|
||||
TopoDS_Edge edge;
|
||||
BRepTools_WireExplorer WireExplorer;
|
||||
//TopExp_Explorer FaceExplorer;
|
||||
TopoDS_Iterator FaceExplorer;
|
||||
|
||||
TColgp_SequenceOfPnt2d aWirePoints, aWire;
|
||||
TColStd_SequenceOfInteger aWireLength;
|
||||
|
||||
|
||||
//-- twice definitions
|
||||
TopAbs_Orientation anOr = TopAbs_FORWARD;
|
||||
Standard_Boolean falsewire = Standard_False;
|
||||
Standard_Integer i, index, firstindex = 0, lastindex = 0, nbedges = 0;
|
||||
#ifdef DEB_MESH
|
||||
debwire = 0;
|
||||
#endif
|
||||
|
||||
for(FaceExplorer.Initialize(Face); FaceExplorer.More(); FaceExplorer.Next())
|
||||
{
|
||||
if( FaceExplorer.Value().ShapeType()!= TopAbs_WIRE)
|
||||
continue;
|
||||
#ifdef DEB_MESH
|
||||
if (debclass) { debwire++; cout <<endl; cout << "#wire no "<<debwire; debedge = 0;}
|
||||
#endif
|
||||
// For each wire we create a data map, linking vertices (only
|
||||
// the ends of edges) with their positions in the sequence of
|
||||
// all 2d points from this wire.
|
||||
// When we meet some vertex for the second time - the piece
|
||||
// of sequence is treated for a HOLE and quits the sequence.
|
||||
// Actually, we must unbind the vertices belonging to the
|
||||
// loop from the map, but since they can't appear twice on the
|
||||
// valid wire, leave them for a little speed up.
|
||||
nbedges = 0;
|
||||
TColgp_SequenceOfPnt2d SeqPnt2d;
|
||||
TColStd_DataMapOfIntegerInteger NodeInSeq;
|
||||
// Start traversing the wire
|
||||
for (WireExplorer.Init(TopoDS::Wire(FaceExplorer.Value()),Face); WireExplorer.More(); WireExplorer.Next())
|
||||
{
|
||||
edge = WireExplorer.Current();
|
||||
#ifdef DEB_MESH
|
||||
if (debclass) { debedge++; cout << endl; cout << "#edge no "<<debedge <<endl;}
|
||||
#endif
|
||||
anOr = edge.Orientation();
|
||||
if (anOr != TopAbs_FORWARD && anOr != TopAbs_REVERSED) continue;
|
||||
if (edges.IsBound(edge))
|
||||
{
|
||||
// Retrieve polygon
|
||||
// Define the direction for adding points to SeqPnt2d
|
||||
Standard_Integer iFirst,iLast,iIncr;
|
||||
const BRepMesh_PairOfPolygon& pair = edges.Find(edge);
|
||||
Handle(Poly_PolygonOnTriangulation) NOD;
|
||||
if (anOr == TopAbs_FORWARD)
|
||||
{
|
||||
NOD = pair.First();
|
||||
iFirst = 1;
|
||||
iLast = NOD->NbNodes();
|
||||
iIncr = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NOD = pair.Last();
|
||||
iFirst = NOD->NbNodes();
|
||||
iLast = 1;
|
||||
iIncr = -1;
|
||||
}
|
||||
const TColStd_Array1OfInteger& indices = NOD->Nodes();
|
||||
|
||||
// indexFirst and nodeLast are the indices of first and last
|
||||
// vertices of the edge in IndexedMap <Str>
|
||||
const Standard_Integer indexFirst = themap.FindKey(indices(iFirst));
|
||||
const Standard_Integer indexLast = themap.FindKey(indices(iLast));
|
||||
|
||||
// Skip degenerated edge : OCC481(apo)
|
||||
if (indexLast == indexFirst && (iLast-iFirst) == iIncr) continue;
|
||||
|
||||
// If there's a gap between edges -> raise <falsewire> flag
|
||||
if (nbedges)
|
||||
{
|
||||
if (indexFirst != lastindex)
|
||||
{
|
||||
falsewire = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else firstindex = indexFirst;
|
||||
lastindex = indexLast;
|
||||
|
||||
// Record first vertex (to detect loops)
|
||||
NodeInSeq.Bind(indexFirst,SeqPnt2d.Length()+1);
|
||||
|
||||
// Add vertices in sequence
|
||||
for (i = iFirst; i != iLast; i += iIncr)
|
||||
{
|
||||
index = (i == iFirst)? indexFirst : themap.FindKey(indices(i));
|
||||
|
||||
gp_Pnt2d vp(Str->GetNode(index).Coord());
|
||||
SeqPnt2d.Append(vp);
|
||||
#ifdef DEB_MESH
|
||||
if (debclass) cout<<"point p"<<index<<" "<<vp.X()<<" "<< vp.Y()<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Now, is there a loop?
|
||||
if (NodeInSeq.IsBound(indexLast))
|
||||
{
|
||||
// Yes, treat it separately as a hole
|
||||
// 1. Divide points into main wire and a loop
|
||||
const Standard_Integer iWireStart = NodeInSeq(indexLast);
|
||||
if(iWireStart < SeqPnt2d.Length()) {
|
||||
SeqPnt2d.Split(iWireStart, aWire);
|
||||
//OCC319-> the operation will be done later
|
||||
// 2. Proceed the loop
|
||||
//AnalizeWire(aLoop, Umin, Umax, Vmin, Vmax, aWirePoints, aWireLength, NbBiPoint);
|
||||
aWireLength.Append(aWire.Length());
|
||||
aWirePoints.Append(aWire);
|
||||
//<-OCC319
|
||||
}
|
||||
}
|
||||
|
||||
nbedges++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbedges)
|
||||
{
|
||||
// Isn't it open?
|
||||
if (falsewire || (firstindex != lastindex) || SeqPnt2d.Length() > 1)
|
||||
{
|
||||
myState = BRepMesh_OpenWire;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEB_MESH
|
||||
cout <<"Warning : empty wire" <<endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Check natural restriction
|
||||
const Standard_Integer nbwires = aWireLength.Length();
|
||||
if (nbwires == 1 && nbedges == 4)
|
||||
{
|
||||
Handle(Geom2d_Curve) C2d;
|
||||
Standard_Real pfbid, plbid;
|
||||
isnatural = Standard_True;
|
||||
for(FaceExplorer.Initialize(Face); FaceExplorer.More(); FaceExplorer.Next())
|
||||
{
|
||||
if(FaceExplorer.Value().ShapeType() != TopAbs_WIRE)
|
||||
continue;
|
||||
TopoDS_Iterator aEdgeIt(FaceExplorer.Value());
|
||||
for( ; aEdgeIt.More(); aEdgeIt.Next())
|
||||
{
|
||||
edge = TopoDS::Edge(aEdgeIt.Value());
|
||||
if(anOr == TopAbs_FORWARD || anOr == TopAbs_REVERSED)
|
||||
{
|
||||
C2d = BRep_Tool::CurveOnSurface(edge,Face,pfbid,plbid);
|
||||
//OCC316(APO): if(!IsLine(C2d)) { isnatural = Standard_False; break; }
|
||||
if(!C2d.IsNull() && !IsLine(C2d)) { isnatural = Standard_False; break; }
|
||||
else
|
||||
{ // sont-ce des isos:
|
||||
gp_Pnt2d P1, P2;
|
||||
C2d->D0(pfbid, P1);
|
||||
C2d->D0(plbid, P2);
|
||||
if ((Abs(P1.X()-P2.X()) > 1.e-04) && (Abs(P1.Y()-P2.Y()) > 1.e-04)) { isnatural = Standard_False; break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer NbBiPoint = aWirePoints.Length();
|
||||
BRepMesh_Array1OfBiPoint BiPoints(0,NbBiPoint);
|
||||
|
||||
BRepMesh_BiPoint *BP;
|
||||
Standard_Real *Coordinates1;
|
||||
Standard_Real x1, y1, x2, y2, xstart, ystart;
|
||||
Standard_Integer j, l = 1;
|
||||
BP = &(BiPoints.ChangeValue(1));
|
||||
|
||||
// Fill array of segments (bi-points)
|
||||
for (i = 1; i <= nbwires; i++)
|
||||
{
|
||||
const Standard_Integer len = aWireLength(i) + 1;
|
||||
for (j = 1; j <= len; j++)
|
||||
{
|
||||
// Obtain last point of the segment
|
||||
if (j == len)
|
||||
{
|
||||
x2 = xstart;
|
||||
y2 = ystart;
|
||||
}
|
||||
else
|
||||
{
|
||||
const gp_Pnt2d& PT = aWirePoints(l); l++;
|
||||
x2 = PT.X();
|
||||
y2 = PT.Y();
|
||||
}
|
||||
// Build segment (bi-point)
|
||||
if (j == 1)
|
||||
{
|
||||
xstart = x2;
|
||||
ystart = y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Coordinates1 = ((Standard_Real*)(BP->Coordinates())); BP++;
|
||||
Coordinates1[0] = x1;
|
||||
Coordinates1[1] = y1;
|
||||
Coordinates1[2] = x2;
|
||||
Coordinates1[3] = y2;
|
||||
Coordinates1[4] = x2 - x1;
|
||||
Coordinates1[5] = y2 - y1;
|
||||
}
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real *Coordinates2;
|
||||
Standard_Real A1, B1, C1, A2, B2, C2, AB, BC, CA, xc, yc;
|
||||
Standard_Real mu1, d, mu2;
|
||||
Standard_Integer ik, ikEnd = 0, jk, jkEnd;
|
||||
Standard_Real x11, x12, y11, y12, x21, x22, y21, y22;
|
||||
for(i = 1; i <= nbwires; i++)
|
||||
{
|
||||
ik = ikEnd + 1; ikEnd += aWireLength(i);
|
||||
// Explore first wire
|
||||
for (; ik <= ikEnd; ik++)
|
||||
{
|
||||
Coordinates1 = ((Standard_Real*)(BiPoints.ChangeValue(ik).Coordinates()));
|
||||
x11 = Coordinates1[0];
|
||||
y11 = Coordinates1[1];
|
||||
x12 = Coordinates1[2];
|
||||
y12 = Coordinates1[3];
|
||||
A1 = Coordinates1[5];
|
||||
B1 = -Coordinates1[4];
|
||||
C1 = - x11*A1 - y11*B1;
|
||||
//mu1 = Sqrt(A1*A1+B1*B1);
|
||||
mu1 = A1*A1+B1*B1;
|
||||
for (j = i; j <= nbwires; j++)
|
||||
{
|
||||
//for i==j the algorithm check current wire on selfintersection
|
||||
if (j == i)
|
||||
{
|
||||
jk = ik + 2; jkEnd = ikEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
jk = jkEnd + 1; jkEnd = jk + aWireLength(j) - 1;
|
||||
}
|
||||
// Explore second wire
|
||||
for (; jk <= jkEnd; jk++)
|
||||
{
|
||||
// don't check end's segment of the wire on selfrestriction
|
||||
if (jk == ikEnd) continue;
|
||||
Coordinates2 = ((Standard_Real*)(BiPoints.ChangeValue(jk).Coordinates()));
|
||||
x21 = Coordinates2[0];
|
||||
y21 = Coordinates2[1];
|
||||
x22 = Coordinates2[2];
|
||||
y22 = Coordinates2[3];
|
||||
A2 = Coordinates2[5];
|
||||
B2 = -Coordinates2[4];
|
||||
C2 = - x21*A2 - y21*B2;
|
||||
//mu2 = Sqrt(A2*A2+B2*B2);
|
||||
mu2 = A2*A2+B2*B2;
|
||||
//different segments may have common vertex (see OCC287 bug for example)
|
||||
//if(x22 == x11 && y22 == y11){ myState = BRepMesh_OpenWire; return;}
|
||||
AB = A1*B2 - A2*B1;
|
||||
//check on minimal of distance between current segment and points of another linear segments - OCC319
|
||||
//d = Abs(A1*x22 + B1*y22 + C1);
|
||||
d = A1*x22 + B1*y22 + C1;
|
||||
if(i != j && // if compared wires are different &&
|
||||
AB*AB > PARALL_COND*PARALL_COND*mu1*mu2 && // angle between two segments greater then PARALL_COND &&
|
||||
d*d < MIN_DIST*MIN_DIST*mu1 && // distance between vertex of the segment and other one's less then MIN_DIST
|
||||
(x22-x11)*(x22-x12) < 0.0 && (y22-y11)*(y22-y12) < 0.0)
|
||||
{
|
||||
myState = BRepMesh_SelfIntersectingWire; return;
|
||||
}
|
||||
//look for intersection of two linear segments
|
||||
if(Abs(AB) <= RESOLUTION) continue; //current segments seem parallel - no intersection
|
||||
//calculate coordinates of point of the intersection
|
||||
BC = B1*C2 - B2*C1; xc = BC/AB;
|
||||
CA = C1*A2 - C2*A1; yc = CA/AB;
|
||||
//check on belonging of intersection point to the both of segments
|
||||
if( Abs(xc-x11) > RESOLUTION && Abs(xc-x12) > RESOLUTION &&
|
||||
Abs(yc-y11) > RESOLUTION && Abs(yc-y12) > RESOLUTION &&
|
||||
Abs(xc-x21) > RESOLUTION && Abs(xc-x22) > RESOLUTION &&
|
||||
Abs(yc-y21) > RESOLUTION && Abs(yc-y22) > RESOLUTION )
|
||||
{
|
||||
if((xc-x11)*(xc-x12) < 0.0 && (yc-y11)*(yc-y12) < 0.0 &&
|
||||
(xc-x21)*(xc-x22) < 0.0 && (yc-y21)*(yc-y22) < 0.0)
|
||||
{
|
||||
//different segments may have common vertex (why "<" but "<=")
|
||||
myState = BRepMesh_SelfIntersectingWire; return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find holes
|
||||
for (i = nbwires; i >= 1; i--)
|
||||
{
|
||||
NbBiPoint = aWirePoints.Length() - aWireLength(i) + 1;
|
||||
aWirePoints.Split(NbBiPoint, aWire);
|
||||
AnalizeWire(aWire, Umin, Umax, Vmin, Vmax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopAbs_State BRepMesh_Classifier::Perform(const gp_Pnt2d& aPoint) const
|
||||
{
|
||||
Standard_Boolean isOut = Standard_False;
|
||||
|
||||
Standard_Integer cur, i, nb = TabClass.Length();
|
||||
|
||||
for (i = 1; i <= nb; i++)
|
||||
{
|
||||
cur = ((CSLib_Class2d*)TabClass(i))->SiDans(aPoint);
|
||||
if (cur == 0)
|
||||
{
|
||||
// Point is ON, but mark it as OUT
|
||||
isOut = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
isOut = TabOrien(i)? (cur == -1) : (cur == 1);
|
||||
}
|
||||
if (isOut) return TopAbs_OUT;
|
||||
}
|
||||
|
||||
return TopAbs_IN;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepMesh_Classifier::Destroy()
|
||||
{
|
||||
Standard_Integer i, nb = TabClass.Length();
|
||||
for (i = 1; i <= nb; i++)
|
||||
{
|
||||
if (TabClass(i))
|
||||
{
|
||||
delete ((CSLib_Class2d*)TabClass(i));
|
||||
TabClass(i) = NULL;
|
||||
}
|
||||
}
|
||||
}
|
27
src/BRepMesh/BRepMesh_Classifier.lxx
Executable file
27
src/BRepMesh/BRepMesh_Classifier.lxx
Executable file
@@ -0,0 +1,27 @@
|
||||
// File: BRepMesh_Classifier.lxx
|
||||
// Created: Wed Nov 5 12:29:52 2003
|
||||
// Author: Open CASCADE Support
|
||||
// <support@opencascade.com>
|
||||
// Copyright: Open CASCADE 2003
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : State
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline BRepMesh_Status BRepMesh_Classifier::State() const
|
||||
{
|
||||
return myState;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NaturalRestriction
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepMesh_Classifier::NaturalRestriction() const
|
||||
{
|
||||
return isnatural;
|
||||
}
|
14
src/BRepMesh/BRepMesh_ClassifierPtr.hxx
Executable file
14
src/BRepMesh/BRepMesh_ClassifierPtr.hxx
Executable file
@@ -0,0 +1,14 @@
|
||||
// File: BRepMesh_ClassifierPtr.hxx
|
||||
// Created: 02.02.09 12:47:22
|
||||
// Author: Pavel TELKOV
|
||||
// Copyright: Open CASCADE 2009
|
||||
|
||||
#ifndef BRepMesh_ClassifierPtr_HeaderFile
|
||||
#define BRepMesh_ClassifierPtr_HeaderFile
|
||||
|
||||
#include <BRepMesh_Classifier.hxx>
|
||||
#include <NCollection_Handle.hxx>
|
||||
|
||||
typedef NCollection_Handle<BRepMesh_Classifier> BRepMesh_ClassifierPtr;
|
||||
|
||||
#endif
|
71
src/BRepMesh/BRepMesh_DiscretFactory.cdl
Executable file
71
src/BRepMesh/BRepMesh_DiscretFactory.cdl
Executable file
@@ -0,0 +1,71 @@
|
||||
-- File: BRepMesh_DiscretFactory.cdl
|
||||
-- Created: Thu Apr 10 12:34:15 2008
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2008
|
||||
|
||||
|
||||
class DiscretFactory from BRepMesh
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
AsciiString from TCollection,
|
||||
PDiscretRoot from BRepMesh,
|
||||
MapOfAsciiString from TColStd,
|
||||
FactoryError from BRepMesh,
|
||||
Shape from TopoDS
|
||||
--raises
|
||||
|
||||
|
||||
is
|
||||
Create
|
||||
returns DiscretFactory from BRepMesh
|
||||
is protected;
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepMesh_DiscretFactory();"
|
||||
|
||||
Get(myclass)
|
||||
returns DiscretFactory from BRepMesh;
|
||||
---C++: return &
|
||||
|
||||
Names(me)
|
||||
returns MapOfAsciiString from TColStd;
|
||||
---C++: return const &
|
||||
|
||||
SetDefaultName(me:out;
|
||||
theName:AsciiString from TCollection);
|
||||
|
||||
DefaultName(me)
|
||||
returns AsciiString from TCollection;
|
||||
---C++: return const &
|
||||
|
||||
SetFunctionName(me:out;
|
||||
theName:AsciiString from TCollection);
|
||||
|
||||
FunctionName(me)
|
||||
returns AsciiString from TCollection;
|
||||
---C++: return const &
|
||||
|
||||
Discret(me:out;
|
||||
theShape:Shape from TopoDS;
|
||||
theDeflection : Real from Standard;
|
||||
theAngle : Real from Standard)
|
||||
returns PDiscretRoot from BRepMesh;
|
||||
---C++: return &
|
||||
|
||||
ErrorStatus(me)
|
||||
returns FactoryError from BRepMesh;
|
||||
|
||||
Clear(me:out)
|
||||
is protected;
|
||||
|
||||
fields
|
||||
myPDiscret : PDiscretRoot from BRepMesh is protected;
|
||||
myErrorStatus : FactoryError from BRepMesh is protected;
|
||||
myNames : MapOfAsciiString from TColStd is protected;
|
||||
myFixedNames : AsciiString from TCollection[1] is protected;
|
||||
myDefaultName : AsciiString from TCollection is protected;
|
||||
myFunctionName: AsciiString from TCollection is protected;
|
||||
|
||||
end DiscretFactory;
|
||||
|
223
src/BRepMesh/BRepMesh_DiscretFactory.cxx
Executable file
223
src/BRepMesh/BRepMesh_DiscretFactory.cxx
Executable file
@@ -0,0 +1,223 @@
|
||||
// File: BRepMesh_DiscretFactory.cxx
|
||||
// Created: Thu Apr 10 13:32:00 2008
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <BRepMesh_DiscretFactory.ixx>
|
||||
|
||||
#include <OSD_SharedLibrary.hxx>
|
||||
#include <OSD_Function.hxx>
|
||||
#include <BRepMesh_IncrementalMesh.hxx>
|
||||
|
||||
static
|
||||
void MakeLibName(const TCollection_AsciiString& ,
|
||||
TCollection_AsciiString& );
|
||||
static
|
||||
Standard_Integer CreateDiscret(const TopoDS_Shape& theShape,
|
||||
const Standard_Real ,
|
||||
const Standard_Real ,
|
||||
OSD_Function& ,
|
||||
BRepMesh_PDiscretRoot& );
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_DiscretFactory
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DiscretFactory::BRepMesh_DiscretFactory()
|
||||
{
|
||||
myFixedNames[0]="FastDiscret";
|
||||
|
||||
//
|
||||
myNames.Add(myFixedNames[0]);
|
||||
myDefaultName=myFixedNames[0];
|
||||
myFunctionName="DISCRETALGO";
|
||||
myPDiscret=NULL;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DiscretFactory::~BRepMesh_DiscretFactory()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretFactory::Clear()
|
||||
{
|
||||
if (myPDiscret) {
|
||||
delete myPDiscret;
|
||||
myPDiscret=NULL;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DiscretFactory& BRepMesh_DiscretFactory::Get()
|
||||
{
|
||||
static BRepMesh_DiscretFactory* sFactory;
|
||||
static Standard_Boolean isInit=Standard_False;
|
||||
if(!isInit) {
|
||||
isInit = Standard_True;
|
||||
sFactory = new BRepMesh_DiscretFactory;
|
||||
}
|
||||
return *sFactory;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ErrorStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_FactoryError BRepMesh_DiscretFactory::ErrorStatus()const
|
||||
{
|
||||
return myErrorStatus;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Names
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TColStd_MapOfAsciiString& BRepMesh_DiscretFactory::Names()const
|
||||
{
|
||||
return myNames;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetDefaultName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretFactory::SetDefaultName(const TCollection_AsciiString& theName)
|
||||
{
|
||||
myDefaultName=theName;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DefaultName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& BRepMesh_DiscretFactory::DefaultName()const
|
||||
{
|
||||
return myDefaultName;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFunctionName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretFactory::SetFunctionName(const TCollection_AsciiString& theName)
|
||||
{
|
||||
myFunctionName=theName;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FunctionName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& BRepMesh_DiscretFactory::FunctionName()const
|
||||
{
|
||||
return myFunctionName;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Discret
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_PDiscretRoot&
|
||||
BRepMesh_DiscretFactory::Discret(const TopoDS_Shape& theShape,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theAngle)
|
||||
{
|
||||
myErrorStatus=BRepMesh_FE_NOERROR;
|
||||
Clear();
|
||||
// DEB f
|
||||
//myDefaultName="TKXMesh";
|
||||
// DEB t
|
||||
if(myDefaultName==myFixedNames[0]) {
|
||||
myPDiscret=new BRepMesh_IncrementalMesh;
|
||||
myPDiscret->SetDeflection(theDeflection);
|
||||
myPDiscret->SetAngle(theAngle);
|
||||
myPDiscret->SetShape(theShape);
|
||||
}
|
||||
else {
|
||||
Standard_Integer iErr;
|
||||
TCollection_AsciiString aLibName;
|
||||
OSD_Function aF;
|
||||
//
|
||||
myPDiscret=NULL;
|
||||
//
|
||||
MakeLibName(myDefaultName, aLibName);
|
||||
//
|
||||
OSD_SharedLibrary aSL(aLibName.ToCString());
|
||||
if (!aSL.DlOpen(OSD_RTLD_LAZY)) {
|
||||
myErrorStatus=BRepMesh_FE_LIBRARYNOTFOUND; // library is not found
|
||||
return myPDiscret;
|
||||
}
|
||||
//
|
||||
aF = aSL.DlSymb(myFunctionName.ToCString());
|
||||
if(aF==NULL ) {
|
||||
myErrorStatus=BRepMesh_FE_FUNCTIONNOTFOUND; // function is not found
|
||||
return myPDiscret;
|
||||
}
|
||||
//
|
||||
iErr=CreateDiscret(theShape,
|
||||
theDeflection,
|
||||
theAngle,
|
||||
aF,
|
||||
myPDiscret);
|
||||
if (iErr) {
|
||||
myErrorStatus=BRepMesh_FE_CANNOTCREATEALGO; // can not create the algo specified
|
||||
}
|
||||
else {
|
||||
myNames.Add(myDefaultName);
|
||||
}
|
||||
}
|
||||
//
|
||||
return myPDiscret;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : CreateDiscret
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer CreateDiscret(const TopoDS_Shape& theShape,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theAngle,
|
||||
OSD_Function& theF,
|
||||
BRepMesh_PDiscretRoot& theAlgo)
|
||||
{
|
||||
Standard_Integer iErr;
|
||||
Standard_Integer (*fp) (const TopoDS_Shape& ,
|
||||
const Standard_Real ,
|
||||
const Standard_Real ,
|
||||
BRepMesh_PDiscretRoot& );
|
||||
//
|
||||
fp=(Standard_Integer (*)(const TopoDS_Shape& ,
|
||||
const Standard_Real ,
|
||||
const Standard_Real ,
|
||||
BRepMesh_PDiscretRoot&)) theF;
|
||||
//
|
||||
iErr=(*fp)(theShape,
|
||||
theDeflection,
|
||||
theAngle,
|
||||
theAlgo);
|
||||
//
|
||||
return iErr;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeLibName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void MakeLibName(const TCollection_AsciiString& theDefaultName,
|
||||
TCollection_AsciiString& theLibName)
|
||||
{
|
||||
theLibName="";
|
||||
#ifndef WNT
|
||||
theLibName+="lib";
|
||||
#endif
|
||||
theLibName+=theDefaultName;
|
||||
#ifdef WNT
|
||||
theLibName+=".dll";
|
||||
#elif __APPLE__
|
||||
theLibName+=".dylib";
|
||||
#elif defined (HPUX) || defined(_hpux)
|
||||
theLibName+=".sl";
|
||||
#else
|
||||
theLibName+=".so";
|
||||
#endif
|
||||
}
|
65
src/BRepMesh/BRepMesh_DiscretRoot.cdl
Executable file
65
src/BRepMesh/BRepMesh_DiscretRoot.cdl
Executable file
@@ -0,0 +1,65 @@
|
||||
-- File: BRepMesh_DiscretRoot.cdl
|
||||
-- Created: Thu Apr 10 09:57:55 2008
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---Copyright: Matra Datavision 2008
|
||||
|
||||
|
||||
deferred class DiscretRoot from BRepMesh
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Shape from TopoDS
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
|
||||
Initialize
|
||||
returns DiscretRoot from BRepMesh;
|
||||
|
||||
SetDeflection(me: out;
|
||||
theDeflection : Real from Standard);
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepMesh_DiscretRoot();"
|
||||
|
||||
Deflection(me)
|
||||
returns Real from Standard;
|
||||
|
||||
SetAngle(me: out;
|
||||
theAngle: Real from Standard);
|
||||
|
||||
Angle(me)
|
||||
returns Real from Standard;
|
||||
|
||||
SetShape(me: out;
|
||||
theShape: Shape from TopoDS);
|
||||
|
||||
Shape(me)
|
||||
returns Shape from TopoDS;
|
||||
---C++: return const &
|
||||
|
||||
Perform(me: out)
|
||||
is deferred;
|
||||
|
||||
IsDone(me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
--
|
||||
-- Protected methods
|
||||
--
|
||||
SetDone(me:out)
|
||||
is protected;
|
||||
|
||||
SetNotDone(me:out)
|
||||
is protected;
|
||||
|
||||
Init(me:out)
|
||||
is virtual protected;
|
||||
fields
|
||||
myDeflection : Real from Standard is protected;
|
||||
myAngle : Real from Standard is protected;
|
||||
myShape : Shape from TopoDS is protected;
|
||||
myIsDone : Boolean from Standard is protected;
|
||||
|
||||
end DiscretRoot;
|
105
src/BRepMesh/BRepMesh_DiscretRoot.cxx
Executable file
105
src/BRepMesh/BRepMesh_DiscretRoot.cxx
Executable file
@@ -0,0 +1,105 @@
|
||||
// File: BRepMesh_DiscretRoot.cxx
|
||||
// Created: Thu Apr 10 10:08:44 2008
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#include <BRepMesh_DiscretRoot.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_DiscretRoot
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DiscretRoot::BRepMesh_DiscretRoot()
|
||||
{
|
||||
myIsDone=Standard_False;
|
||||
myDeflection=0.001;
|
||||
myAngle=0.1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DiscretRoot::~BRepMesh_DiscretRoot()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretRoot::SetDeflection(const Standard_Real theDeflection)
|
||||
{
|
||||
myDeflection=theDeflection;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BRepMesh_DiscretRoot::Deflection()const
|
||||
{
|
||||
return myDeflection;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetAngle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretRoot::SetAngle(const Standard_Real theAngle)
|
||||
{
|
||||
myAngle=theAngle;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Angle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BRepMesh_DiscretRoot::Angle()const
|
||||
{
|
||||
return myAngle;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretRoot::SetShape(const TopoDS_Shape& theShape)
|
||||
{
|
||||
myShape=theShape;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Shape& BRepMesh_DiscretRoot::Shape()const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_DiscretRoot::IsDone()const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretRoot::SetDone()
|
||||
{
|
||||
myIsDone=Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetNotDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretRoot::SetNotDone()
|
||||
{
|
||||
myIsDone=Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DiscretRoot::Init()
|
||||
{
|
||||
|
||||
}
|
71
src/BRepMesh/BRepMesh_Edge.cdl
Executable file
71
src/BRepMesh/BRepMesh_Edge.cdl
Executable file
@@ -0,0 +1,71 @@
|
||||
-- File: BRepMesh_Edge.cdl
|
||||
-- Created: Wed Sep 22 18:07:31 1993
|
||||
-- Author: Didier PIFFAULT
|
||||
-- <dpf@zerox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Edge from BRepMesh
|
||||
|
||||
---Purpose:
|
||||
|
||||
|
||||
uses Boolean from Standard,
|
||||
Integer from Standard,
|
||||
DegreeOfFreedom from MeshDS
|
||||
|
||||
|
||||
is Create (vDebut : Integer from Standard;
|
||||
vFin : Integer from Standard;
|
||||
canMove : DegreeOfFreedom from MeshDS)
|
||||
---Purpose: Contructs a link beetween to vertices.
|
||||
returns Edge from BRepMesh;
|
||||
|
||||
|
||||
FirstNode (me)
|
||||
---Purpose: Give the index of first node of the Link.
|
||||
---C++: inline
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
|
||||
LastNode (me)
|
||||
---Purpose: Give the index of Last node of the Link.
|
||||
---C++: inline
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
|
||||
Movability (me)
|
||||
---C++: inline
|
||||
returns DegreeOfFreedom from MeshDS
|
||||
is static;
|
||||
|
||||
|
||||
SetMovability (me : in out;
|
||||
Move : DegreeOfFreedom from MeshDS)
|
||||
is static;
|
||||
|
||||
HashCode (me;
|
||||
Upper : Integer from Standard)
|
||||
returns Integer from Standard
|
||||
---C++: function call
|
||||
is static;
|
||||
|
||||
|
||||
SameOrientation(me; Other : Edge from BRepMesh)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
IsEqual (me; Other : Edge from BRepMesh)
|
||||
returns Boolean from Standard
|
||||
---C++: alias operator ==
|
||||
is static;
|
||||
|
||||
|
||||
fields myFirstNode : Integer from Standard;
|
||||
myLastNode : Integer from Standard;
|
||||
myMovability : DegreeOfFreedom from MeshDS;
|
||||
|
||||
end Edge;
|
37
src/BRepMesh/BRepMesh_Edge.cxx
Executable file
37
src/BRepMesh/BRepMesh_Edge.cxx
Executable file
@@ -0,0 +1,37 @@
|
||||
// File: BRepMesh_Edge.cxx
|
||||
// Created: Thu Sep 23 13:39:58 1993
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@zerox>
|
||||
|
||||
#include <BRepMesh_Edge.ixx>
|
||||
|
||||
BRepMesh_Edge::BRepMesh_Edge(const Standard_Integer vDebut,
|
||||
const Standard_Integer vFin,
|
||||
const MeshDS_DegreeOfFreedom canMove)
|
||||
: myFirstNode(vDebut), myLastNode(vFin), myMovability(canMove)
|
||||
{}
|
||||
|
||||
void BRepMesh_Edge::SetMovability(const MeshDS_DegreeOfFreedom Move)
|
||||
{
|
||||
myMovability =Move;
|
||||
}
|
||||
|
||||
Standard_Integer BRepMesh_Edge::HashCode(const Standard_Integer Upper)const
|
||||
{
|
||||
return ::HashCode(myFirstNode+myLastNode, Upper);
|
||||
}
|
||||
|
||||
Standard_Boolean BRepMesh_Edge::IsEqual(const BRepMesh_Edge& Other)const
|
||||
{
|
||||
if (myMovability==MeshDS_Deleted || Other.myMovability==MeshDS_Deleted)
|
||||
return Standard_False;
|
||||
return (myFirstNode==Other.myFirstNode && myLastNode==Other.myLastNode) ||
|
||||
(myFirstNode==Other.myLastNode && myLastNode==Other.myFirstNode);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean BRepMesh_Edge::SameOrientation
|
||||
(const BRepMesh_Edge& Other)const
|
||||
{
|
||||
return (myFirstNode==Other.myFirstNode && myLastNode==Other.myLastNode);
|
||||
}
|
20
src/BRepMesh/BRepMesh_Edge.lxx
Executable file
20
src/BRepMesh/BRepMesh_Edge.lxx
Executable file
@@ -0,0 +1,20 @@
|
||||
// File: BRepMesh_Edge.lxx
|
||||
// Created: Thu Sep 23 13:44:34 1993
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@zerox>
|
||||
|
||||
inline Standard_Integer BRepMesh_Edge::FirstNode()const
|
||||
{
|
||||
return myFirstNode;
|
||||
}
|
||||
|
||||
inline Standard_Integer BRepMesh_Edge::LastNode()const
|
||||
{
|
||||
return myLastNode;
|
||||
}
|
||||
|
||||
inline MeshDS_DegreeOfFreedom BRepMesh_Edge::Movability()const
|
||||
{
|
||||
return myMovability;
|
||||
}
|
||||
|
71
src/BRepMesh/BRepMesh_FaceAttribute.cdl
Executable file
71
src/BRepMesh/BRepMesh_FaceAttribute.cdl
Executable file
@@ -0,0 +1,71 @@
|
||||
-- File: BRepMesh_FaceAttribute.cdl
|
||||
-- Created: Fri Oct 31 16:16:20 2008
|
||||
-- Author: EPA
|
||||
---Copyright: OPEN CASCADE 2008
|
||||
|
||||
class FaceAttribute from BRepMesh inherits TShared from MMgt
|
||||
|
||||
---Purpose: auxiliary class for FastDiscret and FastDiscretFace classes
|
||||
|
||||
uses
|
||||
Real from Standard,
|
||||
Address from Standard,
|
||||
ClassifierPtr from BRepMesh
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable FaceAttribute from BRepMesh;
|
||||
|
||||
GetDefFace(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetUMin(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetVMin(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetUMax(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetVMax(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetDeltaX(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetDeltaY(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetMinX(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetMinY(me:mutable) returns Real;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
GetClassifier(me:mutable) returns ClassifierPtr from BRepMesh;
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
mydefface : Real from Standard;
|
||||
myumin : Real from Standard;
|
||||
myumax : Real from Standard;
|
||||
myvmin : Real from Standard;
|
||||
myvmax : Real from Standard;
|
||||
mydeltaX : Real from Standard;
|
||||
mydeltaY : Real from Standard;
|
||||
myminX : Real from Standard;
|
||||
myminY : Real from Standard;
|
||||
myclassifier: ClassifierPtr from BRepMesh;
|
||||
|
||||
end FaceAttribute;
|
15
src/BRepMesh/BRepMesh_FaceAttribute.cxx
Executable file
15
src/BRepMesh/BRepMesh_FaceAttribute.cxx
Executable file
@@ -0,0 +1,15 @@
|
||||
// File: BRepMesh_FaceAttribute.cxx
|
||||
// Author: Ekaterina SMIRNOVA
|
||||
// Copyright: Open CASCADE SAS 2008
|
||||
|
||||
#include <BRepMesh_FaceAttribute.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_FaceAttribute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_FaceAttribute::BRepMesh_FaceAttribute():
|
||||
mydefface(0.), myumin(0.), myumax(0.), myvmin(0.), myvmax(0.),
|
||||
mydeltaX(1.), mydeltaY(1.), myminX(0.), myminY(0.)
|
||||
{
|
||||
}
|
53
src/BRepMesh/BRepMesh_FaceAttribute.lxx
Executable file
53
src/BRepMesh/BRepMesh_FaceAttribute.lxx
Executable file
@@ -0,0 +1,53 @@
|
||||
// File: BRepMesh_FaceAttribute.lxx
|
||||
// Author: Ekaterina SMIRNOVA
|
||||
// Copyright: Open CASCADE SAS 2008
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetDefFace()
|
||||
{
|
||||
return mydefface;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetUMin()
|
||||
{
|
||||
return myumin;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetVMin()
|
||||
{
|
||||
return myvmin;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetUMax()
|
||||
{
|
||||
return myumax;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetVMax()
|
||||
{
|
||||
return myvmax;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetDeltaX()
|
||||
{
|
||||
return mydeltaX;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetDeltaY()
|
||||
{
|
||||
return mydeltaY;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetMinX()
|
||||
{
|
||||
return myminX;
|
||||
}
|
||||
|
||||
inline Standard_Real& BRepMesh_FaceAttribute::GetMinY()
|
||||
{
|
||||
return myminY;
|
||||
}
|
||||
|
||||
inline BRepMesh_ClassifierPtr& BRepMesh_FaceAttribute::GetClassifier()
|
||||
{
|
||||
return myclassifier;
|
||||
}
|
320
src/BRepMesh/BRepMesh_FastDiscret.cdl
Executable file
320
src/BRepMesh/BRepMesh_FastDiscret.cdl
Executable file
@@ -0,0 +1,320 @@
|
||||
-- File: BRepMesh_FastDiscret.cdl
|
||||
-- Created: Tue Feb 27 14:21:35 1996
|
||||
-- Author: Laurent PAINNOT
|
||||
-- <lpa@nonox>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class FastDiscret from BRepMesh inherits TShared from MMgt
|
||||
|
||||
---Purpose: Algorithm to mesh a shape with respect of the
|
||||
-- frontier the deflection and by option the shared
|
||||
-- components.
|
||||
|
||||
|
||||
uses Boolean from Standard,
|
||||
Integer from Standard,
|
||||
Box from Bnd,
|
||||
Real from Standard,
|
||||
Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
FaceAttribute from BRepMesh,
|
||||
Vertex from TopoDS,
|
||||
Triangle from BRepMesh,
|
||||
Vertex from BRepMesh,
|
||||
Edge from BRepMesh,
|
||||
ListOfInteger from TColStd,
|
||||
MapOfInteger from TColStd,
|
||||
SequenceOfInteger from TColStd,
|
||||
ListOfReal from TColStd,
|
||||
IndexedMapOfInteger from TColStd,
|
||||
SequenceOfPnt2d from TColgp,
|
||||
Dir from gp,
|
||||
Pnt from gp,
|
||||
XY from gp,
|
||||
Pnt2d from gp,
|
||||
DataMapOfIntegerPnt from BRepMesh,
|
||||
DataMapOfIntegerListOfXY from BRepMesh,
|
||||
DataMapOfShapePairOfPolygon from BRepMesh,
|
||||
Delaun from BRepMesh,
|
||||
DataMapOfVertexInteger from BRepMesh,
|
||||
DataStructureOfDelaun from BRepMesh,
|
||||
ListOfVertex from BRepMesh,
|
||||
MapOfShape from TopTools,
|
||||
HSurface from BRepAdaptor,
|
||||
ClassifierPtr from BRepMesh,
|
||||
IndexedMapOfReal from TColStd,
|
||||
Status from BRepMesh,
|
||||
DataMapOfShapeReal from TopTools,
|
||||
ListOfShape from TopTools,
|
||||
Curve from Geom2d,
|
||||
MapOfInteger from MeshDS,
|
||||
BaseAllocator from MeshDS,
|
||||
DataMapOfFaceAttribute from BRepMesh
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create (defle : Real from Standard;
|
||||
angle : Real from Standard;
|
||||
B : Box from Bnd;
|
||||
withShare : Boolean from Standard=Standard_True;
|
||||
inshape : Boolean from Standard=Standard_False;
|
||||
relative : Boolean from Standard=Standard_False;
|
||||
shapetrigu: Boolean from Standard=Standard_False)
|
||||
returns mutable FastDiscret from BRepMesh;
|
||||
|
||||
|
||||
Create (defle : Real from Standard;
|
||||
shape : Shape from TopoDS;
|
||||
B : Box from Bnd;
|
||||
angle : Real from Standard;
|
||||
withShare : Boolean from Standard=Standard_True;
|
||||
inshape : Boolean from Standard=Standard_False;
|
||||
relative : Boolean from Standard=Standard_False;
|
||||
shapetrigu: Boolean from Standard=Standard_False)
|
||||
---Purpose: if the boolean <relative> is True, the
|
||||
-- deflection used for the polygonalisation of
|
||||
-- each edge will be <defle> * Size of Edge.
|
||||
-- the deflection used for the faces will be the maximum
|
||||
-- deflection of their edges.
|
||||
--
|
||||
-- if <shapetrigu> is True, the triangulation, if exists
|
||||
-- with a correct deflection, can be used to re-triangulate
|
||||
-- the shape.
|
||||
--
|
||||
-- if <inshape> is True, the calculated
|
||||
-- triangulation will be stored in the shape.
|
||||
returns mutable FastDiscret from BRepMesh;
|
||||
|
||||
|
||||
Perform (me: mutable; shape: Shape from TopoDS) is static;
|
||||
---Purpose: Build triangulation on the whole shape
|
||||
|
||||
Add (me: mutable; face: Face from TopoDS) is static;
|
||||
---Purpose: Record a face for further processing.
|
||||
|
||||
Process (me; face: Face from TopoDS) is static;
|
||||
---Purpose: Triangulate a face previously recorded for
|
||||
-- processing by call to Add(). Can be executed in
|
||||
-- parallel threads.
|
||||
---C++: alias operator ()
|
||||
|
||||
InternalVerticesMode(me: mutable) returns Boolean from Standard;
|
||||
---Purpose: Returns mode defining if internal vertices on faces
|
||||
-- are taken into consideration or not. If this mode is equal to true
|
||||
-- that internal vertices on faces are considered during triangulation.
|
||||
-- Default value is equal to false (old behaviour).
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
|
||||
CurrentFaceStatus(me)
|
||||
returns Status from BRepMesh;
|
||||
|
||||
Add (me : mutable;
|
||||
edge : Edge from TopoDS;
|
||||
face : Face from TopoDS;
|
||||
S : HSurface from BRepAdaptor;
|
||||
C : Curve from Geom2d;
|
||||
defedge: Real from Standard;
|
||||
first : Real from Standard;
|
||||
last : Real from Standard)
|
||||
is static private;
|
||||
|
||||
Add (me : mutable;
|
||||
theVert: Vertex from TopoDS;
|
||||
face : Face from TopoDS;
|
||||
S : HSurface from BRepAdaptor) is private;
|
||||
|
||||
Update (me: mutable;
|
||||
Edge: Edge from TopoDS;
|
||||
Face: Face from TopoDS;
|
||||
C : Curve from Geom2d;
|
||||
defedge: Real from Standard;
|
||||
first : Real from Standard;
|
||||
last : Real from Standard)
|
||||
|
||||
returns Boolean is private;
|
||||
|
||||
|
||||
InternalVertices
|
||||
(me : mutable;
|
||||
caro : HSurface from BRepAdaptor;
|
||||
inter : in out ListOfVertex from BRepMesh;
|
||||
defedge : Real from Standard;
|
||||
classifier : ClassifierPtr from BRepMesh)
|
||||
is static private;
|
||||
|
||||
|
||||
Control
|
||||
(me : mutable;
|
||||
caro : HSurface from BRepAdaptor;
|
||||
defface : Real from Standard;
|
||||
inter : in out ListOfVertex from BRepMesh;
|
||||
badTri : in out ListOfInteger from TColStd;
|
||||
nulTri : in out ListOfInteger from TColStd;
|
||||
trigu : in out Delaun from BRepMesh;
|
||||
isfirst : Boolean from Standard)
|
||||
returns Real from Standard is static private;
|
||||
|
||||
|
||||
FindUV(me: mutable; V: Vertex from TopoDS;
|
||||
XY: Pnt2d from gp;
|
||||
ip: Integer from Standard;
|
||||
S : HSurface from BRepAdaptor;
|
||||
mindist: Real from Standard)
|
||||
returns XY from gp is private;
|
||||
|
||||
AddInShape(me: mutable; face : Face from TopoDS;
|
||||
defedge: Real from Standard)
|
||||
is static private;
|
||||
|
||||
|
||||
-- Output :
|
||||
|
||||
|
||||
NbTriangles(me)
|
||||
---Purpose: Gives the number of built triangles.
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
Triangle (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the triangle of <Index>.
|
||||
---C++: return const &
|
||||
returns Triangle from BRepMesh
|
||||
is static;
|
||||
|
||||
|
||||
NbEdges (me)
|
||||
---Purpose: Gives the number of built Edges
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
Edge (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the edge of index <Index>.
|
||||
---C++: return const &
|
||||
returns Edge from BRepMesh
|
||||
is static;
|
||||
|
||||
|
||||
NbVertices (me)
|
||||
---Purpose: Gives the number of built Vertices.
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
Vertex (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the vertex of <Index>.
|
||||
---C++: return const &
|
||||
returns Vertex from BRepMesh
|
||||
is static;
|
||||
|
||||
Pnt (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the location3d of the vertex of <Index>.
|
||||
---C++: return const &
|
||||
returns Pnt from gp
|
||||
is static;
|
||||
|
||||
VerticesOfDomain
|
||||
(me; Indices : in out MapOfInteger from MeshDS)
|
||||
---Purpose: Gives the list of indices of the vertices
|
||||
is static;
|
||||
|
||||
|
||||
EdgesOfDomain
|
||||
(me; Indices : in out MapOfInteger from MeshDS)
|
||||
---Purpose: Gives the list of indices of the edges
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
TrianglesOfDomain(me; Indices: in out MapOfInteger from MeshDS)
|
||||
---Purpose: Gives the list of indices of the triangles
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
NbPoint3d (me)
|
||||
---Purpose: Gives the number of different location in 3d
|
||||
-- space. It is different of the number of
|
||||
-- vertices if there is more than one surface.
|
||||
-- Even for one surface, the number can be different
|
||||
-- if an edge is shared.
|
||||
---C++: inline
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
Point3d (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the 3d space location of the vertex <Index>.
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns Pnt from gp
|
||||
is static;
|
||||
|
||||
|
||||
GetDeflection(me)
|
||||
---Purpose: returns the deflection value.
|
||||
---C++: inline
|
||||
returns Real from Standard;
|
||||
|
||||
GetAngle(me)
|
||||
---Purpose: returns the deflection value.
|
||||
---C++: inline
|
||||
returns Real from Standard;
|
||||
|
||||
WithShare(me)
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
InShape(me)
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
ShapeTrigu(me)
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetFaceAttribute(me;
|
||||
face : Face from TopoDS;
|
||||
fattrib : in out FaceAttribute from BRepMesh)
|
||||
---Purpose: returns the face deflection value.
|
||||
returns Boolean from Standard;
|
||||
|
||||
RemoveFaceAttribute(me : mutable;
|
||||
face : Face from TopoDS);
|
||||
---Purpose: remove face attribute as useless to free locate memory
|
||||
|
||||
GetMapOfDefEdge(me)
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns DataMapOfShapeReal from TopTools;
|
||||
|
||||
fields
|
||||
myangle : Real from Standard;
|
||||
mydeflection : Real from Standard;
|
||||
mydtotale : Real from Standard;
|
||||
myWithShare : Boolean from Standard;
|
||||
vertices : DataMapOfVertexInteger from BRepMesh;
|
||||
edges : DataMapOfShapePairOfPolygon from BRepMesh;
|
||||
internaledges: DataMapOfShapePairOfPolygon from BRepMesh;
|
||||
nbLocat : Integer from Standard;
|
||||
Location3d : DataMapOfIntegerPnt from BRepMesh;
|
||||
structure : DataStructureOfDelaun from BRepMesh;
|
||||
mapattrib : DataMapOfFaceAttribute from BRepMesh;
|
||||
myvemap : IndexedMapOfInteger from TColStd;
|
||||
mylocation2d : DataMapOfIntegerListOfXY from BRepMesh;
|
||||
myrelative : Boolean from Standard;
|
||||
myshapetrigu : Boolean from Standard;
|
||||
myinshape : Boolean from Standard;
|
||||
myInternalVerticesMode : Boolean from Standard; --mode to accounting internal vertices
|
||||
myfacestate : Status from BRepMesh;
|
||||
mapdefle : DataMapOfShapeReal from TopTools;
|
||||
mynottriangulated : ListOfShape from TopTools;
|
||||
myAllocator : BaseAllocator from MeshDS;
|
||||
|
||||
end FastDiscret;
|
1617
src/BRepMesh/BRepMesh_FastDiscret.cxx
Executable file
1617
src/BRepMesh/BRepMesh_FastDiscret.cxx
Executable file
File diff suppressed because it is too large
Load Diff
117
src/BRepMesh/BRepMesh_FastDiscret.lxx
Executable file
117
src/BRepMesh/BRepMesh_FastDiscret.lxx
Executable file
@@ -0,0 +1,117 @@
|
||||
// File: BRepMesh_FastDiscret.lxx
|
||||
// Created: Fri Sep 26 16:39:53 2003
|
||||
// Author: Open CASCADE Support
|
||||
// <support@opencascade.com>
|
||||
// Copyright: Open CASCADE 2003
|
||||
|
||||
#include <BRepMesh_DataStructureOfDelaun.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : InternalVerticesMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean& BRepMesh_FastDiscret::InternalVerticesMode ()
|
||||
{
|
||||
return myInternalVerticesMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepMesh_FastDiscret::GetDeflection() const
|
||||
{
|
||||
return mydeflection;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetAngle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepMesh_FastDiscret::GetAngle() const
|
||||
{
|
||||
return myangle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMapOfDefEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopTools_DataMapOfShapeReal& BRepMesh_FastDiscret::GetMapOfDefEdge() const
|
||||
{
|
||||
return mapdefle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EdgesOfDomain
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BRepMesh_FastDiscret::EdgesOfDomain(MeshDS_MapOfInteger& Indices) const
|
||||
{
|
||||
Indices = structure->LinkOfDomain();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TrianglesOfDomain
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BRepMesh_FastDiscret::TrianglesOfDomain(MeshDS_MapOfInteger& Indices) const
|
||||
{
|
||||
Indices = structure->ElemOfDomain();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbPoint3d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BRepMesh_FastDiscret::NbPoint3d() const
|
||||
{
|
||||
return nbLocat;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Point3d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const gp_Pnt& BRepMesh_FastDiscret::Point3d(const Standard_Integer Index) const
|
||||
{
|
||||
return Location3d(Index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WithShare
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepMesh_FastDiscret::WithShare() const
|
||||
{
|
||||
return myWithShare;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepMesh_FastDiscret::InShape() const
|
||||
{
|
||||
return myinshape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeTrigu
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean BRepMesh_FastDiscret::ShapeTrigu() const
|
||||
{
|
||||
return myshapetrigu;
|
||||
}
|
165
src/BRepMesh/BRepMesh_FastDiscretFace.cdl
Executable file
165
src/BRepMesh/BRepMesh_FastDiscretFace.cdl
Executable file
@@ -0,0 +1,165 @@
|
||||
-- File: BRepMesh_FastDiscretFace.cdl
|
||||
-- Created: Tue Oct 28 14:10:54 2008
|
||||
-- Author:
|
||||
-- <epa@TOSTEX>
|
||||
---Copyright: Matra Datavision 2008
|
||||
|
||||
private class FastDiscretFace from BRepMesh inherits TShared from MMgt
|
||||
|
||||
---Purpose: Algorithm to mesh a face with respect of the
|
||||
-- frontier the deflection and by option the shared
|
||||
-- components.
|
||||
|
||||
|
||||
uses Boolean from Standard,
|
||||
Integer from Standard,
|
||||
Real from Standard,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
ListOfShape from TopTools,
|
||||
Dir from gp,
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
XY from gp,
|
||||
HSurface from BRepAdaptor,
|
||||
Delaun from BRepMesh,
|
||||
DataStructureOfDelaun from BRepMesh,
|
||||
DataMapOfVertexInteger from BRepMesh,
|
||||
DataMapOfIntegerListOfXY from BRepMesh,
|
||||
DataMapOfShapeReal from TopTools,
|
||||
ListOfVertex from BRepMesh,
|
||||
ClassifierPtr from BRepMesh,
|
||||
Triangle from BRepMesh,
|
||||
Edge from BRepMesh,
|
||||
Vertex from BRepMesh,
|
||||
Status from BRepMesh,
|
||||
FaceAttribute from BRepMesh,
|
||||
Curve from Geom2d,
|
||||
ListOfInteger from TColStd,
|
||||
BaseAllocator from MeshDS,
|
||||
MapOfInteger from MeshDS,
|
||||
DataMapOfIntegerPnt from BRepMesh,
|
||||
IndexedMapOfInteger from TColStd,
|
||||
IndexedMapOfReal from TColStd,
|
||||
DataMapOfShapePairOfPolygon from BRepMesh
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create (angle : Real from Standard;
|
||||
withShare : Boolean from Standard=Standard_True;
|
||||
inshape : Boolean from Standard=Standard_False;
|
||||
shapetrigu : Boolean from Standard=Standard_False)
|
||||
returns mutable FastDiscretFace from BRepMesh;
|
||||
|
||||
|
||||
|
||||
|
||||
Add (me : mutable;
|
||||
face : Face from TopoDS;
|
||||
attrib : FaceAttribute from BRepMesh;
|
||||
mapdefle : DataMapOfShapeReal from TopTools)
|
||||
is static;
|
||||
|
||||
|
||||
Add (me : mutable;
|
||||
theVert: Vertex from TopoDS;
|
||||
face : Face from TopoDS;
|
||||
S : HSurface from BRepAdaptor) is private;
|
||||
|
||||
Update (me: mutable;
|
||||
Edge: Edge from TopoDS;
|
||||
Face: Face from TopoDS;
|
||||
C : Curve from Geom2d;
|
||||
defedge: Real from Standard;
|
||||
first : Real from Standard;
|
||||
last : Real from Standard)
|
||||
|
||||
returns Boolean;
|
||||
|
||||
|
||||
InternalVertices
|
||||
(me : mutable;
|
||||
caro : HSurface from BRepAdaptor;
|
||||
inter : in out ListOfVertex from BRepMesh;
|
||||
defedge : Real from Standard;
|
||||
classifier : ClassifierPtr from BRepMesh)
|
||||
is static private;
|
||||
|
||||
|
||||
Control
|
||||
(me : mutable;
|
||||
caro : HSurface from BRepAdaptor;
|
||||
defface : Real from Standard;
|
||||
inter : in out ListOfVertex from BRepMesh;
|
||||
badTri : in out ListOfInteger from TColStd;
|
||||
nulTri : in out ListOfInteger from TColStd;
|
||||
trigu : in out Delaun from BRepMesh;
|
||||
isfirst : Boolean from Standard)
|
||||
returns Real from Standard is static;
|
||||
|
||||
FindUV(me: mutable; V: Vertex from TopoDS;
|
||||
XY: Pnt2d from gp;
|
||||
ip: Integer from Standard;
|
||||
S : HSurface from BRepAdaptor;
|
||||
mindist: Real from Standard)
|
||||
returns XY from gp;
|
||||
|
||||
AddInShape(me: mutable; face : Face from TopoDS;
|
||||
defedge: Real from Standard)
|
||||
is static private;
|
||||
|
||||
|
||||
-- Output :
|
||||
|
||||
Triangle (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the triangle of <Index>.
|
||||
---C++: return const &
|
||||
returns Triangle from BRepMesh
|
||||
is static;
|
||||
|
||||
Edge (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the edge of index <Index>.
|
||||
---C++: return const &
|
||||
returns Edge from BRepMesh
|
||||
is static;
|
||||
|
||||
|
||||
Vertex (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the vertex of <Index>.
|
||||
---C++: return const &
|
||||
returns Vertex from BRepMesh
|
||||
is static;
|
||||
|
||||
Pnt (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Gives the location3d of the vertex of <Index>.
|
||||
---C++: return const &
|
||||
returns Pnt from gp
|
||||
is static;
|
||||
|
||||
fields
|
||||
angle : Real from Standard;
|
||||
WithShare : Boolean from Standard;
|
||||
vertices : DataMapOfVertexInteger from BRepMesh;
|
||||
edges : DataMapOfShapePairOfPolygon from BRepMesh;
|
||||
internaledges: DataMapOfShapePairOfPolygon from BRepMesh;
|
||||
nbLocat : Integer from Standard;
|
||||
Location3d : DataMapOfIntegerPnt from BRepMesh;
|
||||
structure : DataStructureOfDelaun from BRepMesh;
|
||||
mylistver : ListOfVertex from BRepMesh;
|
||||
myvemap : IndexedMapOfInteger from TColStd;
|
||||
mylocation2d : DataMapOfIntegerListOfXY from BRepMesh;
|
||||
myattrib : FaceAttribute from BRepMesh;
|
||||
myshapetrigu : Boolean from Standard;
|
||||
myinshape : Boolean from Standard;
|
||||
myInternalVerticesMode : Boolean from Standard; --mode to accounting internal vertices
|
||||
myUParam : IndexedMapOfReal from TColStd;
|
||||
myVParam : IndexedMapOfReal from TColStd;
|
||||
myAllocator : BaseAllocator from MeshDS;
|
||||
|
||||
end FastDiscretFace;
|
1934
src/BRepMesh/BRepMesh_FastDiscretFace.cxx
Executable file
1934
src/BRepMesh/BRepMesh_FastDiscretFace.cxx
Executable file
File diff suppressed because it is too large
Load Diff
67
src/BRepMesh/BRepMesh_GeomTool.cdl
Executable file
67
src/BRepMesh/BRepMesh_GeomTool.cdl
Executable file
@@ -0,0 +1,67 @@
|
||||
-- File: BRepMesh_GeomTool.cdl
|
||||
-- Created: Wed Sep 29 16:25:06 1993
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@zerox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class GeomTool from BRepMesh
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Pnt from gp,
|
||||
Vec from gp,
|
||||
Dir from gp,
|
||||
Pnt2d from gp,
|
||||
IsoType from GeomAbs,
|
||||
TangentialDeflection from GCPnts,
|
||||
Curve from BRepAdaptor,
|
||||
HSurface from BRepAdaptor
|
||||
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create (C : in out Curve from BRepAdaptor;
|
||||
Ufirst,Ulast,AngDefl, Deflection : Real;
|
||||
nbpointsmin: Integer = 2)
|
||||
returns GeomTool;
|
||||
|
||||
Create (S : HSurface from BRepAdaptor;
|
||||
ParamIso : Real;
|
||||
Type : IsoType from GeomAbs;
|
||||
Ufirst,Ulast,AngDefl,Deflection : Real;
|
||||
nbpointsmin: Integer = 2) returns GeomTool;
|
||||
|
||||
AddPoint(me : in out; thePnt : in Pnt from gp;
|
||||
theParam : in Real;
|
||||
theIsReplace : in Boolean = Standard_True)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Add point to already calculated points (or replace existing)
|
||||
-- Returns index of new added point
|
||||
-- or founded with parametric tolerance (replaced if theIsReplace is true)
|
||||
|
||||
NbPoints(me) returns Integer from Standard;
|
||||
|
||||
Value(me; IsoParam : Real ; Index : Integer ;
|
||||
W : out Real; P : out Pnt from gp; UV : out Pnt2d from gp);
|
||||
|
||||
Value(me;C : Curve from BRepAdaptor;
|
||||
S : HSurface from BRepAdaptor;
|
||||
Index : Integer from Standard;
|
||||
W : out Real; P : out Pnt from gp; UV : out Pnt2d from gp);
|
||||
|
||||
D0(myclass; F : HSurface from BRepAdaptor;U,V : Real; P : out Pnt);
|
||||
|
||||
Normal(myclass; F : HSurface from BRepAdaptor;U,V : Real ; P : out Pnt from gp;
|
||||
Nor : out Dir from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: return false if the normal can not be computed
|
||||
|
||||
fields
|
||||
|
||||
pnts : TangentialDeflection from GCPnts;
|
||||
parametric : IsoType from GeomAbs;
|
||||
|
||||
end GeomTool;
|
106
src/BRepMesh/BRepMesh_GeomTool.cxx
Executable file
106
src/BRepMesh/BRepMesh_GeomTool.cxx
Executable file
@@ -0,0 +1,106 @@
|
||||
// File: BRepMesh_GeomTool.cxx
|
||||
// Created: Wed Sep 29 16:25:06 1993
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@zerox>
|
||||
// Copyright: Matra Datavision 1993
|
||||
|
||||
#include <BRepMesh_GeomTool.ixx>
|
||||
|
||||
#include <BRepMesh_ShapeTool.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <CSLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Adaptor3d_IsoCurve.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
|
||||
BRepMesh_GeomTool::BRepMesh_GeomTool(BRepAdaptor_Curve& C,
|
||||
const Standard_Real Ufirst,
|
||||
const Standard_Real Ulast,
|
||||
const Standard_Real AngDefl,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Integer nbpmin) :
|
||||
pnts(C,Ufirst,Ulast,AngDefl,Deflection, nbpmin),
|
||||
// pnts(C,Deflection,Ufirst,Ulast),
|
||||
parametric(GeomAbs_NoneIso)
|
||||
{
|
||||
}
|
||||
//
|
||||
BRepMesh_GeomTool::BRepMesh_GeomTool(const Handle(BRepAdaptor_HSurface)& S,
|
||||
const Standard_Real ParamIso,
|
||||
const GeomAbs_IsoType Type,
|
||||
const Standard_Real Ufirst,
|
||||
const Standard_Real Ulast,
|
||||
const Standard_Real AngDefl,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Integer nbpmin) :
|
||||
parametric(Type)
|
||||
{
|
||||
Adaptor3d_IsoCurve Iso(S, Type,ParamIso,Ufirst,Ulast);
|
||||
pnts.Initialize(Iso,Ufirst,Ulast,AngDefl,Deflection, nbpmin);
|
||||
// pnts.Initialize(Iso,Deflection,Ufirst,Ulast);
|
||||
}
|
||||
|
||||
Standard_Integer BRepMesh_GeomTool::AddPoint(const gp_Pnt& thePnt,
|
||||
const Standard_Real theParam,
|
||||
const Standard_Boolean theIsReplace)
|
||||
{
|
||||
return pnts.AddPoint(thePnt, theParam, theIsReplace);
|
||||
}
|
||||
|
||||
Standard_Integer BRepMesh_GeomTool::NbPoints() const {
|
||||
return pnts.NbPoints();
|
||||
}
|
||||
|
||||
void BRepMesh_GeomTool::Value(const Standard_Real IsoParam,
|
||||
const Standard_Integer Index,
|
||||
Standard_Real& W, gp_Pnt& P, gp_Pnt2d& UV) const
|
||||
{
|
||||
P = pnts.Value(Index);
|
||||
W = pnts.Parameter(Index);
|
||||
if (parametric == GeomAbs_IsoU) {
|
||||
UV.SetCoord(IsoParam,W);
|
||||
}
|
||||
else {
|
||||
UV.SetCoord(W,IsoParam);
|
||||
}
|
||||
}
|
||||
|
||||
void BRepMesh_GeomTool::Value(const BRepAdaptor_Curve& C,
|
||||
const Handle(BRepAdaptor_HSurface)& S,
|
||||
const Standard_Integer Index,
|
||||
Standard_Real& W, gp_Pnt& P, gp_Pnt2d& UV) const
|
||||
{
|
||||
P = pnts.Value(Index);
|
||||
W = pnts.Parameter(Index);
|
||||
BRepMesh_ShapeTool::Parameters(C.Edge(), ((BRepAdaptor_Surface*)&(S->Surface()))->Face(), W, UV);
|
||||
}
|
||||
|
||||
void BRepMesh_GeomTool::D0(const Handle(BRepAdaptor_HSurface)& S,const Standard_Real U,
|
||||
const Standard_Real V,gp_Pnt& P)
|
||||
{
|
||||
S->D0(U,V,P);
|
||||
}
|
||||
|
||||
Standard_Boolean BRepMesh_GeomTool::Normal(const Handle(BRepAdaptor_HSurface)& S,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P,
|
||||
gp_Dir& Nor)
|
||||
{
|
||||
Standard_Boolean OK = Standard_True;
|
||||
gp_Vec D1U,D1V;
|
||||
CSLib_DerivativeStatus Status;
|
||||
S->D1(U,V,P,D1U,D1V);
|
||||
CSLib::Normal(D1U,D1V,Standard_Real(Precision::Angular()),Status,Nor);
|
||||
if (Status!= CSLib_Done) {
|
||||
gp_Vec D2U,D2V,D2UV;
|
||||
S->D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
|
||||
CSLib_NormalStatus NStat;
|
||||
CSLib::Normal(D1U,D1V,D2U,D2V,D2UV,Precision::Angular(),OK,NStat,Nor);
|
||||
}
|
||||
if (OK) {
|
||||
if (BRepMesh_ShapeTool::Orientation(((BRepAdaptor_Surface*)&(S->Surface()))->Face()) == TopAbs_REVERSED) Nor.Reverse();
|
||||
}
|
||||
return OK;
|
||||
}
|
91
src/BRepMesh/BRepMesh_IncrementalMesh.cdl
Executable file
91
src/BRepMesh/BRepMesh_IncrementalMesh.cdl
Executable file
@@ -0,0 +1,91 @@
|
||||
-- File: BRepMesh_IncrementalMesh.cdl
|
||||
-- Created: Tue Jun 20 10:19:28 1995
|
||||
-- Author: Stagiaire Alain JOURDAIN
|
||||
-- <ajo@phobox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class IncrementalMesh from BRepMesh
|
||||
inherits DiscretRoot from BRepMesh
|
||||
|
||||
---Purpose: Builds the mesh of a shape with respect of their
|
||||
-- correctly triangulated parts
|
||||
--
|
||||
|
||||
|
||||
uses
|
||||
Box from Bnd,
|
||||
Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
MapOfShape from TopTools,
|
||||
IndexedDataMapOfShapeListOfShape from TopTools,
|
||||
DataMapOfShapeReal from TopTools,
|
||||
FastDiscret from BRepMesh
|
||||
|
||||
is
|
||||
Create
|
||||
returns IncrementalMesh from BRepMesh;
|
||||
---C++: alias "Standard_EXPORT virtual ~BRepMesh_IncrementalMesh();"
|
||||
|
||||
Create(S : Shape from TopoDS;
|
||||
D : Real from Standard;
|
||||
Relatif: Boolean from Standard = Standard_False;
|
||||
Ang : Real from Standard = 0.5)
|
||||
---Purpose: if the boolean <Relatif> is True, the
|
||||
-- deflection used for the polygonalisation of
|
||||
-- each edge will be <D> * Size of Edge.
|
||||
-- the deflection used for the faces will be the maximum
|
||||
-- deflection of their edges.
|
||||
returns IncrementalMesh from BRepMesh;
|
||||
|
||||
SetRelative(me:out;
|
||||
theFlag : Boolean from Standard);
|
||||
|
||||
Relative(me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Init(me:out)
|
||||
is redefined protected;
|
||||
|
||||
Perform(me:out)
|
||||
is redefined;
|
||||
|
||||
Update(me:out;
|
||||
S : Shape from TopoDS)
|
||||
---Purpose: Builds the incremental mesh of the shape
|
||||
is static;
|
||||
|
||||
IsModified(me) returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
Update(me : in out;
|
||||
E : Edge from TopoDS)
|
||||
---Purpose: Locate a correct discretisation if it exists
|
||||
-- Set no one otherwise
|
||||
is static private;
|
||||
|
||||
Update(me : in out;
|
||||
F : Face from TopoDS)
|
||||
---Purpose: if the face is not correctly triangulated, or
|
||||
-- if one of its edges is to be discretisated
|
||||
-- correctly, the triangulation of this face is
|
||||
-- built.
|
||||
is static private;
|
||||
|
||||
|
||||
fields
|
||||
myRelative : Boolean from Standard is protected;
|
||||
myMap : MapOfShape from TopTools is protected;
|
||||
myMesh : FastDiscret from BRepMesh is protected;
|
||||
myModified : Boolean from Standard is protected;
|
||||
mymapedge : DataMapOfShapeReal from TopTools is protected;
|
||||
myancestors : IndexedDataMapOfShapeListOfShape from TopTools is protected;
|
||||
mydtotale : Real from Standard is protected;
|
||||
myBox : Box from Bnd is protected;
|
||||
|
||||
end IncrementalMesh;
|
||||
|
||||
|
||||
|
||||
|
485
src/BRepMesh/BRepMesh_IncrementalMesh.cxx
Executable file
485
src/BRepMesh/BRepMesh_IncrementalMesh.cxx
Executable file
@@ -0,0 +1,485 @@
|
||||
// File: BRepMesh_IncrementalMesh.cxx
|
||||
// Created: Tue Jun 20 10:34:51 1995
|
||||
// Author: Stagiaire Alain JOURDAIN
|
||||
// <ajo@phobox>
|
||||
|
||||
|
||||
#include <BRepMesh_IncrementalMesh.ixx>
|
||||
|
||||
#include <BRepMesh.hxx>
|
||||
#include <BRepMesh_Edge.hxx>
|
||||
#include <BRepMesh_Triangle.hxx>
|
||||
#include <BRepMesh_FastDiscretFace.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <GCPnts_TangentialDeflection.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopTools_HArray1OfShape.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
|
||||
#include <vector>
|
||||
|
||||
// NOTE: to be replaced by more correct check
|
||||
// #if defined(WNT) || defined(LIN)
|
||||
// #define HAVE_TBB 1
|
||||
// #endif
|
||||
|
||||
// paralleling with Intel TBB
|
||||
#ifdef HAVE_TBB
|
||||
#include <tbb/parallel_for_each.h>
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_IncrementalMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
|
||||
: myRelative(Standard_False),
|
||||
myModified(Standard_False)
|
||||
{
|
||||
mymapedge.Clear();
|
||||
myancestors.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_IncrementalMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepMesh_IncrementalMesh::
|
||||
BRepMesh_IncrementalMesh(const TopoDS_Shape& S,
|
||||
const Standard_Real D,
|
||||
const Standard_Boolean Rel,
|
||||
const Standard_Real Ang) :
|
||||
myRelative(Rel),
|
||||
myModified(Standard_False)
|
||||
{
|
||||
mymapedge.Clear();
|
||||
myancestors.Clear();
|
||||
myDeflection = D;
|
||||
myAngle = Ang;
|
||||
myShape = S;
|
||||
|
||||
//
|
||||
Perform();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::Init()
|
||||
{
|
||||
myModified=Standard_False;
|
||||
mymapedge.Clear();
|
||||
myancestors.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRelative
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::SetRelative(const Standard_Boolean theFlag)
|
||||
{
|
||||
myRelative=theFlag;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Relative
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_IncrementalMesh::Relative()const
|
||||
{
|
||||
return myRelative;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsModified
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_IncrementalMesh::IsModified() const
|
||||
{
|
||||
return myModified;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::Perform()
|
||||
{
|
||||
Bnd_Box aBox;
|
||||
//
|
||||
SetDone();
|
||||
//
|
||||
Init();
|
||||
//
|
||||
BRepBndLib::Add(myShape, aBox);
|
||||
if (aBox.IsVoid() == Standard_False)
|
||||
{
|
||||
myBox = aBox;
|
||||
//
|
||||
if (!myMesh.IsNull()) {
|
||||
myMesh.Nullify();
|
||||
}
|
||||
//
|
||||
myMesh = new BRepMesh_FastDiscret(myDeflection,
|
||||
myAngle,
|
||||
aBox,
|
||||
Standard_True,
|
||||
Standard_True,
|
||||
myRelative,
|
||||
Standard_True);
|
||||
//
|
||||
Update(myShape);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Update(shape)
|
||||
//purpose : Builds the incremental mesh of the shape
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::Update(const TopoDS_Shape& S)
|
||||
|
||||
{
|
||||
myModified = Standard_False;
|
||||
TopExp_Explorer ex;
|
||||
|
||||
Standard_Real TXmin, TYmin, TZmin, TXmax, TYmax, TZmax;
|
||||
Standard_Real dx, dy, dz;
|
||||
|
||||
//AGV 080407: Since version 6.2.0 there would be exception without this check
|
||||
if (myBox.IsVoid())
|
||||
return;
|
||||
|
||||
myBox.Get(TXmin, TYmin, TZmin, TXmax, TYmax, TZmax);
|
||||
dx = TXmax-TXmin;
|
||||
dy = TYmax-TYmin;
|
||||
dz = TZmax-TZmin;
|
||||
mydtotale = dx;
|
||||
if (dy > mydtotale) mydtotale = dy;
|
||||
if (dz > mydtotale) mydtotale = dz;
|
||||
|
||||
for (ex.Init(S, TopAbs_EDGE); ex.More(); ex.Next()) {
|
||||
if(BRep_Tool::IsGeometric(TopoDS::Edge(ex.Current()))) {
|
||||
Update(TopoDS::Edge(ex.Current()));
|
||||
}
|
||||
}
|
||||
|
||||
// get list of faces
|
||||
TopTools_ListOfShape LF;
|
||||
BRepLib::ReverseSortFaces(S,LF);
|
||||
|
||||
// make array of faces suitable for processing (excluding faces without surface)
|
||||
std::vector<TopoDS_Face> aFaces;
|
||||
for (TopTools_ListIteratorOfListOfShape it(LF); it.More(); it.Next())
|
||||
{
|
||||
TopoDS_Face F = TopoDS::Face(it.Value());
|
||||
|
||||
TopLoc_Location L1;
|
||||
const Handle(Geom_Surface)& Surf = BRep_Tool::Surface(F, L1);
|
||||
if(Surf.IsNull())
|
||||
continue;
|
||||
|
||||
Update (F);
|
||||
aFaces.push_back (F);
|
||||
}
|
||||
|
||||
// mesh faces in parallel threads using TBB
|
||||
#ifdef HAVE_TBB
|
||||
if (Standard::IsReentrant())
|
||||
tbb::parallel_for_each (aFaces.begin(), aFaces.end(), *myMesh.operator->());
|
||||
else
|
||||
#endif
|
||||
for (std::vector<TopoDS_Face>::iterator it(aFaces.begin()); it != aFaces.end(); it++)
|
||||
myMesh->Process (*it);
|
||||
|
||||
// maillage des edges non contenues dans les faces :
|
||||
Standard_Real f, l, defedge;
|
||||
Standard_Integer i, nbNodes;
|
||||
TopLoc_Location L;
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
ex.Init(S ,TopAbs_EDGE, TopAbs_FACE);
|
||||
|
||||
while (ex.More()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(ex.Current());
|
||||
|
||||
if(!BRep_Tool::IsGeometric(E)) {
|
||||
ex.Next();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (myRelative) {
|
||||
Bnd_Box B;
|
||||
BRepBndLib::Add(E, B);
|
||||
B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
dx = aXmax-aXmin;
|
||||
dy = aYmax-aYmin;
|
||||
dz = aZmax-aZmin;
|
||||
defedge = dx;
|
||||
if (defedge < dy) defedge = dy;
|
||||
if (defedge < dz) defedge = dz;
|
||||
// ajustement par rapport a la taille totale:
|
||||
Standard_Real cdef = mydtotale/(2*defedge);
|
||||
if (cdef < 0.5) cdef = 0.5;
|
||||
if (cdef > 2.) cdef = 2.;
|
||||
defedge = cdef * defedge * myDeflection;
|
||||
}
|
||||
else defedge = myDeflection;
|
||||
|
||||
Handle(Poly_Polygon3D) P3D = BRep_Tool::Polygon3D(E, L);
|
||||
Standard_Boolean maill = Standard_False;
|
||||
if (P3D.IsNull()) {
|
||||
maill = Standard_True;
|
||||
}
|
||||
else if (P3D->Deflection() > 1.1*defedge) {
|
||||
maill = Standard_True;
|
||||
}
|
||||
if (maill) {
|
||||
BRepAdaptor_Curve C(E);
|
||||
f = C.FirstParameter();
|
||||
l = C.LastParameter();
|
||||
|
||||
GCPnts_TangentialDeflection TD(C, f, l, myAngle, defedge, 2);
|
||||
nbNodes = TD.NbPoints();
|
||||
|
||||
TColgp_Array1OfPnt Nodes(1, nbNodes);
|
||||
TColStd_Array1OfReal UVNodes(1, nbNodes);
|
||||
for ( i = 1; i <= nbNodes; i++) {
|
||||
Nodes(i) = TD.Value(i);
|
||||
UVNodes(i) = TD.Parameter(i);
|
||||
}
|
||||
|
||||
BRep_Builder B;
|
||||
Handle(Poly_Polygon3D) P = new Poly_Polygon3D(Nodes, UVNodes);
|
||||
P->Deflection(myDeflection);
|
||||
B.UpdateEdge(E, P);
|
||||
}
|
||||
|
||||
ex.Next();
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Update(edge)
|
||||
//purpose : Locate a correct discretisation if it exists
|
||||
// Set no one otherwise
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::Update(const TopoDS_Edge& E)
|
||||
{
|
||||
TopLoc_Location l;
|
||||
Standard_Integer i = 1;
|
||||
Handle(Poly_Triangulation) T, TNull;
|
||||
Handle(Poly_PolygonOnTriangulation) Poly, NullPoly;
|
||||
Standard_Boolean found = Standard_False;
|
||||
Standard_Real defedge;
|
||||
BRep_Builder B;
|
||||
Standard_Boolean defined = Standard_False;
|
||||
|
||||
do {
|
||||
BRep_Tool::PolygonOnTriangulation(E, Poly, T, l, i);
|
||||
i++;
|
||||
if (!T.IsNull() && !Poly.IsNull()) {
|
||||
if (!defined) {
|
||||
if (myRelative) {
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(E, aBox);
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dx, dy, dz;
|
||||
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
dx = aXmax-aXmin;
|
||||
dy = aYmax-aYmin;
|
||||
dz = aZmax-aZmin;
|
||||
defedge = dx;
|
||||
if (defedge < dy) defedge = dy;
|
||||
if (defedge < dz) defedge = dz;
|
||||
// ajustement par rapport a la taille totale:
|
||||
Standard_Real cdef = mydtotale/(2*defedge);
|
||||
if (cdef < 0.5) cdef = 0.5;
|
||||
if (cdef > 2.) cdef = 2.;
|
||||
defedge = cdef * defedge * myDeflection;
|
||||
}
|
||||
else defedge = myDeflection;
|
||||
mymapedge.Bind(E, defedge);
|
||||
defined = Standard_True;
|
||||
}
|
||||
if ((!myRelative && Poly->Deflection() <= 1.1*defedge) ||
|
||||
(myRelative && Poly->Deflection() <= 1.1*defedge))
|
||||
found = Standard_True;
|
||||
else {
|
||||
myModified = Standard_True;
|
||||
B.UpdateEdge(E, NullPoly, T, l);
|
||||
}
|
||||
}
|
||||
} while (!Poly.IsNull());
|
||||
|
||||
if (!found) myMap.Add(E);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Update(face)
|
||||
//purpose : If the face is not correctly triangulated, or if one of its
|
||||
// edges is to be discretisated correctly, the triangulation
|
||||
// of this face is built.
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::Update(const TopoDS_Face& F)
|
||||
{
|
||||
TopLoc_Location l;
|
||||
Handle(Geom_Surface) SS = BRep_Tool::Surface(F, l);
|
||||
if (SS.IsNull()) return;
|
||||
|
||||
//Standard_Integer i;
|
||||
Standard_Boolean WillBeTriangulated = Standard_False;
|
||||
Handle(Poly_Triangulation) T, TNull;
|
||||
T = BRep_Tool::Triangulation(F, l);
|
||||
Handle(Poly_PolygonOnTriangulation) Poly, NullPoly;
|
||||
|
||||
BRep_Builder B;
|
||||
TopExp_Explorer ex;
|
||||
|
||||
Standard_Real defedge, defface;
|
||||
Standard_Integer nbEdge = 0;
|
||||
if (myRelative) {
|
||||
defface = 0.;
|
||||
|
||||
for (ex.Init(F, TopAbs_EDGE); ex.More(); ex.Next()) {
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(ex.Current());
|
||||
nbEdge++;
|
||||
if (mymapedge.IsBound(edge)) {
|
||||
defedge = mymapedge(edge);
|
||||
}
|
||||
else {
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(edge, aBox);
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, dx, dy, dz;
|
||||
aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
dx = aXmax-aXmin;
|
||||
dy = aYmax-aYmin;
|
||||
dz = aZmax-aZmin;
|
||||
defedge = dx;
|
||||
if (defedge < dy) defedge = dy;
|
||||
if (defedge < dz) defedge = dz;
|
||||
// ajustement par rapport a la taille totale:
|
||||
Standard_Real cdef = mydtotale/(2*defedge);
|
||||
if (cdef < 0.5) cdef = 0.5;
|
||||
if (cdef > 2.) cdef = 2.;
|
||||
defedge = cdef * defedge * myDeflection;
|
||||
}
|
||||
defface = defface + defedge;
|
||||
}
|
||||
if (nbEdge != 0) defface = defface / nbEdge;
|
||||
else defface = myDeflection;
|
||||
}
|
||||
else
|
||||
defface = myDeflection;
|
||||
|
||||
if (!T.IsNull()) {
|
||||
if ((!myRelative && T->Deflection() <= 1.1*defface) ||
|
||||
(myRelative && T->Deflection() <= 1.1*defface)) {
|
||||
for (ex.Init(F, TopAbs_EDGE);
|
||||
ex.More();
|
||||
ex.Next()) {
|
||||
const TopoDS_Shape& E = ex.Current();
|
||||
Poly = BRep_Tool::PolygonOnTriangulation(TopoDS::Edge(E), T, l);
|
||||
if (Poly.IsNull() || myMap.Contains(E)) {
|
||||
WillBeTriangulated = Standard_True;
|
||||
// cas un peu special. la triangulation est bonne, mais
|
||||
// l'edge n'a pas de representation polygonalisee sur celle-ci.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else WillBeTriangulated = Standard_True;
|
||||
}
|
||||
|
||||
if (WillBeTriangulated || T.IsNull()) {
|
||||
myModified = Standard_True;
|
||||
if (!T.IsNull()) {
|
||||
for (ex.Init(F, TopAbs_EDGE); ex.More(); ex.Next()) {
|
||||
B.UpdateEdge(TopoDS::Edge(ex.Current()), NullPoly, T, l);
|
||||
myMap.Remove(ex.Current());
|
||||
}
|
||||
B.UpdateFace(F, TNull);
|
||||
}
|
||||
myMesh->Add(F);
|
||||
if (myMesh->CurrentFaceStatus() == BRepMesh_ReMesh) {
|
||||
#ifdef DEB_MESH
|
||||
cout << " face remaillee + finement que prevu."<< endl;
|
||||
#endif
|
||||
|
||||
Standard_Integer index;
|
||||
if( myancestors.Extent() < 1 )
|
||||
TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,myancestors);
|
||||
|
||||
TopTools_MapOfShape MShape;
|
||||
MShape.Add(F);
|
||||
|
||||
TopoDS_Iterator ex(F),ex2;
|
||||
for (; ex.More(); ex.Next()) {
|
||||
const TopoDS_Shape& aWire = ex.Value();
|
||||
if (aWire.ShapeType() != TopAbs_WIRE)
|
||||
continue;
|
||||
TopoDS_Iterator exW(aWire);
|
||||
for(; exW.More(); exW.Next()) {
|
||||
const TopoDS_Edge& edge = TopoDS::Edge(exW.Value());
|
||||
index = myancestors.FindIndex(edge);
|
||||
if (index != 0) {
|
||||
const TopTools_ListOfShape& L = myancestors.FindFromKey(edge);
|
||||
|
||||
TopTools_ListIteratorOfListOfShape it(L);
|
||||
|
||||
for (; it.More(); it.Next()) {
|
||||
TopoDS_Face F2 = TopoDS::Face(it.Value());
|
||||
if (!MShape.Contains(F2)) {
|
||||
MShape.Add(F2);
|
||||
T = BRep_Tool::Triangulation(F2, l);
|
||||
if (!T.IsNull()) {
|
||||
#ifdef DEB_MESH
|
||||
cout <<"triangulation a refaire" <<endl;
|
||||
#endif
|
||||
for (ex2.Initialize(F2); ex2.More(); ex2.Next()) {
|
||||
const TopoDS_Shape& aWire2 = ex2.Value();
|
||||
if (aWire2.ShapeType() != TopAbs_WIRE)
|
||||
continue;
|
||||
TopoDS_Iterator exW2(aWire2);
|
||||
for(; exW2.More(); exW2.Next()) {
|
||||
TopoDS_Edge E2 = TopoDS::Edge(exW2.Value());
|
||||
B.UpdateEdge(E2, NullPoly, T, l);
|
||||
}
|
||||
}
|
||||
B.UpdateFace(F2, TNull);
|
||||
myMesh->Add(F2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
45
src/BRepMesh/BRepMesh_PairOfPolygon.cdl
Executable file
45
src/BRepMesh/BRepMesh_PairOfPolygon.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: BRepMesh_PairOfPolygonOnTriangulation.cdl
|
||||
-- Created: Mon Jan 26 11:03:30 2009
|
||||
-- Author: Pavel TELKOV
|
||||
-- <ptv@valenox>
|
||||
---Copyright: Open CASCADE 2009
|
||||
|
||||
|
||||
class PairOfPolygon from BRepMesh
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
PolygonOnTriangulation from Poly
|
||||
|
||||
is
|
||||
Create
|
||||
---Purpose: Create empty pair with null fileds
|
||||
returns PairOfPolygon from BRepMesh;
|
||||
|
||||
Clear(me: out);
|
||||
---Purpose: Clear pair handles
|
||||
|
||||
Prepend (me: out; thePoly: PolygonOnTriangulation from Poly);
|
||||
--- Initialise first polygon on triangulation
|
||||
|
||||
Append (me: out; thePoly: PolygonOnTriangulation from Poly);
|
||||
--- Initialise first or last polygon on triangulation
|
||||
|
||||
First(me)
|
||||
---Purpose: Returns first polygon on triangulation
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns PolygonOnTriangulation from Poly;
|
||||
|
||||
Last(me)
|
||||
---Purpose: Returns last polygon on triangulation
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns PolygonOnTriangulation from Poly;
|
||||
|
||||
fields
|
||||
myFirst : PolygonOnTriangulation from Poly;
|
||||
myLast : PolygonOnTriangulation from Poly;
|
||||
|
||||
end PairOfPolygon;
|
52
src/BRepMesh/BRepMesh_PairOfPolygon.cxx
Executable file
52
src/BRepMesh/BRepMesh_PairOfPolygon.cxx
Executable file
@@ -0,0 +1,52 @@
|
||||
// File: BRepMesh_PairOfPolygon.cxx
|
||||
// Created: 26.01.09 11:08:29
|
||||
// Author: Pavel TELKOV
|
||||
// Copyright: Open CASCADE 2009
|
||||
|
||||
#include <BRepMesh_PairOfPolygon.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepMesh_PairOfPolygon::BRepMesh_PairOfPolygon()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepMesh_PairOfPolygon::Clear()
|
||||
{
|
||||
myFirst.Nullify();
|
||||
myLast.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepend
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepMesh_PairOfPolygon::Prepend
|
||||
( const Handle(Poly_PolygonOnTriangulation)& theItem )
|
||||
{
|
||||
myFirst = theItem;
|
||||
if (myLast.IsNull())
|
||||
myLast = theItem;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepMesh_PairOfPolygon::Append
|
||||
( const Handle(Poly_PolygonOnTriangulation)& theItem )
|
||||
{
|
||||
if (myFirst.IsNull())
|
||||
myFirst = theItem;
|
||||
myLast = theItem;
|
||||
}
|
24
src/BRepMesh/BRepMesh_PairOfPolygon.lxx
Executable file
24
src/BRepMesh/BRepMesh_PairOfPolygon.lxx
Executable file
@@ -0,0 +1,24 @@
|
||||
// File: BRepMesh_PairOfPolygon.lxx
|
||||
// Created: 26.01.09 11:24:04
|
||||
// Author: Pavel TELKOV
|
||||
// Copyright: Open CASCADE 2009
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(Poly_PolygonOnTriangulation)& BRepMesh_PairOfPolygon::First() const
|
||||
{
|
||||
return myFirst;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(Poly_PolygonOnTriangulation)& BRepMesh_PairOfPolygon::Last() const
|
||||
{
|
||||
return myLast;
|
||||
}
|
26
src/BRepMesh/BRepMesh_PluginMacro.hxx
Executable file
26
src/BRepMesh/BRepMesh_PluginMacro.hxx
Executable file
@@ -0,0 +1,26 @@
|
||||
// File: BRepMesh_PluginMacro.hxx
|
||||
// Created: Fri Apr 11 09:11:08 2008
|
||||
// Author: Peter KURNEV
|
||||
// <pkv@irinox>
|
||||
|
||||
|
||||
#ifndef BRepMesh_PluginMacro_HeaderFile
|
||||
#define BRepMesh_PluginMacro_HeaderFile
|
||||
|
||||
#define DISCRETPLUGIN(name) \
|
||||
extern "C" {Standard_EXPORT Standard_Integer DISCRETALGO(const TopoDS_Shape& ,\
|
||||
const Standard_Real,\
|
||||
const Standard_Real,\
|
||||
BRepMesh_PDiscretRoot& );} \
|
||||
Standard_Integer DISCRETALGO(const TopoDS_Shape& theShape,\
|
||||
const Standard_Real theDeflection,\
|
||||
const Standard_Real theAngle,\
|
||||
BRepMesh_PDiscretRoot& theAlgo) { \
|
||||
return name::Discret(theShape,\
|
||||
theDeflection,\
|
||||
theAngle,\
|
||||
theAlgo);} \
|
||||
\
|
||||
|
||||
|
||||
#endif
|
164
src/BRepMesh/BRepMesh_ShapeTool.cdl
Executable file
164
src/BRepMesh/BRepMesh_ShapeTool.cdl
Executable file
@@ -0,0 +1,164 @@
|
||||
-- File: BRepMesh_ShapeTool.cdl
|
||||
-- Created: Thu Sep 30 11:06:11 1993
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@zerox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class ShapeTool from BRepMesh
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
Explorer from TopExp,
|
||||
Pnt2d from gp,
|
||||
Pnt from gp,
|
||||
Box from Bnd,
|
||||
Curve from BRepAdaptor,
|
||||
Orientation from TopAbs,
|
||||
Triangulation from Poly,
|
||||
HArray1OfInteger from TColStd
|
||||
|
||||
raises NoSuchObject from Standard
|
||||
|
||||
is
|
||||
Create returns ShapeTool ;
|
||||
|
||||
Init(me : in out ; S : Shape from TopoDS)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
MoreFace(me: in out ) returns Boolean from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
NextFace(me : in out)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
CurrentFace( me : in out) returns Face from TopoDS
|
||||
---C++:return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Init(me : in out ; F: Face from TopoDS)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
MoreEdge(me: in out ) returns Boolean from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
NextEdge(me : in out)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
CurrentEdge(me : in out)
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns Edge from TopoDS
|
||||
is static;
|
||||
|
||||
Init(me : in out ; E : Edge from TopoDS)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
MoreInternalVertex(me: in out ) returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
NextInternalVertex(me : in out)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
CurrentInternalVertex( me : in out) returns Vertex from TopoDS
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Orientation(myclass; F :Face from TopoDS )
|
||||
---C++: inline
|
||||
returns Orientation from TopAbs;
|
||||
|
||||
Orientation(myclass; E : Edge from TopoDS )
|
||||
---C++: inline
|
||||
returns Orientation from TopAbs;
|
||||
|
||||
Bound(myclass; F :Face from TopoDS )
|
||||
returns Box from Bnd;
|
||||
|
||||
Bound(myclass; E : Edge from TopoDS )
|
||||
returns Box from Bnd;
|
||||
|
||||
FirstVertex(myclass; E : Edge from TopoDS )
|
||||
returns Vertex from TopoDS
|
||||
raises NoSuchObject;
|
||||
--if there is not first vertex (semi-infinite edge)
|
||||
|
||||
LastVertex(myclass; E : Edge from TopoDS)
|
||||
returns Vertex from TopoDS
|
||||
raises NoSuchObject;
|
||||
--if there is not last vertex (semi-infinite edge)
|
||||
|
||||
Vertices(myclass; E : Edge from TopoDS;
|
||||
Vfirst, Vlast : out Vertex from TopoDS);
|
||||
---Purpose: If there is not First or Last vertex (infinite or
|
||||
-- semi-infinite edge) return null shapes.
|
||||
|
||||
Range(myclass; E : Edge from TopoDS;
|
||||
F : Face from TopoDS;
|
||||
wFirst, wLast : in out Real from Standard);
|
||||
---C++: inline
|
||||
|
||||
UVPoints(myclass; E : Edge from TopoDS;
|
||||
F : Face from TopoDS;
|
||||
uvFirst, uvLast : out Pnt2d from gp);
|
||||
---C++: inline
|
||||
|
||||
Degenerated(myclass; E : Edge from TopoDS)
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
Tolerance(myclass; V : Vertex from TopoDS)
|
||||
---C++: inline
|
||||
returns Real from Standard;
|
||||
|
||||
Parameter(myclass; V : Vertex from TopoDS;
|
||||
E : Edge from TopoDS;
|
||||
F : Face from TopoDS) returns Real from Standard;
|
||||
---C++: inline
|
||||
|
||||
Parameters (myclass;
|
||||
E : Edge from TopoDS;
|
||||
F : Face from TopoDS;
|
||||
W : Real;
|
||||
UV : out Pnt2d);
|
||||
|
||||
Locate (myclass;
|
||||
C : Curve from BRepAdaptor;
|
||||
W : in Real; WFound : in out Real;
|
||||
p3d : Pnt from gp;
|
||||
UV : out Pnt2d);
|
||||
|
||||
Pnt(myclass; V : Vertex from TopoDS)
|
||||
---C++: inline
|
||||
returns Pnt from gp;
|
||||
|
||||
|
||||
AddInFace(myclass;
|
||||
F : Face from TopoDS;
|
||||
T : in out Triangulation from Poly);
|
||||
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
theFIterator : Explorer from TopExp;
|
||||
theEIterator : Explorer from TopExp;
|
||||
theVIterator : Explorer from TopExp;
|
||||
|
||||
end ShapeTool;
|
||||
|
132
src/BRepMesh/BRepMesh_ShapeTool.cxx
Executable file
132
src/BRepMesh/BRepMesh_ShapeTool.cxx
Executable file
@@ -0,0 +1,132 @@
|
||||
#include <BRepMesh_ShapeTool.ixx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <Extrema_POnCurv.hxx>
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
Standard_Integer debug=0;
|
||||
|
||||
BRepMesh_ShapeTool::BRepMesh_ShapeTool() {}
|
||||
|
||||
Standard_Boolean BRepMesh_ShapeTool::MoreInternalVertex()
|
||||
{
|
||||
while (theVIterator.More()) {
|
||||
if (theVIterator.Current().Orientation() == TopAbs_INTERNAL)
|
||||
return Standard_True;
|
||||
theVIterator.Next();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
TopoDS_Vertex BRepMesh_ShapeTool::FirstVertex(const TopoDS_Edge& E)
|
||||
{
|
||||
TopExp_Explorer Ex(E,TopAbs_VERTEX);
|
||||
while (Ex.More()) {
|
||||
if (Ex.Current().Orientation() == TopAbs_FORWARD)
|
||||
return TopoDS::Vertex(Ex.Current());
|
||||
Ex.Next();
|
||||
}
|
||||
Standard_NoSuchObject::Raise("non existent first vertex");
|
||||
return TopoDS_Vertex();
|
||||
}
|
||||
|
||||
TopoDS_Vertex BRepMesh_ShapeTool::LastVertex(const TopoDS_Edge& E)
|
||||
{
|
||||
TopExp_Explorer Ex(E,TopAbs_VERTEX);
|
||||
while (Ex.More()) {
|
||||
if (Ex.Current().Orientation() == TopAbs_REVERSED)
|
||||
return TopoDS::Vertex(Ex.Current());
|
||||
Ex.Next();
|
||||
}
|
||||
Standard_NoSuchObject::Raise("non existent last vertex");
|
||||
return TopoDS_Vertex();
|
||||
}
|
||||
|
||||
void BRepMesh_ShapeTool::Vertices(const TopoDS_Edge& E,
|
||||
TopoDS_Vertex& Vfirst,
|
||||
TopoDS_Vertex& Vlast)
|
||||
{
|
||||
TopExp::Vertices(E, Vfirst, Vlast);
|
||||
}
|
||||
|
||||
Bnd_Box BRepMesh_ShapeTool::Bound(const TopoDS_Face& F)
|
||||
{
|
||||
Bnd_Box Bf;
|
||||
BRepBndLib::Add(F, Bf);
|
||||
return Bf;
|
||||
}
|
||||
|
||||
Bnd_Box BRepMesh_ShapeTool::Bound(const TopoDS_Edge& E)
|
||||
{
|
||||
Bnd_Box Be;
|
||||
BRepBndLib::Add(E, Be);
|
||||
return Be;
|
||||
}
|
||||
|
||||
void BRepMesh_ShapeTool::Parameters(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
const Standard_Real W,
|
||||
gp_Pnt2d& UV)
|
||||
{
|
||||
Standard_Real a,b;
|
||||
Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(E,F,a,b);
|
||||
C->D0(W,UV);
|
||||
}
|
||||
|
||||
void BRepMesh_ShapeTool::Locate(const BRepAdaptor_Curve& C,
|
||||
const Standard_Real W,
|
||||
Standard_Real& wFound,
|
||||
const gp_Pnt& p3d,
|
||||
gp_Pnt2d& UV)
|
||||
{
|
||||
gp_Pnt plocal(p3d.Transformed(C.Trsf().Inverted()));
|
||||
Extrema_LocateExtPC
|
||||
pcos(plocal, C.CurveOnSurface(), W, Precision::PConfusion());
|
||||
if (pcos.IsDone()) {
|
||||
wFound=pcos.Point().Parameter();
|
||||
C.CurveOnSurface().GetCurve()->D0(wFound, UV);
|
||||
if (debug!=0) {
|
||||
if (pcos.SquareDistance()>(4.* C.Tolerance()* C.Tolerance())) {
|
||||
cout << " ShapeTool :LocateExtPCOnS Done but (Distance "<<
|
||||
sqrt(pcos.SquareDistance()) << ")(Tolerance "<<C.Tolerance()<<")" << endl;
|
||||
cout << " W given : "<< W<< " W calculated : "<<
|
||||
wFound << endl;
|
||||
}
|
||||
else if (debug>1) {
|
||||
cout << " ShapeTool : LocateExtPCOnS OK ! "<<endl;
|
||||
cout << " W given : "<< W<< " W calculated : "<<
|
||||
wFound << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
wFound=W;
|
||||
if (debug!=0)
|
||||
cout << " ShapeTool : LocateExtPCOnS Not Done ! " << endl;
|
||||
C.CurveOnSurface().GetCurve()->D0(W, UV);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BRepMesh_ShapeTool::AddInFace(const TopoDS_Face& F,
|
||||
Handle(Poly_Triangulation)& T)
|
||||
{
|
||||
static BRep_Builder B1;
|
||||
TColgp_Array1OfPnt& Nodes = T->ChangeNodes();
|
||||
gp_Trsf tr = F.Location().Transformation();
|
||||
tr.Invert();
|
||||
for (Standard_Integer i = Nodes.Lower(); i <= Nodes.Upper(); i++)
|
||||
Nodes(i).Transform(tr);
|
||||
B1.UpdateFace(F, T);
|
||||
}
|
117
src/BRepMesh/BRepMesh_ShapeTool.lxx
Executable file
117
src/BRepMesh/BRepMesh_ShapeTool.lxx
Executable file
@@ -0,0 +1,117 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
inline void BRepMesh_ShapeTool::Init(const TopoDS_Shape& S)
|
||||
{
|
||||
theFIterator.Init(S, TopAbs_FACE);
|
||||
}
|
||||
|
||||
inline Standard_Boolean BRepMesh_ShapeTool::MoreFace()
|
||||
{
|
||||
return theFIterator.More();
|
||||
}
|
||||
|
||||
inline void BRepMesh_ShapeTool::NextFace()
|
||||
{
|
||||
theFIterator.Next();
|
||||
}
|
||||
|
||||
inline const TopoDS_Face& BRepMesh_ShapeTool:: CurrentFace()
|
||||
{
|
||||
return TopoDS::Face(theFIterator.Current());
|
||||
}
|
||||
|
||||
|
||||
inline void BRepMesh_ShapeTool::Init(const TopoDS_Face& F)
|
||||
{
|
||||
theEIterator.Init(F,TopAbs_EDGE);
|
||||
}
|
||||
|
||||
inline Standard_Boolean BRepMesh_ShapeTool::MoreEdge()
|
||||
{
|
||||
return theEIterator.More();
|
||||
}
|
||||
|
||||
inline void BRepMesh_ShapeTool::NextEdge()
|
||||
{
|
||||
theEIterator.Next();
|
||||
}
|
||||
|
||||
|
||||
inline const TopoDS_Edge& BRepMesh_ShapeTool::CurrentEdge()
|
||||
{
|
||||
return TopoDS::Edge(theEIterator.Current());
|
||||
}
|
||||
|
||||
inline void BRepMesh_ShapeTool::Init(const TopoDS_Edge& E)
|
||||
{
|
||||
theVIterator.Init(E,TopAbs_VERTEX);
|
||||
}
|
||||
|
||||
|
||||
inline void BRepMesh_ShapeTool::NextInternalVertex()
|
||||
{
|
||||
theVIterator.Next();
|
||||
}
|
||||
|
||||
inline const TopoDS_Vertex& BRepMesh_ShapeTool::CurrentInternalVertex()
|
||||
{
|
||||
return TopoDS::Vertex(theVIterator.Current());
|
||||
}
|
||||
|
||||
inline TopAbs_Orientation BRepMesh_ShapeTool::Orientation(
|
||||
const TopoDS_Edge& E)
|
||||
{
|
||||
return E.Orientation();
|
||||
}
|
||||
|
||||
inline TopAbs_Orientation BRepMesh_ShapeTool::Orientation(
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
return F.Orientation();
|
||||
}
|
||||
|
||||
inline void BRepMesh_ShapeTool::Range(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
Standard_Real& wFirst,
|
||||
Standard_Real& wLast)
|
||||
{
|
||||
BRep_Tool::Range(E, F, wFirst, wLast);
|
||||
}
|
||||
|
||||
inline void BRepMesh_ShapeTool::UVPoints(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
gp_Pnt2d& uvFirst,
|
||||
gp_Pnt2d& uvLast)
|
||||
{
|
||||
BRep_Tool::UVPoints(E, F, uvFirst, uvLast);
|
||||
}
|
||||
|
||||
inline Standard_Boolean BRepMesh_ShapeTool::Degenerated(const TopoDS_Edge& E)
|
||||
{
|
||||
return BRep_Tool::Degenerated(E);
|
||||
}
|
||||
|
||||
inline Standard_Real BRepMesh_ShapeTool::Tolerance(const TopoDS_Vertex& V)
|
||||
{
|
||||
return BRep_Tool::Tolerance(V);
|
||||
}
|
||||
|
||||
inline Standard_Real BRepMesh_ShapeTool::Parameter(const TopoDS_Vertex& V,
|
||||
const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F)
|
||||
{
|
||||
return BRep_Tool::Parameter(V,E,F);
|
||||
}
|
||||
|
||||
inline gp_Pnt BRepMesh_ShapeTool::Pnt(const TopoDS_Vertex& V)
|
||||
{
|
||||
return BRep_Tool::Pnt(V);
|
||||
}
|
||||
|
||||
|
72
src/BRepMesh/BRepMesh_Triangle.cdl
Executable file
72
src/BRepMesh/BRepMesh_Triangle.cdl
Executable file
@@ -0,0 +1,72 @@
|
||||
-- File: BRepMesh_Triangle.cdl
|
||||
-- Created: Wed Sep 22 18:11:52 1993
|
||||
-- Author: Didier PIFFAULT
|
||||
-- <dpf@zerox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Triangle from BRepMesh
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Boolean from Standard,
|
||||
Integer from Standard,
|
||||
DegreeOfFreedom from MeshDS
|
||||
|
||||
|
||||
|
||||
is Create returns Triangle from BRepMesh;
|
||||
|
||||
|
||||
Create (e1, e2, e3 : Integer from Standard;
|
||||
o1, o2, o3 : Boolean from Standard;
|
||||
canMove : DegreeOfFreedom from MeshDS)
|
||||
returns Triangle from BRepMesh;
|
||||
|
||||
|
||||
Initialize (me : in out;
|
||||
e1, e2, e3 : Integer from Standard;
|
||||
o1, o2, o3 : Boolean from Standard;
|
||||
canMove : DegreeOfFreedom from MeshDS)
|
||||
is static;
|
||||
|
||||
|
||||
Edges (me;
|
||||
e1, e2, e3 : out Integer from Standard;
|
||||
o1, o2, o3 : out Boolean from Standard)
|
||||
is static;
|
||||
|
||||
|
||||
Movability (me)
|
||||
---C++: inline
|
||||
returns DegreeOfFreedom from MeshDS
|
||||
is static;
|
||||
|
||||
|
||||
SetMovability (me : in out;
|
||||
Move : DegreeOfFreedom from MeshDS)
|
||||
is static;
|
||||
|
||||
|
||||
HashCode (me;
|
||||
Upper : Integer from Standard)
|
||||
returns Integer from Standard
|
||||
---C++: function call
|
||||
is static;
|
||||
|
||||
|
||||
IsEqual (me; Other : Triangle from BRepMesh)
|
||||
returns Boolean from Standard
|
||||
---C++: alias operator ==
|
||||
is static;
|
||||
|
||||
|
||||
fields Edge1 : Integer from Standard;
|
||||
Orientation1 : Boolean from Standard;
|
||||
Edge2 : Integer from Standard;
|
||||
Orientation2 : Boolean from Standard;
|
||||
Edge3 : Integer from Standard;
|
||||
Orientation3 : Boolean from Standard;
|
||||
myMovability : DegreeOfFreedom from MeshDS;
|
||||
|
||||
end Triangle;
|
79
src/BRepMesh/BRepMesh_Triangle.cxx
Executable file
79
src/BRepMesh/BRepMesh_Triangle.cxx
Executable file
@@ -0,0 +1,79 @@
|
||||
// File: BRepMesh_Triangle.cxx
|
||||
// Created: Thu Sep 23 13:10:58 1993
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@zerox>
|
||||
|
||||
#include <BRepMesh_Triangle.ixx>
|
||||
|
||||
BRepMesh_Triangle::BRepMesh_Triangle()
|
||||
: Edge1(0), Edge2(0), Edge3(0), myMovability(MeshDS_Free)
|
||||
{}
|
||||
|
||||
BRepMesh_Triangle::BRepMesh_Triangle (const Standard_Integer e1,
|
||||
const Standard_Integer e2,
|
||||
const Standard_Integer e3,
|
||||
const Standard_Boolean o1,
|
||||
const Standard_Boolean o2,
|
||||
const Standard_Boolean o3,
|
||||
const MeshDS_DegreeOfFreedom canMove)
|
||||
: Edge1(e1), Orientation1(o1),Edge2(e2), Orientation2(o2),
|
||||
Edge3(e3), Orientation3(o3),
|
||||
myMovability(canMove)
|
||||
{}
|
||||
|
||||
void BRepMesh_Triangle::Initialize(const Standard_Integer e1,
|
||||
const Standard_Integer e2,
|
||||
const Standard_Integer e3,
|
||||
const Standard_Boolean o1,
|
||||
const Standard_Boolean o2,
|
||||
const Standard_Boolean o3,
|
||||
const MeshDS_DegreeOfFreedom canMove)
|
||||
{
|
||||
Edge1 =e1;
|
||||
Edge2 =e2;
|
||||
Edge3 =e3;
|
||||
Orientation1 =o1;
|
||||
Orientation2 =o2;
|
||||
Orientation3 =o3;
|
||||
myMovability =canMove;
|
||||
}
|
||||
|
||||
void BRepMesh_Triangle::Edges(Standard_Integer& e1,
|
||||
Standard_Integer& e2,
|
||||
Standard_Integer& e3,
|
||||
Standard_Boolean& o1,
|
||||
Standard_Boolean& o2,
|
||||
Standard_Boolean& o3)const
|
||||
{
|
||||
e1=Edge1;
|
||||
e2=Edge2;
|
||||
e3=Edge3;
|
||||
o1=Orientation1;
|
||||
o2=Orientation2;
|
||||
o3=Orientation3;
|
||||
}
|
||||
|
||||
void BRepMesh_Triangle::SetMovability(const MeshDS_DegreeOfFreedom Move)
|
||||
{
|
||||
myMovability =Move;
|
||||
}
|
||||
|
||||
Standard_Integer BRepMesh_Triangle::HashCode
|
||||
(const Standard_Integer Upper)const
|
||||
{
|
||||
return ::HashCode(Edge1+Edge2+Edge3, Upper);
|
||||
}
|
||||
|
||||
Standard_Boolean BRepMesh_Triangle::IsEqual
|
||||
(const BRepMesh_Triangle& Other)const
|
||||
{
|
||||
if (myMovability==MeshDS_Deleted || Other.myMovability==MeshDS_Deleted)
|
||||
return Standard_False;
|
||||
if (Edge1==Other.Edge1 && Edge2==Other.Edge2 && Edge3==Other.Edge3)
|
||||
return Standard_True;
|
||||
if (Edge1==Other.Edge2 && Edge2==Other.Edge3 && Edge3==Other.Edge1)
|
||||
return Standard_True;
|
||||
if (Edge1==Other.Edge3 && Edge2==Other.Edge1 && Edge3==Other.Edge2)
|
||||
return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
9
src/BRepMesh/BRepMesh_Triangle.lxx
Executable file
9
src/BRepMesh/BRepMesh_Triangle.lxx
Executable file
@@ -0,0 +1,9 @@
|
||||
// File: BRepMesh_Triangle.lxx
|
||||
// Created: Thu Sep 23 13:14:07 1993
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@zerox>
|
||||
|
||||
inline MeshDS_DegreeOfFreedom BRepMesh_Triangle::Movability()const
|
||||
{
|
||||
return myMovability;
|
||||
}
|
81
src/BRepMesh/BRepMesh_Vertex.cdl
Executable file
81
src/BRepMesh/BRepMesh_Vertex.cdl
Executable file
@@ -0,0 +1,81 @@
|
||||
-- File: BRepMesh_Vertex.cdl
|
||||
-- Created: Wed Sep 22 18:04:35 1993
|
||||
-- Author: Didier PIFFAULT
|
||||
-- <dpf@zerox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Vertex from BRepMesh
|
||||
|
||||
---Purpose:
|
||||
|
||||
|
||||
uses Boolean from Standard,
|
||||
Integer from Standard,
|
||||
Real from Standard,
|
||||
XY from gp,
|
||||
DegreeOfFreedom from MeshDS
|
||||
|
||||
|
||||
is Create returns Vertex from BRepMesh;
|
||||
|
||||
Create (UV : in XY from gp;
|
||||
Locat3d : in Integer from Standard;
|
||||
Move : in DegreeOfFreedom from MeshDS)
|
||||
returns Vertex from BRepMesh;
|
||||
|
||||
|
||||
Create (U, V : Real from Standard;
|
||||
Move : in DegreeOfFreedom from MeshDS)
|
||||
---Purpose: For MeshAlgo.
|
||||
returns Vertex from BRepMesh;
|
||||
|
||||
|
||||
Initialize (me : in out;
|
||||
UV : in XY from gp;
|
||||
Locat3d : in Integer from Standard;
|
||||
Move : in DegreeOfFreedom from MeshDS)
|
||||
is static;
|
||||
|
||||
|
||||
Coord (me)
|
||||
returns XY from gp
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
Location3d (me)
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
Movability (me)
|
||||
returns DegreeOfFreedom from MeshDS
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
SetMovability (me : in out;
|
||||
Move : DegreeOfFreedom from MeshDS)
|
||||
is static;
|
||||
|
||||
|
||||
HashCode (me;
|
||||
Upper : Integer from Standard)
|
||||
returns Integer from Standard
|
||||
---C++: function call
|
||||
is static;
|
||||
|
||||
|
||||
IsEqual (me; Other : Vertex from BRepMesh)
|
||||
returns Boolean from Standard
|
||||
---C++: alias operator ==
|
||||
is static;
|
||||
|
||||
|
||||
fields myUV : XY from gp;
|
||||
myLocation : Integer from Standard;
|
||||
myMovability : DegreeOfFreedom from MeshDS;
|
||||
|
||||
end Vertex;
|
55
src/BRepMesh/BRepMesh_Vertex.cxx
Executable file
55
src/BRepMesh/BRepMesh_Vertex.cxx
Executable file
@@ -0,0 +1,55 @@
|
||||
// File: BRepMesh_Vertex.cxx
|
||||
// Created: Thu Sep 23 12:46:51 1993
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@zerox>
|
||||
|
||||
#include <BRepMesh_Vertex.ixx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
BRepMesh_Vertex::BRepMesh_Vertex()
|
||||
: myLocation(0), myMovability(MeshDS_Free)
|
||||
{}
|
||||
|
||||
BRepMesh_Vertex::BRepMesh_Vertex(const gp_XY& UV,
|
||||
const Standard_Integer Locat3d,
|
||||
const MeshDS_DegreeOfFreedom Move)
|
||||
: myUV(UV), myLocation(Locat3d), myMovability(Move)
|
||||
{}
|
||||
|
||||
BRepMesh_Vertex::BRepMesh_Vertex(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const MeshDS_DegreeOfFreedom Move)
|
||||
: myUV(U, V), myLocation(0), myMovability(Move)
|
||||
{}
|
||||
|
||||
void BRepMesh_Vertex::Initialize(const gp_XY& UV,
|
||||
const Standard_Integer Locat3d,
|
||||
const MeshDS_DegreeOfFreedom Move)
|
||||
{
|
||||
myUV=UV;
|
||||
myLocation=Locat3d;
|
||||
myMovability=Move;
|
||||
}
|
||||
|
||||
void BRepMesh_Vertex::SetMovability(const MeshDS_DegreeOfFreedom Move)
|
||||
{
|
||||
myMovability=Move;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HashCode IsEqual
|
||||
//purpose : Services for Map
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_Vertex::HashCode(const Standard_Integer Upper)const
|
||||
{
|
||||
return ::HashCode (Floor(1e5*myUV.X())*Floor(1e5*myUV.Y()), Upper);
|
||||
}
|
||||
|
||||
Standard_Boolean BRepMesh_Vertex::IsEqual(const BRepMesh_Vertex& Other)const
|
||||
{
|
||||
if (myMovability!=MeshDS_Deleted && Other.myMovability!=MeshDS_Deleted)
|
||||
return (myUV.IsEqual(Other.myUV, Precision::PConfusion()));
|
||||
return Standard_False;
|
||||
}
|
||||
|
19
src/BRepMesh/BRepMesh_Vertex.lxx
Executable file
19
src/BRepMesh/BRepMesh_Vertex.lxx
Executable file
@@ -0,0 +1,19 @@
|
||||
// File: BRepMesh_Vertex.lxx
|
||||
// Created: Thu Sep 23 12:49:00 1993
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@zerox>
|
||||
|
||||
inline const gp_XY& BRepMesh_Vertex::Coord()const
|
||||
{
|
||||
return myUV;
|
||||
}
|
||||
|
||||
inline Standard_Integer BRepMesh_Vertex::Location3d()const
|
||||
{
|
||||
return myLocation;
|
||||
}
|
||||
|
||||
inline MeshDS_DegreeOfFreedom BRepMesh_Vertex::Movability()const
|
||||
{
|
||||
return myMovability;
|
||||
}
|
1
src/BRepMesh/EXTERNLIB
Executable file
1
src/BRepMesh/EXTERNLIB
Executable file
@@ -0,0 +1 @@
|
||||
CSF_TBB
|
3
src/BRepMesh/FILES
Executable file
3
src/BRepMesh/FILES
Executable file
@@ -0,0 +1,3 @@
|
||||
BRepMesh_PluginMacro.hxx
|
||||
BRepMesh_ClassifierPtr.hxx
|
||||
EXTERNLIB
|
Reference in New Issue
Block a user