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:
128
src/BRepOffset/BRepOffset.cdl
Executable file
128
src/BRepOffset/BRepOffset.cdl
Executable file
@@ -0,0 +1,128 @@
|
||||
-- File: BRepOffset.cdl
|
||||
-- Created: Thu Oct 12 10:59:22 1995
|
||||
-- Author: Bruno DUMORTIER
|
||||
-- <dub@fuegox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
|
||||
package BRepOffset
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
MMgt,
|
||||
Geom,
|
||||
TopoDS,
|
||||
TopAbs,
|
||||
TCollection,
|
||||
TopTools,
|
||||
GeomAbs,
|
||||
BRepAlgo
|
||||
|
||||
is
|
||||
enumeration Type is
|
||||
Concave,
|
||||
Convex,
|
||||
Tangent,
|
||||
FreeBoundary,
|
||||
Other
|
||||
end Type;
|
||||
|
||||
enumeration Mode is
|
||||
Skin,
|
||||
Pipe,
|
||||
RectoVerso
|
||||
end Mode;
|
||||
---Purpose:
|
||||
-- Lists the offset modes. These are the following:
|
||||
-- - BRepOffset_Skin which describes the offset along
|
||||
-- the surface of a solid, used to obtain a manifold topological space,
|
||||
-- - BRepOffset_Pipe which describes the offset of a
|
||||
-- curve, used to obtain a pre-surface,
|
||||
-- - BRepOffset_RectoVerso which describes the offset
|
||||
-- of a given surface shell along both sides of the surface.
|
||||
|
||||
enumeration Status is
|
||||
---Purpose: status of an offset face
|
||||
-- Good :
|
||||
-- Reversed : e.g. Offset > Radius of a cylinder
|
||||
-- Degenerated : e.g. Offset = Radius of a cylinder
|
||||
-- Unknown : e.g. for a Beziersurf
|
||||
Good,
|
||||
Reversed,
|
||||
Degenerated,
|
||||
Unknown
|
||||
end Status;
|
||||
|
||||
enumeration Error is
|
||||
NoError,
|
||||
OffsetSurfaceFailed,
|
||||
UnCorrectClosingFace,
|
||||
ExtentFaceFailed,
|
||||
RadiusEqualOffset,
|
||||
UnknownError
|
||||
end Error;
|
||||
|
||||
class MakeOffset;
|
||||
|
||||
--class Loop;
|
||||
|
||||
class Inter3d;
|
||||
|
||||
class Inter2d;
|
||||
|
||||
class Offset;
|
||||
---Purpose: This class compute elemenary offset surface.
|
||||
-- Evaluate the offset generated :
|
||||
-- 1 - from a face.
|
||||
-- 2 - from an edge.
|
||||
-- 3 - from a vertex.
|
||||
--
|
||||
|
||||
class Analyse;
|
||||
|
||||
class MakeLoops;
|
||||
|
||||
class Tool;
|
||||
|
||||
--class Image;
|
||||
|
||||
--class AsDes;
|
||||
|
||||
|
||||
class Interval;
|
||||
|
||||
class ListOfInterval instantiates
|
||||
List from TCollection (Interval from BRepOffset);
|
||||
|
||||
class DataMapOfShapeListOfInterval instantiates
|
||||
DataMap from TCollection(Shape from TopoDS,
|
||||
ListOfInterval from BRepOffset,
|
||||
ShapeMapHasher from TopTools );
|
||||
|
||||
class DataMapOfShapeOffset instantiates
|
||||
DataMap from TCollection(Shape from TopoDS,
|
||||
Offset from BRepOffset,
|
||||
ShapeMapHasher from TopTools );
|
||||
|
||||
class DataMapOfShapeMapOfShape instantiates
|
||||
DataMap from TCollection(Shape from TopoDS,
|
||||
MapOfShape from TopTools,
|
||||
ShapeMapHasher from TopTools);
|
||||
|
||||
|
||||
Surface( Surface : in Surface from Geom;
|
||||
Offset : in Real from Standard;
|
||||
Status : out Status from BRepOffset)
|
||||
---Purpose: returns the Offset surface computed from the
|
||||
-- surface <Surface> at an OffsetDistance <Offset>.
|
||||
--
|
||||
-- If possible, this method returns the real type of
|
||||
-- the surface ( e.g. An Offset of a plane is a plane).
|
||||
--
|
||||
-- If no particular case is detected, the returned
|
||||
-- surface will have the Type Geom_OffsetSurface.
|
||||
returns Surface from Geom;
|
||||
|
||||
end BRepOffset;
|
161
src/BRepOffset/BRepOffset.cxx
Executable file
161
src/BRepOffset/BRepOffset.cxx
Executable file
@@ -0,0 +1,161 @@
|
||||
// File: BRepOffset.cxx
|
||||
// Created: Wed Oct 25 10:39:23 1995
|
||||
// Author: Bruno DUMORTIER
|
||||
// <dub@fuegox>
|
||||
|
||||
|
||||
#include <BRepOffset.ixx>
|
||||
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Surface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_Surface) BRepOffset::Surface(const Handle(Geom_Surface)& Surface,
|
||||
const Standard_Real Offset,
|
||||
BRepOffset_Status& Status)
|
||||
{
|
||||
Standard_Real Tol = Precision::Confusion();
|
||||
|
||||
Status = BRepOffset_Good;
|
||||
Handle(Geom_Surface) Result;
|
||||
|
||||
Handle(Standard_Type) TheType = Surface->DynamicType();
|
||||
|
||||
if (TheType == STANDARD_TYPE(Geom_Plane)) {
|
||||
Handle(Geom_Plane) P =
|
||||
Handle(Geom_Plane)::DownCast(Surface);
|
||||
gp_Vec T = P->Position().XDirection()^P->Position().YDirection();
|
||||
T *= Offset;
|
||||
Result = Handle(Geom_Plane)::DownCast(P->Translated(T));
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_CylindricalSurface)) {
|
||||
Handle(Geom_CylindricalSurface) C =
|
||||
Handle(Geom_CylindricalSurface)::DownCast(Surface);
|
||||
Standard_Real Radius = C->Radius();
|
||||
gp_Ax3 Axis = C->Position();
|
||||
if (Axis.Direct())
|
||||
Radius += Offset;
|
||||
else
|
||||
Radius -= Offset;
|
||||
if ( Radius >= Tol ) {
|
||||
Result = new Geom_CylindricalSurface( Axis, Radius);
|
||||
}
|
||||
else if ( Radius <= -Tol ){
|
||||
Axis.Rotate(gp_Ax1(Axis.Location(),Axis.Direction()),PI);
|
||||
Result = new Geom_CylindricalSurface( Axis, Abs(Radius));
|
||||
Status = BRepOffset_Reversed;
|
||||
}
|
||||
else {
|
||||
Status = BRepOffset_Degenerated;
|
||||
}
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_ConicalSurface)) {
|
||||
Handle(Geom_ConicalSurface) C =
|
||||
Handle(Geom_ConicalSurface)::DownCast(Surface);
|
||||
Standard_Real Alpha = C->SemiAngle();
|
||||
Standard_Real Radius = C->RefRadius() + Offset * Cos(Alpha);
|
||||
gp_Ax3 Axis = C->Position();
|
||||
if ( Radius >= 0.) {
|
||||
gp_Vec Z( Axis.Direction());
|
||||
Z *= - Offset * Sin(Alpha);
|
||||
Axis.Translate(Z);
|
||||
}
|
||||
else {
|
||||
Radius = -Radius;
|
||||
gp_Vec Z( Axis.Direction());
|
||||
Z *= - Offset * Sin(Alpha);
|
||||
Axis.Translate(Z);
|
||||
Axis.Rotate(gp_Ax1(Axis.Location(),Axis.Direction()),PI);
|
||||
Alpha = -Alpha;
|
||||
}
|
||||
Result = new Geom_ConicalSurface(Axis, Alpha, Radius);
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_SphericalSurface)) {
|
||||
Handle(Geom_SphericalSurface) S =
|
||||
Handle(Geom_SphericalSurface)::DownCast(Surface);
|
||||
Standard_Real Radius = S->Radius();
|
||||
gp_Ax3 Axis = S->Position();
|
||||
if (Axis.Direct())
|
||||
Radius += Offset;
|
||||
else
|
||||
Radius -= Offset;
|
||||
if ( Radius >= Tol) {
|
||||
Result = new Geom_SphericalSurface(Axis, Radius);
|
||||
}
|
||||
else if ( Radius <= -Tol ) {
|
||||
Axis.Rotate(gp_Ax1(Axis.Location(),Axis.Direction()),PI);
|
||||
Axis.ZReverse();
|
||||
Result = new Geom_SphericalSurface(Axis, -Radius);
|
||||
Status = BRepOffset_Reversed;
|
||||
}
|
||||
else {
|
||||
Status = BRepOffset_Degenerated;
|
||||
}
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_ToroidalSurface)) {
|
||||
Handle(Geom_ToroidalSurface) S =
|
||||
Handle(Geom_ToroidalSurface)::DownCast(Surface);
|
||||
Standard_Real MajorRadius = S->MajorRadius();
|
||||
Standard_Real MinorRadius = S->MinorRadius();
|
||||
gp_Ax3 Axis = S->Position();
|
||||
if (MinorRadius < MajorRadius) { // A FINIR
|
||||
if (Axis.Direct())
|
||||
MinorRadius += Offset;
|
||||
else
|
||||
MinorRadius -= Offset;
|
||||
if (MinorRadius >= Tol) {
|
||||
Result = new Geom_ToroidalSurface(Axis,MajorRadius,MinorRadius);
|
||||
}
|
||||
else if (MinorRadius <= -Tol) {
|
||||
Status = BRepOffset_Reversed;
|
||||
}
|
||||
else {
|
||||
Status = BRepOffset_Degenerated;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution)) {
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_BSplineSurface)) {
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
Handle(Geom_RectangularTrimmedSurface) S =
|
||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(Surface);
|
||||
Standard_Real U1,U2,V1,V2;
|
||||
S->Bounds(U1,U2,V1,V2);
|
||||
Handle(Geom_Surface) Off =
|
||||
BRepOffset::Surface(S->BasisSurface(),Offset,Status);
|
||||
Result = new Geom_RectangularTrimmedSurface (Off,U1,U2,V1,V2);
|
||||
}
|
||||
else if (TheType == STANDARD_TYPE(Geom_OffsetSurface)) {
|
||||
}
|
||||
|
||||
if ( Result.IsNull()) {
|
||||
Result = new Geom_OffsetSurface( Surface, Offset);
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
128
src/BRepOffset/BRepOffset_Analyse.cdl
Executable file
128
src/BRepOffset/BRepOffset_Analyse.cdl
Executable file
@@ -0,0 +1,128 @@
|
||||
-- File: BRepOffset_Analyse.cdl
|
||||
-- Created: Fri Oct 20 16:40:49 1995
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@stylox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class Analyse from BRepOffset
|
||||
|
||||
---Purpose: Analyse of a shape consit to
|
||||
-- Find the part of edges convex concave tangent.
|
||||
|
||||
uses
|
||||
|
||||
Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
Compound from TopoDS,
|
||||
IndexedDataMapOfShapeListOfShape from TopTools,
|
||||
ListOfShape from TopTools,
|
||||
MapOfShape from TopTools,
|
||||
Interval from BRepOffset,
|
||||
ListOfInterval from BRepOffset,
|
||||
DataMapOfShapeListOfInterval from BRepOffset,
|
||||
Type from BRepOffset
|
||||
|
||||
is
|
||||
Create;
|
||||
|
||||
Create (S : Shape from TopoDS ;
|
||||
Angle : Real from Standard)
|
||||
returns Analyse from BRepOffset;
|
||||
|
||||
Perform (me : in out ;
|
||||
S : Shape from TopoDS ;
|
||||
Angle : Real from Standard)
|
||||
is static;
|
||||
|
||||
IsDone (me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
Clear(me : in out)
|
||||
is static;
|
||||
|
||||
Type (me; E : Edge from TopoDS)
|
||||
---C++: return const&
|
||||
returns ListOfInterval from BRepOffset
|
||||
is static;
|
||||
|
||||
Edges (me;
|
||||
V : Vertex from TopoDS;
|
||||
T : Type from BRepOffset;
|
||||
L : in out ListOfShape from TopTools)
|
||||
---Purpose: Stores in <L> all the edges of Type <T>
|
||||
-- on the vertex <V>.
|
||||
is static;
|
||||
|
||||
Edges (me;
|
||||
F : Face from TopoDS;
|
||||
T : Type from BRepOffset;
|
||||
L : in out ListOfShape from TopTools)
|
||||
---Purpose: Stores in <L> all the edges of Type <T>
|
||||
-- on the face <F>.
|
||||
is static;
|
||||
|
||||
TangentEdges(me;
|
||||
Edge : Edge from TopoDS;
|
||||
Vertex : Vertex from TopoDS;
|
||||
Edges : in out ListOfShape from TopTools)
|
||||
---Purpose: set in <Edges> all the Edges of <Shape> which are
|
||||
-- tangent to <Edge> at the vertex <Vertex>.
|
||||
is static;
|
||||
|
||||
HasAncestor (me ; S : Shape from TopoDS)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
Ancestors (me ; S : Shape from TopoDS)
|
||||
---C++: return const &
|
||||
returns ListOfShape from TopTools
|
||||
is static;
|
||||
|
||||
Explode (me;
|
||||
L : in out ListOfShape from TopTools;
|
||||
Type : in Type from BRepOffset)
|
||||
---Purpose: Explode in compounds of faces where
|
||||
-- all the connex edges are of type <Side>
|
||||
is static;
|
||||
|
||||
Explode (me;
|
||||
L : in out ListOfShape from TopTools;
|
||||
Type1 : in Type from BRepOffset;
|
||||
Type2 : in Type from BRepOffset)
|
||||
---Purpose: Explode in compounds of faces where
|
||||
-- all the connex edges are of type <Side1> or <Side2>
|
||||
is static;
|
||||
|
||||
AddFaces(me;
|
||||
Face : Face from TopoDS;
|
||||
Co : in out Compound from TopoDS;
|
||||
Map : in out MapOfShape from TopTools;
|
||||
Type : in Type from BRepOffset)
|
||||
---Purpose: Add in <CO> the faces of the shell containing <Face>
|
||||
-- where all the connex edges are of type <Side>.
|
||||
is static;
|
||||
|
||||
AddFaces(me;
|
||||
Face : Face from TopoDS;
|
||||
Co : in out Compound from TopoDS;
|
||||
Map : in out MapOfShape from TopTools;
|
||||
Type1 : in Type from BRepOffset;
|
||||
Type2 : in Type from BRepOffset)
|
||||
---Purpose: Add in <CO> the faces of the shell containing <Face>
|
||||
-- where all the connex edges are of type <Side1> or <Side2>.
|
||||
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myDone : Boolean from Standard;
|
||||
myShape : Shape from TopoDS;
|
||||
mapEdgeType : DataMapOfShapeListOfInterval from BRepOffset;
|
||||
ancestors : IndexedDataMapOfShapeListOfShape from TopTools;
|
||||
angle : Real from Standard;
|
||||
|
||||
end Analyse;
|
521
src/BRepOffset/BRepOffset_Analyse.cxx
Executable file
521
src/BRepOffset/BRepOffset_Analyse.cxx
Executable file
@@ -0,0 +1,521 @@
|
||||
// File: BRepOffset_Analyse.cxx
|
||||
// Created: Fri Oct 20 18:19:36 1995
|
||||
// Author: Yves FRICAUD
|
||||
// <yfr@stylox>
|
||||
|
||||
|
||||
#include <BRepOffset_Analyse.ixx>
|
||||
#include <BRepOffset_Interval.hxx>
|
||||
#include <BRepOffset_Tool.hxx>
|
||||
#include <BRepOffset_ListIteratorOfListOfInterval.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
|
||||
#include <gp.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffset_Analyse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepOffset_Analyse::BRepOffset_Analyse()
|
||||
:myDone(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffset_Analyse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepOffset_Analyse::BRepOffset_Analyse(const TopoDS_Shape& S,
|
||||
const Standard_Real Angle)
|
||||
:myDone(Standard_False)
|
||||
{
|
||||
Perform( S, Angle);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EdgeAnlyse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static void EdgeAnalyse(const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2,
|
||||
const Standard_Real SinTol,
|
||||
BRepOffset_ListOfInterval& LI)
|
||||
{
|
||||
|
||||
|
||||
TopLoc_Location L;
|
||||
Standard_Real f,l;
|
||||
|
||||
Handle (Geom_Surface) S1 = BRep_Tool::Surface(F1);
|
||||
Handle (Geom_Surface) S2 = BRep_Tool::Surface(F2);
|
||||
Handle (Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(E,F1,f,l);
|
||||
Handle (Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(E,F2,f,l);
|
||||
|
||||
BRepAdaptor_Curve C(E);
|
||||
f = C.FirstParameter();
|
||||
l = C.LastParameter();
|
||||
|
||||
// Tangent si la regularite estaum moins G1.
|
||||
if (BRep_Tool::HasContinuity(E,F1,F2)) {
|
||||
if (BRep_Tool::Continuity(E,F1,F2) > GeomAbs_C0) {
|
||||
BRepOffset_Interval I;
|
||||
I.First(f); I.Last(l);
|
||||
I.Type(BRepOffset_Tangent);
|
||||
LI.Append(I);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Premiere etape : Type determine par un des bout.
|
||||
// Calcul des normales et tangentes sur les courbes et surface.
|
||||
// normales sont dirigees vers l exterieur.
|
||||
|
||||
Standard_Real ParOnC = 0.5*(f+l);
|
||||
gp_Vec T1 = C.DN(ParOnC,1).Transformed(L.Transformation());
|
||||
if (T1.SquareMagnitude() > gp::Resolution()) {
|
||||
T1.Normalize();
|
||||
}
|
||||
|
||||
if (BRepOffset_Tool::OriEdgeInFace(E,F1) == TopAbs_REVERSED) {
|
||||
T1.Reverse();
|
||||
}
|
||||
if (F1.Orientation() == TopAbs_REVERSED) T1.Reverse();
|
||||
|
||||
gp_Pnt2d P = C1->Value(ParOnC);
|
||||
gp_Pnt P3;
|
||||
gp_Vec D1U,D1V;
|
||||
|
||||
S1->D1(P.X(),P.Y(),P3,D1U,D1V);
|
||||
gp_Vec DN1(D1U^D1V);
|
||||
if (F1.Orientation() == TopAbs_REVERSED) DN1.Reverse();
|
||||
|
||||
P = C2->Value(ParOnC);
|
||||
S2->D1(P.X(),P.Y(),P3,D1U,D1V);
|
||||
gp_Vec DN2(D1U^D1V);
|
||||
if (F2.Orientation() == TopAbs_REVERSED) DN2.Reverse();
|
||||
|
||||
DN1.Normalize();
|
||||
DN2.Normalize();
|
||||
|
||||
gp_Vec ProVec = DN1^DN2;
|
||||
Standard_Real NormProVec = ProVec.Magnitude();
|
||||
|
||||
BRepOffset_Interval I;
|
||||
I.First(f); I.Last(l);
|
||||
|
||||
if (Abs(NormProVec) < SinTol) {
|
||||
// plat
|
||||
if (DN1.Dot(DN2) > 0) {
|
||||
//Tangent
|
||||
I.Type(BRepOffset_Tangent);
|
||||
}
|
||||
else {
|
||||
//Confondu pas fini!
|
||||
#ifdef DEB
|
||||
cout <<" face localement confondues"<<endl;
|
||||
#endif
|
||||
I.Type(BRepOffset_Convex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (NormProVec > gp::Resolution())
|
||||
ProVec.Normalize();
|
||||
Standard_Real Prod = T1.Dot(DN1^DN2);
|
||||
if (Prod > 0.) {
|
||||
//Saillant
|
||||
I.Type(BRepOffset_Convex);
|
||||
}
|
||||
else {
|
||||
//rentrant
|
||||
I.Type(BRepOffset_Concave);
|
||||
}
|
||||
}
|
||||
LI.Append(I);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BuildAncestors
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static void BuildAncestors (const TopoDS_Shape& S,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& MA)
|
||||
{
|
||||
MA.Clear();
|
||||
TopExp::MapShapesAndAncestors(S,TopAbs_VERTEX,TopAbs_EDGE,MA);
|
||||
TopExp::MapShapesAndAncestors(S,TopAbs_EDGE ,TopAbs_FACE,MA);
|
||||
|
||||
// Purge des ancetres.
|
||||
TopTools_MapOfShape Map;
|
||||
for (Standard_Integer i = 1; i <= MA.Extent(); i++) {
|
||||
Map.Clear();
|
||||
TopTools_ListOfShape& L = MA(i);
|
||||
TopTools_ListIteratorOfListOfShape it(L);
|
||||
while (it.More()) {
|
||||
if (!Map.Add(it.Value())) {
|
||||
L.Remove(it);
|
||||
}
|
||||
else {
|
||||
it.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepOffset_Analyse::IsDone() const
|
||||
{
|
||||
return myDone;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::Perform (const TopoDS_Shape& S,
|
||||
const Standard_Real Angle)
|
||||
{
|
||||
myShape = S;
|
||||
|
||||
angle = Angle;
|
||||
Standard_Real SinTol = sin(Angle);
|
||||
|
||||
// Build ancestors.
|
||||
BuildAncestors (S,ancestors);
|
||||
|
||||
|
||||
TopExp_Explorer Exp(S.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
|
||||
for ( ; Exp.More(); Exp.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
|
||||
if (!mapEdgeType.IsBound(E)) {
|
||||
BRepOffset_ListOfInterval LI;
|
||||
mapEdgeType.Bind(E,LI);
|
||||
|
||||
const TopTools_ListOfShape& L = Ancestors(E);
|
||||
if ( L.IsEmpty())
|
||||
continue;
|
||||
|
||||
if (L.Extent() == 2) {
|
||||
const TopoDS_Face& F1 = TopoDS::Face(L.First());
|
||||
const TopoDS_Face& F2 = TopoDS::Face(L.Last ());
|
||||
EdgeAnalyse(E,F1,F2,SinTol,mapEdgeType(E));
|
||||
}
|
||||
else if (L.Extent() == 1) {
|
||||
Standard_Real U1,U2;
|
||||
const TopoDS_Face& F = TopoDS::Face(L.First());
|
||||
BRep_Tool::Range(E,F,U1,U2);
|
||||
BRepOffset_Interval Inter(U1,U2,BRepOffset_Other);
|
||||
|
||||
if (! BRepTools::IsReallyClosed(E,F)) {
|
||||
Inter.Type(BRepOffset_FreeBoundary);
|
||||
}
|
||||
mapEdgeType(E).Append(Inter);
|
||||
}
|
||||
else {
|
||||
#ifdef DEB
|
||||
cout <<"edge shared by more than two faces"<<endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::Clear()
|
||||
{
|
||||
myDone = Standard_False;
|
||||
myShape .Nullify();
|
||||
mapEdgeType.Clear();
|
||||
ancestors .Clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffset_ListOfInterval&
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const BRepOffset_ListOfInterval& BRepOffset_Analyse::Type(const TopoDS_Edge& E)
|
||||
const
|
||||
{
|
||||
return mapEdgeType (E);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Edges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::Edges(const TopoDS_Vertex& V,
|
||||
const BRepOffset_Type T,
|
||||
TopTools_ListOfShape& LE)
|
||||
const
|
||||
{
|
||||
LE.Clear();
|
||||
const TopTools_ListOfShape& L = Ancestors (V);
|
||||
TopTools_ListIteratorOfListOfShape it(L);
|
||||
|
||||
for ( ;it.More(); it.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(it.Value());
|
||||
TopoDS_Vertex V1,V2;
|
||||
BRepOffset_Tool::EdgeVertices (E,V1,V2);
|
||||
if (V1.IsSame(V)) {
|
||||
if (mapEdgeType(E).Last().Type() == T)
|
||||
LE.Append(E);
|
||||
}
|
||||
if (V2.IsSame(V)) {
|
||||
if (mapEdgeType(E).First().Type() == T)
|
||||
LE.Append(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Edges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::Edges(const TopoDS_Face& F,
|
||||
const BRepOffset_Type T,
|
||||
TopTools_ListOfShape& LE)
|
||||
const
|
||||
{
|
||||
LE.Clear();
|
||||
TopExp_Explorer exp(F, TopAbs_EDGE);
|
||||
|
||||
for ( ;exp.More(); exp.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
||||
|
||||
const BRepOffset_ListOfInterval& Lint = Type(E);
|
||||
BRepOffset_ListIteratorOfListOfInterval it(Lint);
|
||||
for ( ;it.More(); it.Next()) {
|
||||
if (it.Value().Type() == T) LE.Append(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::TangentEdges(const TopoDS_Edge& Edge ,
|
||||
const TopoDS_Vertex& Vertex,
|
||||
TopTools_ListOfShape& Edges ) const
|
||||
{
|
||||
gp_Vec V,VRef;
|
||||
|
||||
|
||||
Standard_Real U,URef;
|
||||
BRepAdaptor_Curve C3d, C3dRef;
|
||||
|
||||
URef = BRep_Tool::Parameter(Vertex,Edge);
|
||||
C3dRef = BRepAdaptor_Curve(Edge);
|
||||
VRef = C3dRef.DN(URef,1);
|
||||
if (VRef.SquareMagnitude() < gp::Resolution()) return;
|
||||
|
||||
Edges.Clear();
|
||||
|
||||
const TopTools_ListOfShape& Anc = Ancestors(Vertex);
|
||||
TopTools_ListIteratorOfListOfShape it(Anc);
|
||||
for ( ; it.More(); it.Next()) {
|
||||
const TopoDS_Edge& CurE = TopoDS::Edge(it.Value());
|
||||
if ( CurE.IsSame(Edge)) continue;
|
||||
U = BRep_Tool::Parameter(Vertex,CurE);
|
||||
C3d = BRepAdaptor_Curve(CurE);
|
||||
V = C3d.DN(U,1);
|
||||
if (V.SquareMagnitude() < gp::Resolution()) continue;
|
||||
if (V.IsParallel(VRef,angle)) {
|
||||
Edges.Append(CurE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasAncestor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepOffset_Analyse::HasAncestor (const TopoDS_Shape& S) const
|
||||
{
|
||||
return ancestors.Contains(S);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Ancestors
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopTools_ListOfShape& BRepOffset_Analyse::Ancestors
|
||||
(const TopoDS_Shape& S) const
|
||||
{
|
||||
return ancestors.FindFromKey(S);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Explode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::Explode( TopTools_ListOfShape& List,
|
||||
const BRepOffset_Type T ) const
|
||||
{
|
||||
List.Clear();
|
||||
BRep_Builder B;
|
||||
TopTools_MapOfShape Map;
|
||||
|
||||
TopExp_Explorer Fexp;
|
||||
for (Fexp.Init(myShape,TopAbs_FACE); Fexp.More(); Fexp.Next()) {
|
||||
if ( Map.Add(Fexp.Current())) {
|
||||
TopoDS_Face Face = TopoDS::Face(Fexp.Current());
|
||||
TopoDS_Compound Co;
|
||||
B.MakeCompound(Co);
|
||||
B.Add(Co,Face);
|
||||
// on ajoute a Co toutes les faces constituant la nappe de faces
|
||||
// G1 creee a partir de <Face>
|
||||
AddFaces(Face,Co,Map,T);
|
||||
List.Append(Co);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Explode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::Explode( TopTools_ListOfShape& List,
|
||||
const BRepOffset_Type T1,
|
||||
const BRepOffset_Type T2) const
|
||||
{
|
||||
List.Clear();
|
||||
BRep_Builder B;
|
||||
TopTools_MapOfShape Map;
|
||||
|
||||
TopExp_Explorer Fexp;
|
||||
for (Fexp.Init(myShape,TopAbs_FACE); Fexp.More(); Fexp.Next()) {
|
||||
if ( Map.Add(Fexp.Current())) {
|
||||
TopoDS_Face Face = TopoDS::Face(Fexp.Current());
|
||||
TopoDS_Compound Co;
|
||||
B.MakeCompound(Co);
|
||||
B.Add(Co,Face);
|
||||
// on ajoute a Co toutes les faces constituant la nappe de faces
|
||||
// G1 creee a partir de <Face>
|
||||
AddFaces(Face,Co,Map,T1,T2);
|
||||
List.Append(Co);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::AddFaces (const TopoDS_Face& Face,
|
||||
TopoDS_Compound& Co,
|
||||
TopTools_MapOfShape& Map,
|
||||
const BRepOffset_Type T) const
|
||||
{
|
||||
BRep_Builder B;
|
||||
TopExp_Explorer exp(Face,TopAbs_EDGE);
|
||||
for ( ; exp.More(); exp.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
||||
const BRepOffset_ListOfInterval& LI = Type(E);
|
||||
if (!LI.IsEmpty() && LI.First().Type() == T) {
|
||||
// alors ca y est <NewFace> est raccordee G1 a <Face>
|
||||
const TopTools_ListOfShape& L = Ancestors(E);
|
||||
if (L.Extent() == 2) {
|
||||
TopoDS_Face F1 = TopoDS::Face(L.First());
|
||||
if ( F1.IsSame(Face))
|
||||
F1 = TopoDS::Face(L.Last ());
|
||||
if ( Map.Add(F1)) {
|
||||
B.Add(Co,F1);
|
||||
AddFaces(F1,Co,Map,T);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AddFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Analyse::AddFaces (const TopoDS_Face& Face,
|
||||
TopoDS_Compound& Co,
|
||||
TopTools_MapOfShape& Map,
|
||||
const BRepOffset_Type T1,
|
||||
const BRepOffset_Type T2) const
|
||||
{
|
||||
BRep_Builder B;
|
||||
TopExp_Explorer exp(Face,TopAbs_EDGE);
|
||||
for ( ; exp.More(); exp.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
||||
const BRepOffset_ListOfInterval& LI = Type(E);
|
||||
if (!LI.IsEmpty() &&
|
||||
(LI.First().Type() == T1 || LI.First().Type() == T2)) {
|
||||
// alors ca y est <NewFace> est raccordee G1 a <Face>
|
||||
const TopTools_ListOfShape& L = Ancestors(E);
|
||||
if (L.Extent() == 2) {
|
||||
TopoDS_Face F1 = TopoDS::Face(L.First());
|
||||
if ( F1.IsSame(Face))
|
||||
F1 = TopoDS::Face(L.Last ());
|
||||
if ( Map.Add(F1)) {
|
||||
B.Add(Co,F1);
|
||||
AddFaces(F1,Co,Map,T1,T2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
src/BRepOffset/BRepOffset_Inter2d.cdl
Executable file
46
src/BRepOffset/BRepOffset_Inter2d.cdl
Executable file
@@ -0,0 +1,46 @@
|
||||
-- File: BRepOffset_Inter2d.cdl
|
||||
-- Created: Fri Aug 30 15:21:25 1996
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@claquox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
-- Modified by skv - Fri Dec 26 16:53:16 2003 OCC4455
|
||||
|
||||
class Inter2d from BRepOffset
|
||||
|
||||
---Purpose: Computes the intersections betwwen edges on a face
|
||||
-- stores result is SD as AsDes from BRepOffset.
|
||||
|
||||
uses
|
||||
AsDes from BRepAlgo,
|
||||
Offset from BRepOffset,
|
||||
Face from TopoDS,
|
||||
MapOfShape from TopTools,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
Compute(myclass ; AsDes : mutable AsDes from BRepAlgo;
|
||||
F : Face from TopoDS;
|
||||
NewEdges : MapOfShape from TopTools;
|
||||
Tol : Real from Standard);
|
||||
|
||||
---Purpose: Computes the intersections between the edges stored
|
||||
-- is AsDes as descendants of <F> . Intersections is computed
|
||||
-- between two edges if one of them is bound in NewEdges.
|
||||
|
||||
|
||||
-- Modified by skv - Fri Dec 26 16:53:16 2003 OCC4455 Begin
|
||||
-- Add another parameter: offset value.
|
||||
ConnexIntByInt(myclass ;
|
||||
FI : Face from TopoDS;
|
||||
OFI : in out Offset from BRepOffset;
|
||||
MES : in out DataMapOfShapeShape from TopTools;
|
||||
Build : DataMapOfShapeShape from TopTools;
|
||||
AsDes : mutable AsDes from BRepAlgo;
|
||||
Offset: Real from Standard;
|
||||
Tol : Real from Standard);
|
||||
-- Modified by skv - Fri Dec 26 16:53:16 2003 OCC4455 End
|
||||
|
||||
end Inter2d;
|
||||
|
1592
src/BRepOffset/BRepOffset_Inter2d.cxx
Executable file
1592
src/BRepOffset/BRepOffset_Inter2d.cxx
Executable file
File diff suppressed because it is too large
Load Diff
114
src/BRepOffset/BRepOffset_Inter3d.cdl
Executable file
114
src/BRepOffset/BRepOffset_Inter3d.cdl
Executable file
@@ -0,0 +1,114 @@
|
||||
-- File: BRepOffset_Inter3d.cdl
|
||||
-- Created: Fri Aug 30 10:23:06 1996
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@claquox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class Inter3d from BRepOffset
|
||||
|
||||
---Purpose: Computes the intersection face face in a set of faces
|
||||
-- Store the result in a SD as AsDes.
|
||||
|
||||
uses
|
||||
AsDes from BRepAlgo,
|
||||
Image from BRepAlgo,
|
||||
Analyse from BRepOffset,
|
||||
DataMapOfShapeOffset from BRepOffset,
|
||||
Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
ListOfShape from TopTools,
|
||||
MapOfShape from TopTools,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
DataMapOfShapeListOfShape from TopTools,
|
||||
Real from Standard,
|
||||
State from TopAbs
|
||||
|
||||
is
|
||||
Create(AsDes : mutable AsDes from BRepAlgo;
|
||||
Side : State from TopAbs;
|
||||
Tol : Real from Standard);
|
||||
|
||||
CompletInt (me : in out; SetOfFaces : ListOfShape from TopTools;
|
||||
InitOffsetFace : Image from BRepAlgo )
|
||||
is static;
|
||||
|
||||
FaceInter (me : in out;
|
||||
F1, F2 : Face from TopoDS;
|
||||
InitOffsetFace : Image from BRepAlgo)
|
||||
is static;
|
||||
|
||||
ConnexIntByArc(me : in out;
|
||||
SetOfFaces : ListOfShape from TopTools;
|
||||
ShapeInit : Shape from TopoDS;
|
||||
Analyse : Analyse from BRepOffset;
|
||||
InitOffsetFace : Image from BRepAlgo)
|
||||
is static;
|
||||
|
||||
ConnexIntByInt(me : in out;
|
||||
SI : Shape from TopoDS;
|
||||
MapSF : DataMapOfShapeOffset from BRepOffset;
|
||||
A : Analyse from BRepOffset;
|
||||
MES : in out DataMapOfShapeShape from TopTools;
|
||||
Build : in out DataMapOfShapeShape from TopTools;
|
||||
Failed : in out ListOfShape from TopTools)
|
||||
is static;
|
||||
|
||||
ContextIntByInt( me : in out;
|
||||
ContextFaces : MapOfShape from TopTools;
|
||||
ExtentContext : Boolean from Standard;
|
||||
MapSF : DataMapOfShapeOffset from BRepOffset;
|
||||
A : Analyse from BRepOffset;
|
||||
MES : in out DataMapOfShapeShape from TopTools;
|
||||
Build : in out DataMapOfShapeShape from TopTools;
|
||||
Failed : in out ListOfShape from TopTools)
|
||||
is static;
|
||||
|
||||
ContextIntByArc(me : in out;
|
||||
ContextFaces : MapOfShape from TopTools;
|
||||
ExtentContext : Boolean from Standard;
|
||||
Analyse : Analyse from BRepOffset;
|
||||
InitOffsetFace : Image from BRepAlgo;
|
||||
InitOffsetEdge : in out Image from BRepAlgo)
|
||||
is static;
|
||||
|
||||
AddCommonEdges(me : in out;
|
||||
SetOfFaces : ListOfShape from TopTools)
|
||||
is static;
|
||||
|
||||
SetDone(me : in out; F1,F2 : Face from TopoDS)
|
||||
is static;
|
||||
|
||||
---Category: Querying
|
||||
|
||||
IsDone(me ; F1,F2 : Face from TopoDS)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
TouchedFaces(me : in out) returns MapOfShape from TopTools
|
||||
---C++: return &
|
||||
is static;
|
||||
|
||||
AsDes(me) returns AsDes from BRepAlgo
|
||||
is static;
|
||||
|
||||
NewEdges(me : in out) returns MapOfShape from TopTools
|
||||
---C++: return &
|
||||
is static;
|
||||
|
||||
---Category: Private
|
||||
|
||||
Store(me : in out;F1,F2 : Face from TopoDS;
|
||||
LInt1,LInt2 : ListOfShape from TopTools)
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
myAsDes : AsDes from BRepAlgo;
|
||||
myTouched : MapOfShape from TopTools;
|
||||
myDone : DataMapOfShapeListOfShape from TopTools;
|
||||
myNewEdges : MapOfShape from TopTools;
|
||||
mySide : State from TopAbs;
|
||||
myTol : Real from Standard;
|
||||
|
||||
end Inter3d;
|
969
src/BRepOffset/BRepOffset_Inter3d.cxx
Executable file
969
src/BRepOffset/BRepOffset_Inter3d.cxx
Executable file
@@ -0,0 +1,969 @@
|
||||
// File: BRepOffset_Inter3d.cxx
|
||||
// Created: Tue Sep 3 14:19:40 1996
|
||||
// Author: Yves FRICAUD
|
||||
// <yfr@claquox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
// Modified by skv - Fri Dec 26 12:20:14 2003 OCC4455
|
||||
|
||||
#include <BRepOffset_Inter3d.ixx>
|
||||
#include <BRepOffset_Tool.hxx>
|
||||
#include <BRepOffset_Interval.hxx>
|
||||
#include <BRepOffset_ListOfInterval.hxx>
|
||||
#include <BRepOffset_DataMapOfShapeOffset.hxx>
|
||||
#include <BRepOffset_Offset.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepLib_MakeVertex.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopOpeBRepTool_BoxSort.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <Extrema_ExtPC.hxx>
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffset_Inter3d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepOffset_Inter3d::BRepOffset_Inter3d(const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const TopAbs_State Side ,
|
||||
const Standard_Real Tol)
|
||||
:myAsDes(AsDes),
|
||||
mySide(Side),
|
||||
myTol(Tol)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtentEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static void ExtentEdge(const TopoDS_Face& F,
|
||||
const TopoDS_Edge& E,
|
||||
TopoDS_Edge& NE)
|
||||
{
|
||||
TopoDS_Shape aLocalShape = E.EmptyCopied();
|
||||
NE = TopoDS::Edge(aLocalShape);
|
||||
// NE = TopoDS::Edge(E.EmptyCopied());
|
||||
|
||||
|
||||
// Suffit pour les edges analytiques, pour le cas general reconstruire la
|
||||
// la geometrie de l edge en recalculant l intersection des surfaces.
|
||||
|
||||
NE.Orientation(TopAbs_FORWARD);
|
||||
Standard_Real f,l;
|
||||
BRep_Tool::Range(E,f,l);
|
||||
Standard_Real length = l-f;
|
||||
f -= 100*length;
|
||||
l += 100*length;
|
||||
|
||||
BRep_Builder B;
|
||||
B.Range(NE,f,l);
|
||||
BRepAdaptor_Curve CE(E);
|
||||
TopoDS_Vertex V1 = BRepLib_MakeVertex(CE.Value(f));
|
||||
TopoDS_Vertex V2 = BRepLib_MakeVertex(CE.Value(l));
|
||||
B.Add(NE,V1.Oriented(TopAbs_FORWARD));
|
||||
B.Add(NE,V2.Oriented(TopAbs_REVERSED));
|
||||
NE.Orientation(E.Orientation());
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static void SelectEdge (const TopoDS_Face& F,
|
||||
const TopoDS_Face& EF,
|
||||
const TopoDS_Edge& E,
|
||||
TopTools_ListOfShape& LInt)
|
||||
{
|
||||
//------------------------------------------------------------
|
||||
// detrompeur sur les intersections sur les faces periodiques
|
||||
//------------------------------------------------------------
|
||||
TopTools_ListIteratorOfListOfShape it(LInt);
|
||||
// Modified by Sergey KHROMOV - Wed Jun 5 11:43:04 2002 Begin
|
||||
// Standard_Real dU = 1.0e100;
|
||||
Standard_Real dU = RealLast();
|
||||
// Modified by Sergey KHROMOV - Wed Jun 5 11:43:05 2002 End
|
||||
TopoDS_Edge GE;
|
||||
|
||||
Standard_Real Fst, Lst, tmp;
|
||||
BRep_Tool::Range(E, Fst, Lst);
|
||||
BRepAdaptor_Curve Ad1(E);
|
||||
|
||||
gp_Pnt PFirst = Ad1.Value( Fst );
|
||||
gp_Pnt PLast = Ad1.Value( Lst );
|
||||
|
||||
// Modified by Sergey KHROMOV - Wed Jun 5 11:23:10 2002 Begin
|
||||
Extrema_ExtPC anExt;
|
||||
// Modified by Sergey KHROMOV - Wed Jun 5 11:23:11 2002 End
|
||||
//----------------------------------------------------------------------
|
||||
// Selection de l edge qui couvre le plus le domaine de l edge initiale.
|
||||
//----------------------------------------------------------------------
|
||||
for (; it.More(); it.Next()) {
|
||||
const TopoDS_Edge& EI = TopoDS::Edge(it.Value());
|
||||
|
||||
BRep_Tool::Range(EI, Fst, Lst);
|
||||
BRepAdaptor_Curve Ad2(EI);
|
||||
|
||||
// Modified by Sergey KHROMOV - Wed Jun 5 11:25:03 2002 Begin
|
||||
Standard_Integer i;
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(EI);
|
||||
Standard_Boolean isMinFound = Standard_False;
|
||||
Standard_Real aSqrDist1;
|
||||
Standard_Real aSqrDist2;
|
||||
|
||||
anExt.Initialize(Ad2, Fst, Lst, aTol);
|
||||
|
||||
// Seek for the min distance for PFirst:
|
||||
anExt.Perform(PFirst);
|
||||
if (anExt.IsDone()) {
|
||||
for (i = 1; i <= anExt.NbExt(); i++) {
|
||||
if (anExt.IsMin(i)) {
|
||||
const gp_Pnt &aPMin = anExt.Point(i).Value();
|
||||
|
||||
aSqrDist1 = PFirst.SquareDistance(aPMin);
|
||||
isMinFound = Standard_True;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isMinFound) {
|
||||
gp_Pnt aP1 = Ad2.Value(Fst);
|
||||
gp_Pnt aP2 = Ad2.Value(Lst);
|
||||
|
||||
aSqrDist1 = Min(aP1.SquareDistance(PFirst), aP2.SquareDistance(PFirst));
|
||||
}
|
||||
|
||||
// Seek for the min distance for PLast:
|
||||
isMinFound = Standard_False;
|
||||
anExt.Perform(PLast);
|
||||
if (anExt.IsDone()) {
|
||||
for (i = 1; i <= anExt.NbExt(); i++) {
|
||||
if (anExt.IsMin(i)) {
|
||||
const gp_Pnt &aPMin = anExt.Point(i).Value();
|
||||
|
||||
aSqrDist2 = PLast.SquareDistance(aPMin);
|
||||
isMinFound = Standard_True;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isMinFound) {
|
||||
gp_Pnt aP1 = Ad2.Value(Fst);
|
||||
gp_Pnt aP2 = Ad2.Value(Lst);
|
||||
|
||||
aSqrDist2 = Min(aP1.SquareDistance(PLast), aP2.SquareDistance(PLast));
|
||||
}
|
||||
|
||||
tmp = aSqrDist1 + aSqrDist2;
|
||||
// gp_Pnt P1 = Ad2.Value(Fst);
|
||||
// gp_Pnt P2 = Ad2.Value(Lst);
|
||||
|
||||
// tmp = P1.Distance(PFirst) + P2.Distance(PLast);
|
||||
if( tmp <= dU ) {
|
||||
dU = tmp;
|
||||
GE = EI;
|
||||
}
|
||||
// Modified by Sergey KHROMOV - Wed Jun 5 11:24:54 2002 End
|
||||
|
||||
}
|
||||
LInt.Clear();
|
||||
LInt.Append(GE);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CompletInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::CompletInt(const TopTools_ListOfShape& SetOfFaces,
|
||||
const BRepAlgo_Image& InitOffsetFace)
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
// Calcul des intersections des offsetfaces entre elles
|
||||
// Distinction des intersection entre faces // tangentes.
|
||||
//---------------------------------------------------------------
|
||||
TopoDS_Face F1,F2;
|
||||
TopTools_ListIteratorOfListOfShape it;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Construction des boites englobantes.
|
||||
//---------------------------------------------------------------
|
||||
TopOpeBRepTool_BoxSort BOS;
|
||||
BRep_Builder B;
|
||||
TopoDS_Compound CompOS;
|
||||
B.MakeCompound(CompOS);
|
||||
|
||||
for (it.Initialize(SetOfFaces); it.More(); it.Next()) {
|
||||
const TopoDS_Shape& OS = it.Value();
|
||||
B.Add(CompOS,OS);
|
||||
}
|
||||
BOS.AddBoxesMakeCOB(CompOS,TopAbs_FACE);
|
||||
|
||||
//---------------------------
|
||||
// Intersection des faces //
|
||||
//---------------------------
|
||||
for (it.Initialize(SetOfFaces); it.More(); it.Next()) {
|
||||
const TopoDS_Face& F1 = TopoDS::Face(it.Value());
|
||||
TColStd_ListIteratorOfListOfInteger itLI = BOS.Compare(F1);
|
||||
for (; itLI.More(); itLI.Next()) {
|
||||
F2 = TopoDS::Face(BOS.TouchedShape(itLI));
|
||||
FaceInter(F1,F2,InitOffsetFace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CompletInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2,
|
||||
const BRepAlgo_Image& InitOffsetFace)
|
||||
{
|
||||
TopTools_ListOfShape LInt1, LInt2;
|
||||
TopoDS_Edge NullEdge;
|
||||
|
||||
if (F1.IsSame(F2)) return;
|
||||
if (IsDone(F1,F2)) return;
|
||||
const TopoDS_Shape& InitF1 = InitOffsetFace.ImageFrom(F1);
|
||||
const TopoDS_Shape& InitF2 = InitOffsetFace.ImageFrom(F2);
|
||||
Standard_Boolean InterPipes = (InitF2.ShapeType() == TopAbs_EDGE &&
|
||||
InitF1.ShapeType() == TopAbs_EDGE );
|
||||
Standard_Boolean InterFaces = (InitF1.ShapeType() == TopAbs_FACE &&
|
||||
InitF2.ShapeType() == TopAbs_FACE);
|
||||
TopTools_ListOfShape LE,LV;
|
||||
LInt1.Clear(); LInt2.Clear();
|
||||
if (BRepOffset_Tool::HasCommonShapes(F1,F2,LE,LV) ||
|
||||
myAsDes->HasCommonDescendant(F1,F2,LE)) {
|
||||
//-------------------------------------------------
|
||||
// F1 et F2 partagent des shapes.
|
||||
//-------------------------------------------------
|
||||
if ( LE.IsEmpty() && !LV.IsEmpty()) {
|
||||
if (InterPipes) {
|
||||
//----------------------------
|
||||
// tuyaux partageant un vertex.
|
||||
//----------------------------
|
||||
const TopoDS_Edge& EE1 = TopoDS::Edge(InitF1);
|
||||
const TopoDS_Edge& EE2 = TopoDS::Edge(InitF2);
|
||||
TopoDS_Vertex VE1[2],VE2[2];
|
||||
TopExp::Vertices(EE1,VE1[0],VE1[1]);
|
||||
TopExp::Vertices(EE2,VE2[0],VE2[1]);
|
||||
TopoDS_Vertex V;
|
||||
for (Standard_Integer i = 0 ; i < 2; i++) {
|
||||
for (Standard_Integer j = 0 ; j < 2; j++) {
|
||||
if (VE1[i].IsSame(VE2[j])) {
|
||||
V = VE1[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!InitOffsetFace.HasImage(V)) { //pas de sphere
|
||||
BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//--------------------------------------------------------
|
||||
// Intersection de faces n ayant que des vertex en communs.
|
||||
// et dont les supports avaient des edges en commun.
|
||||
// INSUFFISANT mais critere plus large secoue trop
|
||||
// les sections et le reste pour l instant.
|
||||
//--------------------------------------------------------
|
||||
if (InterFaces &&
|
||||
BRepOffset_Tool::HasCommonShapes(TopoDS::Face(InitF1),
|
||||
TopoDS::Face(InitF2),LE,LV))
|
||||
if (!LE.IsEmpty())
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (InterPipes) {
|
||||
BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide);
|
||||
}
|
||||
else {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
}
|
||||
}
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ConnexIntByArc
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& SetOfFaces,
|
||||
const TopoDS_Shape& ShapeInit,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
const BRepAlgo_Image& InitOffsetFace)
|
||||
{
|
||||
BRepOffset_Type OT = BRepOffset_Concave;
|
||||
if (mySide == TopAbs_OUT) OT = BRepOffset_Convex;
|
||||
TopExp_Explorer Exp(ShapeInit,TopAbs_EDGE);
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
TopoDS_Face F1,F2;
|
||||
TopoDS_Edge NullEdge;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// etape 1 : Intersections des face // correspondant a des faces
|
||||
// initiales separees par une edge concave si offset > 0,
|
||||
// convexe sinon.
|
||||
//---------------------------------------------------------------------
|
||||
for (; Exp.More(); Exp.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
|
||||
const BRepOffset_ListOfInterval& L = Analyse.Type(E);
|
||||
if (!L.IsEmpty() && L.First().Type() == OT) {
|
||||
//-----------------------------------------------------------
|
||||
// l edge est du bon type , recuperation des faces adjacentes.
|
||||
//-----------------------------------------------------------
|
||||
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
|
||||
if (Anc.Extent() == 2) {
|
||||
F1 = TopoDS::Face(InitOffsetFace.Image(Anc.First()).First());
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(Anc.Last ()).First());
|
||||
if (!IsDone(F1,F2)) {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,Standard_True);
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------
|
||||
// etape 2 : Intersections des tuyaux partageant un vertex sans
|
||||
// sphere avec:
|
||||
// - Soit les tuyaux sur chaque autre edge partageant le vertex
|
||||
// - Soit avec les faces contenant une edge connexe au vertex
|
||||
// qui n a pas de tuyaux.
|
||||
//---------------------------------------------------------------------
|
||||
TopoDS_Vertex V[2];
|
||||
TopTools_ListIteratorOfListOfShape it;
|
||||
|
||||
for (Exp.Init(ShapeInit,TopAbs_EDGE); Exp.More(); Exp.Next()) {
|
||||
const TopoDS_Edge& E1 = TopoDS::Edge(Exp.Current());
|
||||
if (InitOffsetFace.HasImage(E1)) {
|
||||
//---------------------------
|
||||
// E1 a genere un tuyau.
|
||||
//---------------------------
|
||||
F1 = TopoDS::Face(InitOffsetFace.Image(E1).First());;
|
||||
TopExp::Vertices(E1,V[0],V[1]);
|
||||
const TopTools_ListOfShape& AncE1 = Analyse.Ancestors(E1);
|
||||
|
||||
for (Standard_Integer i = 0; i < 2; i++) {
|
||||
if (!InitOffsetFace.HasImage(V[i])) {
|
||||
//-----------------------------
|
||||
// le vertex n a pas de sphere.
|
||||
//-----------------------------
|
||||
const TopTools_ListOfShape& Anc = Analyse.Ancestors(V[i]);
|
||||
TopTools_ListOfShape TangOnV;
|
||||
Analyse.TangentEdges(E1,V[i],TangOnV);
|
||||
TopTools_MapOfShape MTEV;
|
||||
for (it.Initialize(TangOnV); it.More(); it.Next()) {
|
||||
MTEV.Add(it.Value());
|
||||
}
|
||||
for (it.Initialize(Anc); it.More(); it.Next()) {
|
||||
const TopoDS_Edge& E2 = TopoDS::Edge(it.Value());
|
||||
// Modified by skv - Fri Jan 16 16:27:54 2004 OCC4455 Begin
|
||||
// if (E1.IsSame(E2) || MTEV.Contains(E2)) continue;
|
||||
Standard_Boolean isToSkip = Standard_False;
|
||||
|
||||
if (!E1.IsSame(E2)) {
|
||||
const BRepOffset_ListOfInterval& aL = Analyse.Type(E2);
|
||||
|
||||
isToSkip = (MTEV.Contains(E2) &&
|
||||
(aL.IsEmpty() ||
|
||||
(!aL.IsEmpty() && aL.First().Type() != OT)));
|
||||
}
|
||||
|
||||
if (E1.IsSame(E2) || isToSkip)
|
||||
continue;
|
||||
// Modified by skv - Fri Jan 16 16:27:54 2004 OCC4455 End
|
||||
if (InitOffsetFace.HasImage(E2)) {
|
||||
//-----------------------------
|
||||
// E2 a genere un tuyau.
|
||||
//-----------------------------
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(E2).First());
|
||||
if (!IsDone(F1,F2)) {
|
||||
//---------------------------------------------------------------------
|
||||
// Intersection tuyau/tuyau si les edges ne sont pas tangentes (AFINIR).
|
||||
//----------------------------------------------------------------------
|
||||
BRepOffset_Tool::PipeInter (F1,F2,LInt1,LInt2,mySide);
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//-------------------------------------------------------
|
||||
// Intersection du tuyau de E1 avec les faces //
|
||||
// aux face contenant E2 si elles ne sont pas tangentes
|
||||
// au tuyau. ou si E2 n est pas une edge tangente.
|
||||
//-------------------------------------------------------
|
||||
const BRepOffset_ListOfInterval& L = Analyse.Type(E2);
|
||||
if (!L.IsEmpty() && L.First().Type() == BRepOffset_Tangent) {
|
||||
continue;
|
||||
}
|
||||
const TopTools_ListOfShape& AncE2 = Analyse.Ancestors(E2);
|
||||
Standard_Boolean TangentFaces = Standard_False;
|
||||
if (AncE2.Extent() == 2) {
|
||||
TopoDS_Face InitF2 = TopoDS::Face(AncE2.First ());
|
||||
TangentFaces = (InitF2.IsSame(AncE1.First()) ||
|
||||
InitF2.IsSame(AncE1.Last()));
|
||||
if (!TangentFaces) {
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
|
||||
if (!IsDone(F1,F2)) {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
InitF2 = TopoDS::Face(AncE2.Last ());
|
||||
TangentFaces = (InitF2.IsSame(AncE1.First()) ||
|
||||
InitF2.IsSame(AncE1.Last()));
|
||||
if (!TangentFaces) {
|
||||
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
|
||||
if (!IsDone(F1,F2)) {
|
||||
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
|
||||
Store (F1,F2,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ConnexIntByInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::ConnexIntByInt
|
||||
(const TopoDS_Shape& SI,
|
||||
const BRepOffset_DataMapOfShapeOffset& MapSF,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
TopTools_DataMapOfShapeShape& MES,
|
||||
TopTools_DataMapOfShapeShape& Build,
|
||||
TopTools_ListOfShape& Failed)
|
||||
{
|
||||
//TopExp_Explorer Exp(SI,TopAbs_EDGE);
|
||||
TopTools_IndexedMapOfShape Emap;
|
||||
TopExp::MapShapes( SI, TopAbs_EDGE, Emap );
|
||||
TopoDS_Face F1,F2,OF1,OF2,NF1,NF2;
|
||||
TopAbs_State CurSide = mySide;
|
||||
BRep_Builder B;
|
||||
TopTools_ListIteratorOfListOfShape it;
|
||||
|
||||
//for (; Exp.More(); Exp.Next()) {
|
||||
for (Standard_Integer i = 1; i <= Emap.Extent(); i++) {
|
||||
//const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
|
||||
const TopoDS_Edge& E = TopoDS::Edge(Emap(i));
|
||||
const BRepOffset_ListOfInterval& L = Analyse.Type(E);
|
||||
if (!L.IsEmpty()) {
|
||||
BRepOffset_Type OT = L.First().Type();
|
||||
if (OT == BRepOffset_Convex || OT == BRepOffset_Concave) {
|
||||
if (OT == BRepOffset_Concave) CurSide = TopAbs_IN;
|
||||
else CurSide = TopAbs_OUT;
|
||||
//-----------------------------------------------------------
|
||||
// l edge est du bon type , recuperation des faces adjacentes.
|
||||
//-----------------------------------------------------------
|
||||
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
|
||||
if (Anc.Extent() != 2) continue;
|
||||
F1 = TopoDS::Face(Anc.First());
|
||||
F2 = TopoDS::Face(Anc.Last ());
|
||||
OF1 = TopoDS::Face(MapSF(F1).Face()); OF2 = TopoDS::Face(MapSF(F2).Face());
|
||||
if (!MES.IsBound(OF1)) {
|
||||
Standard_Boolean enlargeU = Standard_True;
|
||||
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
|
||||
BRepOffset_Tool::CheckBounds( F1, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
|
||||
BRepOffset_Tool::EnLargeFace(OF1,NF1,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast);
|
||||
MES.Bind(OF1,NF1);
|
||||
}
|
||||
else {
|
||||
NF1 = TopoDS::Face(MES(OF1));
|
||||
}
|
||||
if (!MES.IsBound(OF2)) {
|
||||
Standard_Boolean enlargeU = Standard_True;
|
||||
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
|
||||
BRepOffset_Tool::CheckBounds( F2, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
|
||||
BRepOffset_Tool::EnLargeFace(OF2,NF2,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast);
|
||||
MES.Bind(OF2,NF2);
|
||||
}
|
||||
else {
|
||||
NF2 = TopoDS::Face(MES(OF2));
|
||||
}
|
||||
if (!IsDone(NF1,NF2)) {
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,Standard_True);
|
||||
if (LInt1.Extent() > 1)
|
||||
{
|
||||
// l intersection est en plusieurs edges (franchissement de couture)
|
||||
SelectEdge( NF1, NF2, E, LInt1 );
|
||||
SelectEdge( NF1, NF2, E, LInt2 );
|
||||
}
|
||||
SetDone(NF1,NF2);
|
||||
if (!LInt1.IsEmpty()) {
|
||||
Store (NF1,NF2,LInt1,LInt2);
|
||||
TopoDS_Compound C;
|
||||
B.MakeCompound(C);
|
||||
for (it.Initialize(LInt1) ; it.More(); it.Next()) {
|
||||
B.Add(C,it.Value());
|
||||
}
|
||||
Build.Bind(E,C);
|
||||
}
|
||||
else {
|
||||
Failed.Append(E);
|
||||
}
|
||||
} else { // IsDone(NF1,NF2)
|
||||
// Modified by skv - Fri Dec 26 12:20:13 2003 OCC4455 Begin
|
||||
const TopTools_ListOfShape &aLInt1 = myAsDes->Descendant(NF1);
|
||||
const TopTools_ListOfShape &aLInt2 = myAsDes->Descendant(NF2);
|
||||
|
||||
if (!aLInt1.IsEmpty()) {
|
||||
TopoDS_Compound C;
|
||||
TopTools_ListIteratorOfListOfShape anIt2;
|
||||
|
||||
B.MakeCompound(C);
|
||||
|
||||
for (it.Initialize(aLInt1) ; it.More(); it.Next()) {
|
||||
const TopoDS_Shape &anE1 = it.Value();
|
||||
|
||||
for (anIt2.Initialize(aLInt2) ; anIt2.More(); anIt2.Next()) {
|
||||
const TopoDS_Shape &anE2 = anIt2.Value();
|
||||
|
||||
if (anE1.IsSame(anE2))
|
||||
B.Add(C, anE1);
|
||||
}
|
||||
}
|
||||
Build.Bind(E,C);
|
||||
}
|
||||
else {
|
||||
Failed.Append(E);
|
||||
}
|
||||
}
|
||||
// Modified by skv - Fri Dec 26 12:20:14 2003 OCC4455 End
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ContextIntByInt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::ContextIntByInt
|
||||
(const TopTools_MapOfShape& ContextFaces,
|
||||
const Standard_Boolean ExtentContext,
|
||||
const BRepOffset_DataMapOfShapeOffset& MapSF,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
TopTools_DataMapOfShapeShape& MES,
|
||||
TopTools_DataMapOfShapeShape& Build,
|
||||
TopTools_ListOfShape& Failed)
|
||||
{
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
TopTools_MapIteratorOfMapOfShape itCF(ContextFaces);
|
||||
TopTools_MapOfShape MV;
|
||||
TopExp_Explorer exp;
|
||||
TopoDS_Face OF,NF,WCF;
|
||||
TopoDS_Edge OE;
|
||||
TopoDS_Compound C;
|
||||
BRep_Builder B;
|
||||
TopTools_ListIteratorOfListOfShape it;
|
||||
for (; itCF.More(); itCF.Next()) {
|
||||
const TopoDS_Face& CF = TopoDS::Face(itCF.Key());
|
||||
myTouched.Add(CF);
|
||||
if (ExtentContext) {
|
||||
BRepOffset_Tool::EnLargeFace(CF,NF,0,0);
|
||||
MES.Bind(CF,NF);
|
||||
}
|
||||
}
|
||||
TopAbs_State Side = TopAbs_OUT;
|
||||
|
||||
for (itCF.Initialize(ContextFaces); itCF.More(); itCF.Next()) {
|
||||
const TopoDS_Face& CF = TopoDS::Face(itCF.Key());
|
||||
if (ExtentContext) WCF = TopoDS::Face(MES(CF));
|
||||
else WCF = CF;
|
||||
|
||||
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
|
||||
exp.More(); exp.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
||||
if (!Analyse.HasAncestor(E)) {
|
||||
//----------------------------------------------------------------
|
||||
// Les edges des faces de contexte qui ne sont pas dans le shape
|
||||
// initiales peuvent apparaitre dans le resultat.
|
||||
//----------------------------------------------------------------
|
||||
if (!ExtentContext) {
|
||||
myAsDes->Add(CF,E);
|
||||
myNewEdges.Add(E);
|
||||
}
|
||||
else {
|
||||
if (!MES.IsBound(E)) {
|
||||
TopoDS_Edge NE;
|
||||
Standard_Real f,l,Tol;
|
||||
BRep_Tool::Range(E,f,l);
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
ExtentEdge(CF,E,NE);
|
||||
TopoDS_Vertex V1,V2;
|
||||
TopExp::Vertices(E,V1,V2);
|
||||
NE.Orientation(TopAbs_FORWARD);
|
||||
myAsDes->Add(NE,V1.Oriented(TopAbs_REVERSED));
|
||||
myAsDes->Add(NE,V2.Oriented(TopAbs_FORWARD));
|
||||
TopoDS_Shape aLocalShape = V1.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),f,NE,Tol);
|
||||
aLocalShape = V2.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),l,NE,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),f,NE,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),l,NE,Tol);
|
||||
NE.Orientation(E.Orientation());
|
||||
myAsDes->Add(CF,NE);
|
||||
myNewEdges.Add(NE);
|
||||
MES.Bind(E,NE);
|
||||
}
|
||||
else {
|
||||
TopoDS_Shape NE = MES(E);
|
||||
TopoDS_Shape aLocalShape = NE.Oriented(E.Orientation());
|
||||
myAsDes->Add(CF,aLocalShape);
|
||||
// myAsDes->Add(CF,NE.Oriented(E.Orientation()));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
|
||||
const TopoDS_Face& F = TopoDS::Face(Anc.First());
|
||||
OF = TopoDS::Face(MapSF(F).Face());
|
||||
TopoDS_Shape aLocalShape = MapSF(F).Generated(E);
|
||||
OE = TopoDS::Edge(aLocalShape);
|
||||
// OE = TopoDS::Edge(MapSF(F).Generated(E));
|
||||
if (!MES.IsBound(OF)) {
|
||||
BRepOffset_Tool::EnLargeFace(OF,NF,1,1);
|
||||
MES.Bind(OF,NF);
|
||||
}
|
||||
else {
|
||||
NF = TopoDS::Face(MES(OF));
|
||||
}
|
||||
if (!IsDone(NF,CF)) {
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
TopTools_ListOfShape LOE;
|
||||
LOE.Append(OE);
|
||||
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,Standard_True);
|
||||
SetDone(NF,CF);
|
||||
if (!LInt1.IsEmpty()) {
|
||||
Store (CF,NF,LInt1,LInt2);
|
||||
if (LInt1.Extent() == 1) {
|
||||
Build.Bind(E,LInt1.First());
|
||||
}
|
||||
else {
|
||||
B.MakeCompound(C);
|
||||
for (it.Initialize(LInt1) ; it.More(); it.Next()) {
|
||||
B.Add(C,it.Value());
|
||||
}
|
||||
Build.Bind(E,C);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Failed.Append(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ContextIntByArc
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::ContextIntByArc(const TopTools_MapOfShape& ContextFaces,
|
||||
const Standard_Boolean InSide,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
const BRepAlgo_Image& InitOffsetFace,
|
||||
BRepAlgo_Image& InitOffsetEdge)
|
||||
|
||||
{
|
||||
TopTools_ListOfShape LInt1,LInt2;
|
||||
TopTools_MapIteratorOfMapOfShape it(ContextFaces);
|
||||
TopTools_MapOfShape MV;
|
||||
TopExp_Explorer exp;
|
||||
TopoDS_Face OF1,OF2;
|
||||
TopoDS_Edge OE;
|
||||
BRep_Builder B;
|
||||
TopoDS_Edge NullEdge;
|
||||
|
||||
for (; it.More(); it.Next()) {
|
||||
const TopoDS_Face& CF = TopoDS::Face(it.Key());
|
||||
myTouched.Add(CF);
|
||||
}
|
||||
|
||||
for (it.Initialize(ContextFaces); it.More(); it.Next()) {
|
||||
const TopoDS_Face& CF = TopoDS::Face(it.Key());
|
||||
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
|
||||
exp.More(); exp.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
|
||||
if (!Analyse.HasAncestor(E)) {
|
||||
if (InSide)
|
||||
myAsDes->Add(CF,E);
|
||||
else {
|
||||
TopoDS_Edge NE;
|
||||
if (!InitOffsetEdge.HasImage(E)) {
|
||||
Standard_Real f,l,Tol;
|
||||
BRep_Tool::Range(E,f,l);
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
ExtentEdge(CF,E,NE);
|
||||
TopoDS_Vertex V1,V2;
|
||||
TopExp::Vertices(E,V1,V2);
|
||||
NE.Orientation(TopAbs_FORWARD);
|
||||
myAsDes->Add(NE,V1.Oriented(TopAbs_REVERSED));
|
||||
myAsDes->Add(NE,V2.Oriented(TopAbs_FORWARD));
|
||||
TopoDS_Shape aLocalShape = V1.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),f,NE,Tol);
|
||||
aLocalShape = V2.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),l,NE,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),f,NE,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),l,NE,Tol);
|
||||
NE.Orientation(E.Orientation());
|
||||
myAsDes->Add(CF,NE);
|
||||
InitOffsetEdge.Bind(E,NE);
|
||||
}
|
||||
else {
|
||||
NE = TopoDS::Edge(InitOffsetEdge.Image(E).First());
|
||||
myAsDes->Add(CF,NE.Oriented(E.Orientation()));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
OE.Nullify();
|
||||
//----------------------------------------------
|
||||
// OF1 face parallele genere par l ancetre de E.
|
||||
//----------------------------------------------
|
||||
const TopoDS_Shape SI = Analyse.Ancestors(E).First();
|
||||
OF1 = TopoDS::Face(InitOffsetFace.Image(SI).First());
|
||||
OE = TopoDS::Edge(InitOffsetEdge.Image(E).First());
|
||||
//--------------------------------------------------
|
||||
// MAJ de OE sur bouchon CF.
|
||||
//--------------------------------------------------
|
||||
// TopTools_ListOfShape LOE; LOE.Append(OE);
|
||||
// BRepOffset_Tool::TryProject(CF,OF1,LOE,LInt1,LInt2,mySide);
|
||||
// LInt2.Clear();
|
||||
// StoreInter3d(CF,OF1,myTouched,NewEdges,InterDone,myAsDes,
|
||||
// LInt1,LInt2);
|
||||
LInt1.Clear(); LInt1.Append(OE);
|
||||
LInt2.Clear();
|
||||
TopAbs_Orientation O1,O2;
|
||||
BRepOffset_Tool::OrientSection(OE,CF,OF1,O1,O2);
|
||||
// if (mySide == TopAbs_OUT) O1 = TopAbs::Reverse(O1);
|
||||
O1 = TopAbs::Reverse(O1);
|
||||
LInt1.First().Orientation(O1);
|
||||
Store(CF,OF1,LInt1,LInt2);
|
||||
|
||||
//------------------------------------------------------
|
||||
// Traitement des offsets sur les ancetres des vertices.
|
||||
//------------------------------------------------------
|
||||
TopoDS_Vertex V[2];
|
||||
TopExp::Vertices (E,V[0],V[1]);
|
||||
for (Standard_Integer i = 0; i < 2; i++) {
|
||||
if (!MV.Add(V[i])) continue;
|
||||
OF1.Nullify();
|
||||
const TopTools_ListOfShape& LE = Analyse.Ancestors(V[i]);
|
||||
TopTools_ListIteratorOfListOfShape itLE(LE);
|
||||
for ( ; itLE.More(); itLE.Next()) {
|
||||
const TopoDS_Edge& EV = TopoDS::Edge(itLE.Value());
|
||||
if (InitOffsetFace.HasImage(EV)) {
|
||||
//-------------------------------------------------
|
||||
// OF1 face parallele genere par une edge ancetre de V[i].
|
||||
//-------------------------------------------------
|
||||
OF1 = TopoDS::Face(InitOffsetFace.Image(EV).First());
|
||||
OE = TopoDS::Edge(InitOffsetEdge.Image(V[i]).First());
|
||||
//--------------------------------------------------
|
||||
// MAj de OE sur bouchon CF.
|
||||
//--------------------------------------------------
|
||||
// LOE.Clear(); LOE.Append(OE);
|
||||
// BRepOffset_Tool::TryProject(CF,OF1,LOE,LInt1,LInt2,mySide);
|
||||
// LInt2.Clear();
|
||||
// StoreInter3d(CF,OF1,myTouched,NewEdges,InterDone,myAsDes,
|
||||
// LInt1,LInt2);
|
||||
LInt1.Clear(); LInt1.Append(OE);
|
||||
LInt2.Clear();
|
||||
TopAbs_Orientation O1,O2;
|
||||
BRepOffset_Tool::OrientSection(OE,CF,OF1,O1,O2);
|
||||
// if (mySide == TopAbs_OUT);
|
||||
O1 = TopAbs::Reverse(O1);
|
||||
LInt1.First().Orientation(O1);
|
||||
Store(CF,OF1,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_VERTEX);
|
||||
exp.More(); exp.Next()) {
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex(exp.Current());
|
||||
if (!Analyse.HasAncestor(V)) {
|
||||
continue;
|
||||
}
|
||||
const TopTools_ListOfShape& LE = Analyse.Ancestors(V);
|
||||
TopTools_ListIteratorOfListOfShape itLE(LE);
|
||||
for (; itLE.More(); itLE.Next()) {
|
||||
const TopoDS_Edge& EV = TopoDS::Edge(itLE.Value());
|
||||
const TopTools_ListOfShape& LF = Analyse.Ancestors(EV);
|
||||
TopTools_ListIteratorOfListOfShape itLF(LF);
|
||||
for ( ; itLF.More(); itLF.Next()) {
|
||||
const TopoDS_Face& FEV = TopoDS::Face(itLF.Value());
|
||||
//-------------------------------------------------
|
||||
// OF1 face parallele genere par uneFace ancetre de V[i].
|
||||
//-------------------------------------------------
|
||||
OF1 = TopoDS::Face(InitOffsetFace.Image(FEV).First());
|
||||
if (!IsDone(OF1,CF)) {
|
||||
//-------------------------------------------------------
|
||||
//Recherche si une des edges de OF1 n a pas de trace dans
|
||||
// CF.
|
||||
//-------------------------------------------------------
|
||||
TopTools_ListOfShape LOE;
|
||||
TopExp_Explorer exp2(OF1.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
|
||||
for ( ;exp2.More(); exp2.Next()) {
|
||||
LOE.Append(exp2.Current());
|
||||
}
|
||||
BRepOffset_Tool::TryProject(CF,OF1,LOE,LInt1,LInt2,mySide,myTol);
|
||||
//-------------------------------------------------------
|
||||
// Si pas de trace essai intersection.
|
||||
//-------------------------------------------------------
|
||||
if (LInt1.IsEmpty()) {
|
||||
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge);
|
||||
}
|
||||
Store (CF,OF1,LInt1,LInt2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddCommonEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::AddCommonEdges(const TopTools_ListOfShape& SetOfFaces)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::SetDone(const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2)
|
||||
{
|
||||
if (!myDone.IsBound(F1)) {
|
||||
TopTools_ListOfShape empty;
|
||||
myDone.Bind(F1,empty);
|
||||
}
|
||||
myDone(F1).Append(F2);
|
||||
if (!myDone.IsBound(F2)) {
|
||||
TopTools_ListOfShape empty;
|
||||
myDone.Bind(F2,empty);
|
||||
}
|
||||
myDone(F2).Append(F1);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepOffset_Inter3d::IsDone(const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2)
|
||||
const
|
||||
{
|
||||
if (myDone.IsBound(F1)) {
|
||||
TopTools_ListIteratorOfListOfShape it (myDone(F1));
|
||||
for (; it.More(); it.Next()) {
|
||||
if (it.Value().IsSame(F2)) return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TouchedFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopTools_MapOfShape& BRepOffset_Inter3d::TouchedFaces()
|
||||
{
|
||||
return myTouched;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AsDes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(BRepAlgo_AsDes) BRepOffset_Inter3d::AsDes() const
|
||||
{
|
||||
return myAsDes;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopTools_MapOfShape& BRepOffset_Inter3d::NewEdges()
|
||||
{
|
||||
return myNewEdges;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Store
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_Inter3d::Store(const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2,
|
||||
const TopTools_ListOfShape& LInt1,
|
||||
const TopTools_ListOfShape& LInt2)
|
||||
{
|
||||
if (!LInt1.IsEmpty()) {
|
||||
myTouched.Add(F1);
|
||||
myTouched.Add(F2);
|
||||
myAsDes->Add( F1,LInt1);
|
||||
myAsDes->Add( F2,LInt2);
|
||||
TopTools_ListIteratorOfListOfShape it(LInt1);
|
||||
for (; it.More(); it.Next()) {
|
||||
myNewEdges.Add(it.Value());
|
||||
}
|
||||
}
|
||||
SetDone(F1,F2);
|
||||
}
|
||||
|
||||
|
||||
|
53
src/BRepOffset/BRepOffset_Interval.cdl
Executable file
53
src/BRepOffset/BRepOffset_Interval.cdl
Executable file
@@ -0,0 +1,53 @@
|
||||
-- File: BRepOffset_Interval.cdl
|
||||
-- Created: Fri Oct 20 17:17:13 1995
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@stylox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class Interval from BRepOffset
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Type from BRepOffset
|
||||
|
||||
is
|
||||
|
||||
Create;
|
||||
|
||||
Create (U1,U2 : Real from Standard;
|
||||
Type : Type from BRepOffset)
|
||||
returns Interval from BRepOffset;
|
||||
|
||||
First (me : in out; U : Real from Standard)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Last (me : in out; U : Real from Standard)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Type (me : in out; T : Type from BRepOffset)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
First (me) returns Real from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Last (me) returns Real from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Type (me) returns Type from BRepOffset
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
f,l : Real from Standard;
|
||||
type : Type from BRepOffset;
|
||||
|
||||
end Interval;
|
34
src/BRepOffset/BRepOffset_Interval.cxx
Executable file
34
src/BRepOffset/BRepOffset_Interval.cxx
Executable file
@@ -0,0 +1,34 @@
|
||||
// File: BRepOffset_Interval.cxx
|
||||
// Created: Fri Oct 20 18:01:32 1995
|
||||
// Author: Yves FRICAUD
|
||||
// <yfr@stylox>
|
||||
|
||||
|
||||
#include <BRepOffset_Interval.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffset_Interval
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepOffset_Interval::BRepOffset_Interval()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffset_Interval
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepOffset_Interval::BRepOffset_Interval(const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const BRepOffset_Type Type):
|
||||
f(U1),
|
||||
l(U2),
|
||||
type(Type)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
73
src/BRepOffset/BRepOffset_Interval.lxx
Executable file
73
src/BRepOffset/BRepOffset_Interval.lxx
Executable file
@@ -0,0 +1,73 @@
|
||||
// File: BRepOffset_Interval.lxx
|
||||
// Created: Fri Oct 20 18:08:49 1995
|
||||
// Author: Yves FRICAUD
|
||||
// <yfr@stylox>
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BRepOffset_Interval::First(const Standard_Real U)
|
||||
{
|
||||
f = U;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BRepOffset_Interval::Last(const Standard_Real U)
|
||||
{
|
||||
l = U;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BRepOffset_Interval::Type(const BRepOffset_Type T)
|
||||
{
|
||||
type = T;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepOffset_Interval::First() const
|
||||
{
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real BRepOffset_Interval::Last() const
|
||||
{
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline BRepOffset_Type BRepOffset_Interval::Type() const
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
|
39
src/BRepOffset/BRepOffset_MakeLoops.cdl
Executable file
39
src/BRepOffset/BRepOffset_MakeLoops.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: BRepOffset_MakeLoops.cdl
|
||||
-- Created: Thu Sep 5 14:45:25 1996
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@claquox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class MakeLoops from BRepOffset
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
ListOfShape from TopTools,
|
||||
AsDes from BRepAlgo,
|
||||
Analyse from BRepOffset,
|
||||
Image from BRepAlgo,
|
||||
DataMapOfShapeShape from TopTools
|
||||
|
||||
is
|
||||
Create;
|
||||
|
||||
Build (me: in out; LF : ListOfShape from TopTools;
|
||||
AsDes : AsDes from BRepAlgo;
|
||||
Image : in out Image from BRepAlgo);
|
||||
|
||||
BuildOnContext(me: in out; LContext : ListOfShape from TopTools;
|
||||
Analyse : Analyse from BRepOffset;
|
||||
AsDes : AsDes from BRepAlgo;
|
||||
Image : in out Image from BRepAlgo;
|
||||
InSide : Boolean from Standard);
|
||||
|
||||
BuildFaces (me: in out; LF : ListOfShape from TopTools;
|
||||
AsDes : AsDes from BRepAlgo;
|
||||
Image : in out Image from BRepAlgo);
|
||||
|
||||
fields
|
||||
myVerVerMap : DataMapOfShapeShape from TopTools;
|
||||
|
||||
end MakeLoops;
|
558
src/BRepOffset/BRepOffset_MakeLoops.cxx
Executable file
558
src/BRepOffset/BRepOffset_MakeLoops.cxx
Executable file
@@ -0,0 +1,558 @@
|
||||
// File: BRepOffset_MakeLoops.cxx
|
||||
// Created: Thu Sep 5 15:48:34 1996
|
||||
// Author: Yves FRICAUD
|
||||
// <yfr@claquox.paris1.matra-dtv.fr>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <BRepOffset_MakeLoops.ixx>
|
||||
#include <BRepAlgo_Loop.hxx>
|
||||
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <BRep_TVertex.hxx>
|
||||
|
||||
#ifdef DRAW
|
||||
#include <DBRep.hxx>
|
||||
#endif
|
||||
#ifdef DEB
|
||||
Standard_Integer NbF = 1;
|
||||
static Standard_Boolean Affich = Standard_False;
|
||||
//POP pour NT
|
||||
//char name[100];
|
||||
#endif
|
||||
|
||||
|
||||
BRepOffset_MakeLoops::BRepOffset_MakeLoops()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
BRepAlgo_Image& Image)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape it(LF);
|
||||
TopTools_ListIteratorOfListOfShape itl,itLCE;
|
||||
BRepAlgo_Loop Loops;
|
||||
Loops.VerticesForSubstitute( myVerVerMap );
|
||||
|
||||
for (; it.More(); it.Next()) {
|
||||
const TopoDS_Face& F = TopoDS::Face(it.Value());
|
||||
//---------------------------
|
||||
// Initialisation de Loops.
|
||||
//---------------------------
|
||||
Loops.Init(F);
|
||||
//-----------------------------
|
||||
// recuperation des edges de F.
|
||||
//-----------------------------
|
||||
const TopTools_ListOfShape& LE = AsDes->Descendant(F);
|
||||
TopTools_ListOfShape AddedEdges;
|
||||
|
||||
for (itl.Initialize(LE); itl.More(); itl.Next()) {
|
||||
TopoDS_Edge E = TopoDS::Edge(itl.Value());
|
||||
if (Image.HasImage(E)) {
|
||||
//-------------------------------------------
|
||||
// E a deja ete decoupeee dans une autre face.
|
||||
// Recuperation des edges decoupees et reorientation
|
||||
// de ces edges comme E.
|
||||
// Voir pb pour les edges qui ont disparu?
|
||||
//-------------------------------------------
|
||||
const TopTools_ListOfShape& LCE = Image.Image(E);
|
||||
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next()) {
|
||||
TopoDS_Shape CE = itLCE.Value().Oriented(E.Orientation());
|
||||
Loops.AddConstEdge(TopoDS::Edge(CE));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Loops .AddEdge(E, AsDes->Descendant(E));
|
||||
AddedEdges.Append (E);
|
||||
}
|
||||
}
|
||||
//------------------------
|
||||
// Debouclage.
|
||||
//------------------------
|
||||
Loops.Perform();
|
||||
Loops.WiresToFaces();
|
||||
//------------------------
|
||||
// MAJ SD.
|
||||
//------------------------
|
||||
const TopTools_ListOfShape& NF = Loops.NewFaces();
|
||||
//-----------------------
|
||||
// F => Nouvelles faces;
|
||||
//-----------------------
|
||||
Image.Bind(F,NF);
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itAdded;
|
||||
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(itAdded.Value());
|
||||
//-----------------------
|
||||
// E => Nouvelles edges;
|
||||
//-----------------------
|
||||
const TopTools_ListOfShape& LoopNE = Loops.NewEdges(E);
|
||||
if (Image.HasImage(E)) {
|
||||
Image.Add(E,LoopNE);
|
||||
}
|
||||
else {
|
||||
Image.Bind(E,LoopNE);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loops.GetVerticesForSubstitute( myVerVerMap );
|
||||
if (myVerVerMap.IsEmpty())
|
||||
return;
|
||||
BRep_Builder BB;
|
||||
for (it.Initialize( LF ); it.More(); it.Next())
|
||||
{
|
||||
TopoDS_Shape F = it.Value();
|
||||
TopTools_ListOfShape LIF;
|
||||
Image.LastImage( F, LIF );
|
||||
for (itl.Initialize(LIF); itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Shape& IF = itl.Value();
|
||||
TopExp_Explorer EdExp( IF, TopAbs_EDGE );
|
||||
for (; EdExp.More(); EdExp.Next())
|
||||
{
|
||||
TopoDS_Shape E = EdExp.Current();
|
||||
TopTools_ListOfShape VList;
|
||||
TopoDS_Iterator VerExp( E );
|
||||
for (; VerExp.More(); VerExp.Next())
|
||||
VList.Append( VerExp.Value() );
|
||||
TopTools_ListIteratorOfListOfShape itlv( VList );
|
||||
for (; itlv.More(); itlv.Next())
|
||||
{
|
||||
const TopoDS_Shape& V = itlv.Value();
|
||||
if (myVerVerMap.IsBound( V ))
|
||||
{
|
||||
TopoDS_Shape NewV = myVerVerMap( V );
|
||||
E.Free( Standard_True );
|
||||
NewV.Orientation( V.Orientation() );
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
|
||||
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
|
||||
if (TV->Tolerance() > NewTV->Tolerance())
|
||||
NewTV->Tolerance( TV->Tolerance() );
|
||||
NewTV->ChangePoints().Append( TV->ChangePoints() );
|
||||
AsDes->Replace( V, NewV );
|
||||
BB.Remove( E, V );
|
||||
BB.Add( E, NewV );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsBetweenCorks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean IsBetweenCorks(const TopoDS_Shape& E,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const TopTools_ListOfShape& LContext)
|
||||
{
|
||||
if (!AsDes->HasAscendant(E)) return 1;
|
||||
const TopTools_ListOfShape& LF = AsDes->Ascendant(E);
|
||||
TopTools_ListIteratorOfListOfShape it;
|
||||
for (it.Initialize(LF); it.More(); it.Next()) {
|
||||
const TopoDS_Shape& S = it.Value();
|
||||
Standard_Boolean found = 0;
|
||||
TopTools_ListIteratorOfListOfShape it2;
|
||||
for (it2.Initialize(LContext); it2.More(); it2.Next()) {
|
||||
if(S.IsSame(it2.Value())) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuildOnContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext,
|
||||
const BRepOffset_Analyse& Analyse,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
BRepAlgo_Image& Image,
|
||||
const Standard_Boolean InSide)
|
||||
{
|
||||
//-----------------------------------------
|
||||
// debouclage des bouchons.
|
||||
//-----------------------------------------
|
||||
TopTools_ListIteratorOfListOfShape it(LContext);
|
||||
TopTools_ListIteratorOfListOfShape itl,itLCE;
|
||||
BRepAlgo_Loop Loops;
|
||||
Loops.VerticesForSubstitute( myVerVerMap );
|
||||
TopExp_Explorer exp;
|
||||
TopTools_MapOfShape MapExtent;
|
||||
|
||||
for (; it.More(); it.Next()) {
|
||||
const TopoDS_Face& F = TopoDS::Face(it.Value());
|
||||
TopTools_MapOfShape MBound;
|
||||
//-----------------------------------------------
|
||||
// Initialisation de Loops.
|
||||
// F est reversed elle sera ajoute dans myOffC.
|
||||
// et myOffC sera reversed dans le resultat final.
|
||||
//-----------------------------------------------
|
||||
TopoDS_Shape aLocalShape = F.Reversed();
|
||||
if (InSide) Loops.Init(TopoDS::Face(aLocalShape));
|
||||
// if (InSide) Loops.Init(TopoDS::Face(F.Reversed()));
|
||||
else Loops.Init(F);
|
||||
//--------------------------------------------------------
|
||||
// recuperation des edges de F non modifie par definition.
|
||||
//--------------------------------------------------------
|
||||
for (exp.Init(F.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
|
||||
exp.More();
|
||||
exp.Next()) {
|
||||
TopoDS_Edge CE = TopoDS::Edge(exp.Current());
|
||||
MBound.Add(CE);
|
||||
if (Analyse.HasAncestor(CE)) {
|
||||
// les arretes des bouchons sauf les arretes de conexite entre bouchons.
|
||||
// if (!AsDes->HasAscendant(CE)) {
|
||||
aLocalShape = CE.Reversed();
|
||||
if (InSide) Loops.AddConstEdge(CE);
|
||||
else Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
|
||||
// else Loops.AddConstEdge(TopoDS::Edge(CE.Reversed()));
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------
|
||||
// Trace des offsets + edge de connexite entre bouchons.
|
||||
//------------------------------------------------------
|
||||
const TopTools_ListOfShape& LE = AsDes->Descendant(F);
|
||||
TopTools_ListOfShape AddedEdges;
|
||||
|
||||
for (itl.Initialize(LE); itl.More(); itl.Next()) {
|
||||
TopoDS_Edge E = TopoDS::Edge(itl.Value());
|
||||
if (Image.HasImage(E)) {
|
||||
//-------------------------------------------
|
||||
// E a deja ete decoupeee dans une autre face.
|
||||
// Recuperation des edges decoupees et reorientation
|
||||
// de ces edges comme E.
|
||||
// Voir pb pour les edges qui ont disparu?
|
||||
//-------------------------------------------
|
||||
const TopTools_ListOfShape& LCE = Image.Image(E);
|
||||
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next()) {
|
||||
TopoDS_Shape CE = itLCE.Value().Oriented(E.Orientation());
|
||||
if (MapExtent.Contains(E)) {
|
||||
Loops.AddConstEdge(TopoDS::Edge(CE));
|
||||
continue;
|
||||
}
|
||||
if (!MBound.Contains(E)) CE.Reverse();
|
||||
if (InSide) Loops.AddConstEdge(TopoDS::Edge(CE));
|
||||
else
|
||||
{
|
||||
TopoDS_Shape aLocalShape = CE.Reversed();
|
||||
Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
|
||||
}
|
||||
// else Loops.AddConstEdge(TopoDS::Edge(CE.Reversed()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (IsBetweenCorks(E,AsDes,LContext) && AsDes->HasDescendant(E)) {
|
||||
//conexite entre 2 bouchons
|
||||
MapExtent.Add(E);
|
||||
TopTools_ListOfShape LV;
|
||||
if (InSide) {
|
||||
for (itLCE.Initialize(AsDes->Descendant(E)); itLCE.More(); itLCE.Next()) {
|
||||
LV.Append(itLCE.Value().Reversed());
|
||||
}
|
||||
Loops.AddEdge(E,LV);
|
||||
}
|
||||
else {
|
||||
Loops.AddEdge(E,AsDes->Descendant(E));
|
||||
}
|
||||
AddedEdges.Append (E);
|
||||
}
|
||||
else if (IsBetweenCorks(E,AsDes,LContext)) {
|
||||
TopoDS_Shape aLocalShape = E.Reversed();
|
||||
if (InSide) Loops.AddConstEdge(E);
|
||||
else Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
|
||||
// if (InSide) Loops.AddConstEdge(TopoDS::Edge(E));
|
||||
// else Loops.AddConstEdge(TopoDS::Edge(E.Reversed()));
|
||||
}
|
||||
else {
|
||||
TopoDS_Shape aLocalShape = E.Reversed();
|
||||
if (InSide) Loops.AddConstEdge(TopoDS::Edge(aLocalShape));
|
||||
else Loops.AddConstEdge(E);
|
||||
// if (InSide) Loops.AddConstEdge(TopoDS::Edge(E.Reversed()));
|
||||
// else Loops.AddConstEdge(TopoDS::Edge(E));
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------
|
||||
// Debouclage.
|
||||
//------------------------
|
||||
Loops.Perform();
|
||||
Loops.WiresToFaces();
|
||||
//------------------------
|
||||
// MAJ SD.
|
||||
//------------------------
|
||||
const TopTools_ListOfShape& NF = Loops.NewFaces();
|
||||
//-----------------------
|
||||
// F => Nouvelles faces;
|
||||
//-----------------------
|
||||
Image.Bind(F,NF);
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itAdded;
|
||||
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(itAdded.Value());
|
||||
//-----------------------
|
||||
// E => Nouvelles edges;
|
||||
//-----------------------
|
||||
if (Image.HasImage(E)) {
|
||||
Image.Add(E,Loops.NewEdges(E));
|
||||
}
|
||||
else {
|
||||
Image.Bind(E,Loops.NewEdges(E));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loops.GetVerticesForSubstitute( myVerVerMap );
|
||||
if (myVerVerMap.IsEmpty())
|
||||
return;
|
||||
BRep_Builder BB;
|
||||
for (it.Initialize( LContext ); it.More(); it.Next())
|
||||
{
|
||||
TopoDS_Shape F = it.Value();
|
||||
TopTools_ListOfShape LIF;
|
||||
Image.LastImage( F, LIF );
|
||||
for (itl.Initialize(LIF); itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Shape& IF = itl.Value();
|
||||
TopExp_Explorer EdExp( IF, TopAbs_EDGE );
|
||||
for (; EdExp.More(); EdExp.Next())
|
||||
{
|
||||
TopoDS_Shape E = EdExp.Current();
|
||||
TopTools_ListOfShape VList;
|
||||
TopoDS_Iterator VerExp( E );
|
||||
for (; VerExp.More(); VerExp.Next())
|
||||
VList.Append( VerExp.Value() );
|
||||
TopTools_ListIteratorOfListOfShape itlv( VList );
|
||||
for (; itlv.More(); itlv.Next())
|
||||
{
|
||||
const TopoDS_Shape& V = itlv.Value();
|
||||
if (myVerVerMap.IsBound( V ))
|
||||
{
|
||||
TopoDS_Shape NewV = myVerVerMap( V );
|
||||
E.Free( Standard_True );
|
||||
NewV.Orientation( V.Orientation() );
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
|
||||
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
|
||||
if (TV->Tolerance() > NewTV->Tolerance())
|
||||
NewTV->Tolerance( TV->Tolerance() );
|
||||
NewTV->ChangePoints().Append( TV->ChangePoints() );
|
||||
AsDes->Replace( V, NewV );
|
||||
BB.Remove( E, V );
|
||||
BB.Add( E, NewV );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BuildFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
BRepAlgo_Image& Image)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape itr,itl,itLCE;
|
||||
Standard_Boolean ToRebuild;
|
||||
BRepAlgo_Loop Loops;
|
||||
Loops.VerticesForSubstitute( myVerVerMap );
|
||||
BRep_Builder B;
|
||||
|
||||
//----------------------------------
|
||||
// Boucle sur toutes les faces //.
|
||||
//----------------------------------
|
||||
for (itr.Initialize(LF); itr.More(); itr.Next()) {
|
||||
TopoDS_Face F = TopoDS::Face(itr.Value());
|
||||
Loops.Init(F);
|
||||
ToRebuild = Standard_False;
|
||||
TopTools_ListOfShape AddedEdges;
|
||||
|
||||
if (!Image.HasImage(F)) {
|
||||
//----------------------------------
|
||||
// Face F non deja reconstruite.
|
||||
//----------------------------------
|
||||
const TopTools_ListOfShape& LE = AsDes->Descendant(F);
|
||||
//----------------------------------------------------------------
|
||||
// premiere boucle pour determiner si des edges de la face ont ete
|
||||
// reconstruite.
|
||||
// - maj de la map MONV. certains vertex sur les edges reconstruites
|
||||
// coincide geometriquement avec les anciens mais ne sont pas IsSame.
|
||||
//----------------------------------------------------------------
|
||||
TopTools_DataMapOfShapeShape MONV;
|
||||
TopoDS_Vertex OV1,OV2,NV1,NV2;
|
||||
|
||||
for (itl.Initialize(LE); itl.More(); itl.Next()) {
|
||||
TopoDS_Edge E = TopoDS::Edge(itl.Value());
|
||||
if (Image.HasImage(E)) {
|
||||
const TopTools_ListOfShape& LCE = Image.Image(E);
|
||||
if (LCE.Extent() == 1 && LCE.First().IsSame(E)) {
|
||||
TopoDS_Shape aLocalShape = LCE.First().Oriented(E.Orientation());
|
||||
TopoDS_Edge CE = TopoDS::Edge(aLocalShape);
|
||||
// TopoDS_Edge CE = TopoDS::Edge(LCE.First().Oriented(E.Orientation()));
|
||||
Loops.AddConstEdge(CE);
|
||||
continue;
|
||||
}
|
||||
//----------------------------------
|
||||
// F doit etre reconstruite.
|
||||
//----------------------------------
|
||||
ToRebuild = Standard_True;
|
||||
for (itLCE.Initialize(LCE); itLCE.More(); itLCE.Next()) {
|
||||
TopoDS_Shape aLocalShape = itLCE.Value().Oriented(E.Orientation());
|
||||
TopoDS_Edge CE = TopoDS::Edge(aLocalShape);
|
||||
// TopoDS_Edge CE = TopoDS::Edge(itLCE.Value().Oriented(E.Orientation()));
|
||||
TopExp::Vertices (E ,OV1,OV2);
|
||||
TopExp::Vertices (CE,NV1,NV2);
|
||||
if (!OV1.IsSame(NV1)) MONV.Bind(OV1,NV1);
|
||||
if (!OV2.IsSame(NV2)) MONV.Bind(OV2,NV2);
|
||||
Loops.AddConstEdge(CE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ToRebuild) {
|
||||
#ifdef DRAW
|
||||
//POP pour NT
|
||||
if ( Affich) {
|
||||
char* name = new char[100];
|
||||
sprintf(name,"CF_%d",NbF++);
|
||||
DBRep::Set(name,F);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// les edges non reconstruites dans d autre faces sont
|
||||
// ajoutees .si leurs vertex ont ete reconstruits elles
|
||||
// seront reconstruites.
|
||||
//-----------------------------------------------------------
|
||||
for (itl.Initialize(LE); itl.More(); itl.Next()) {
|
||||
Standard_Real f,l;
|
||||
TopoDS_Edge E = TopoDS::Edge(itl.Value());
|
||||
BRep_Tool::Range(E,f,l);
|
||||
if (!Image.HasImage(E)) {
|
||||
TopExp::Vertices (E,OV1,OV2);
|
||||
TopTools_ListOfShape LV;
|
||||
if (MONV.IsBound(OV1)) {
|
||||
TopoDS_Vertex VV = TopoDS::Vertex(MONV(OV1));
|
||||
VV.Orientation(TopAbs_FORWARD);
|
||||
LV.Append(VV);
|
||||
TopoDS_Shape aLocalShape = VV.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),
|
||||
f,E,BRep_Tool::Tolerance(VV));
|
||||
}
|
||||
if (MONV.IsBound(OV2)) {
|
||||
TopoDS_Vertex VV = TopoDS::Vertex(MONV(OV2));
|
||||
VV.Orientation(TopAbs_REVERSED);
|
||||
LV.Append(VV);
|
||||
TopoDS_Shape aLocalShape = VV.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),
|
||||
l,E,BRep_Tool::Tolerance(VV));
|
||||
// B.UpdateVertex(TopoDS::Vertex(VV.Oriented(TopAbs_INTERNAL)),
|
||||
// l,E,BRep_Tool::Tolerance(VV));
|
||||
}
|
||||
if (LV.IsEmpty()) Loops.AddConstEdge(E);
|
||||
else {
|
||||
Loops.AddEdge (E,LV);
|
||||
AddedEdges.Append(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ToRebuild) {
|
||||
//------------------------
|
||||
// Reconstruction.
|
||||
//------------------------
|
||||
Loops.Perform();
|
||||
Loops.WiresToFaces();
|
||||
//------------------------
|
||||
// MAJ SD.
|
||||
//------------------------
|
||||
const TopTools_ListOfShape& NF = Loops.NewFaces();
|
||||
//-----------------------
|
||||
// F => Nouvelles faces;
|
||||
//-----------------------
|
||||
Image.Bind(F,NF);
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itAdded;
|
||||
for (itAdded.Initialize(AddedEdges); itAdded.More(); itAdded.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(itAdded.Value());
|
||||
//-----------------------
|
||||
// E => Nouvelles edges;
|
||||
//-----------------------
|
||||
if (Image.HasImage(E)) {
|
||||
Image.Add(E,Loops.NewEdges(E));
|
||||
}
|
||||
else {
|
||||
Image.Bind(E,Loops.NewEdges(E));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loops.GetVerticesForSubstitute( myVerVerMap );
|
||||
if (myVerVerMap.IsEmpty())
|
||||
return;
|
||||
BRep_Builder BB;
|
||||
for (itr.Initialize( LF ); itr.More(); itr.Next())
|
||||
{
|
||||
TopoDS_Shape F = itr.Value();
|
||||
TopTools_ListOfShape LIF;
|
||||
Image.LastImage( F, LIF );
|
||||
for (itl.Initialize(LIF); itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Shape& IF = itl.Value();
|
||||
TopExp_Explorer EdExp( IF, TopAbs_EDGE );
|
||||
for (; EdExp.More(); EdExp.Next())
|
||||
{
|
||||
TopoDS_Shape E = EdExp.Current();
|
||||
TopTools_ListOfShape VList;
|
||||
TopoDS_Iterator VerExp( E );
|
||||
for (; VerExp.More(); VerExp.Next())
|
||||
VList.Append( VerExp.Value() );
|
||||
TopTools_ListIteratorOfListOfShape itlv( VList );
|
||||
for (; itlv.More(); itlv.Next())
|
||||
{
|
||||
const TopoDS_Shape& V = itlv.Value();
|
||||
if (myVerVerMap.IsBound( V ))
|
||||
{
|
||||
TopoDS_Shape NewV = myVerVerMap( V );
|
||||
E.Free( Standard_True );
|
||||
NewV.Orientation( V.Orientation() );
|
||||
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
|
||||
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
|
||||
if (TV->Tolerance() > NewTV->Tolerance())
|
||||
NewTV->Tolerance( TV->Tolerance() );
|
||||
NewTV->ChangePoints().Append( TV->ChangePoints() );
|
||||
AsDes->Replace( V, NewV );
|
||||
BB.Remove( E, V );
|
||||
BB.Add( E, NewV );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
218
src/BRepOffset/BRepOffset_MakeOffset.cdl
Executable file
218
src/BRepOffset/BRepOffset_MakeOffset.cdl
Executable file
@@ -0,0 +1,218 @@
|
||||
-- File: BRepOffset_MakeOffset.cdl
|
||||
-- Created: Thu Oct 26 18:06:41 1995
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@stylox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
-- Modified by skv - Tue Mar 15 16:17:37 2005
|
||||
-- Add methods for supporting history.
|
||||
|
||||
class MakeOffset from BRepOffset
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Image from BRepAlgo,
|
||||
AsDes from BRepAlgo,
|
||||
Analyse from BRepOffset,
|
||||
Mode from BRepOffset,
|
||||
DataMapOfShapeOffset from BRepOffset,
|
||||
Error from BRepOffset,
|
||||
Inter3d from BRepOffset,
|
||||
DataMapOfShapeReal from TopTools,
|
||||
Shape from TopoDS,
|
||||
JoinType from GeomAbs,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
MapOfShape from TopTools,
|
||||
ListOfShape from TopTools,
|
||||
MakeLoops from BRepOffset
|
||||
|
||||
is
|
||||
|
||||
Create;
|
||||
|
||||
Create ( S : Shape from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
Tol : Real from Standard;
|
||||
Mode : Mode from BRepOffset = BRepOffset_Skin;
|
||||
Intersection : Boolean from Standard = Standard_False;
|
||||
SelfInter : Boolean from Standard = Standard_False;
|
||||
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||
Thickening : Boolean from Standard = Standard_False)
|
||||
returns MakeOffset from BRepOffset;
|
||||
|
||||
---Category: Initialization.
|
||||
|
||||
Initialize (me : in out;
|
||||
S : Shape from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
Tol : Real from Standard;
|
||||
Mode : Mode from BRepOffset = BRepOffset_Skin;
|
||||
Intersection : Boolean from Standard = Standard_False;
|
||||
SelfInter : Boolean from Standard = Standard_False;
|
||||
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||
Thickening : Boolean from Standard = Standard_False)
|
||||
is static;
|
||||
|
||||
Clear (me : in out)
|
||||
is static;
|
||||
|
||||
AddFace (me : in out; F : Face from TopoDS) is static;
|
||||
---Purpose: Add Closing Faces, <F> has to be in the initial
|
||||
-- shape S.
|
||||
|
||||
SetOffsetOnFace (me : in out;
|
||||
F : Face from TopoDS;
|
||||
Off : Real from Standard) is static;
|
||||
---Purpose: set the offset <Off> on the Face <F>
|
||||
|
||||
|
||||
---Category: Computation.
|
||||
|
||||
MakeOffsetShape (me : in out) is static;
|
||||
|
||||
MakeThickSolid (me : in out) is static;
|
||||
|
||||
---Category: Querying.
|
||||
|
||||
GetAnalyse(me)
|
||||
---C++: return const &
|
||||
returns Analyse from BRepOffset
|
||||
is static;
|
||||
|
||||
IsDone (me) returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
Shape (me)
|
||||
---C++: return const &
|
||||
returns Shape from TopoDS
|
||||
is static;
|
||||
|
||||
Error (me) returns Error from BRepOffset;
|
||||
---Purpose: returns information if IsDone() = FALSE.
|
||||
|
||||
|
||||
OffsetFacesFromShapes (me)
|
||||
---Purpose: Returns <Image> containing links between initials
|
||||
-- shapes and offset faces.
|
||||
---C++: return const &
|
||||
returns Image from BRepAlgo
|
||||
is static;
|
||||
|
||||
-- Modified by skv - Tue Mar 15 16:17:37 2005 Begin
|
||||
-- Query offset join type.
|
||||
|
||||
GetJoinType(me)
|
||||
---Purpose: Returns myJoin.
|
||||
returns JoinType from GeomAbs
|
||||
is static;
|
||||
|
||||
-- Add methods for supporting history.
|
||||
|
||||
OffsetEdgesFromShapes (me)
|
||||
---Purpose: Returns <Image> containing links between initials
|
||||
-- shapes and offset edges.
|
||||
---C++: return const &
|
||||
returns Image from BRepAlgo
|
||||
is static;
|
||||
|
||||
-- Modified by skv - Tue Mar 15 16:17:37 2005 End
|
||||
|
||||
ClosingFaces (me)
|
||||
---Purpose: Returns the list of closing faces stores by AddFace
|
||||
---C++: return const &
|
||||
returns MapOfShape from TopTools
|
||||
is static;
|
||||
|
||||
---Category: private methods
|
||||
|
||||
BuildOffsetByArc ( me : in out )
|
||||
is static private;
|
||||
|
||||
BuildOffsetByInter ( me : in out )
|
||||
is static private;
|
||||
|
||||
SelfInter (me : in out ;
|
||||
Modif : in out MapOfShape from TopTools)
|
||||
is static private;
|
||||
|
||||
Intersection3D (me : in out;
|
||||
Inter : in out Inter3d from BRepOffset)
|
||||
is static private;
|
||||
|
||||
Intersection2D ( me : in out ;
|
||||
Modif : MapOfShape from TopTools;
|
||||
NewEdges : MapOfShape from TopTools)
|
||||
is static private;
|
||||
|
||||
MakeLoops ( me : in out ;
|
||||
Modif : in out MapOfShape from TopTools)
|
||||
is static private;
|
||||
|
||||
MakeLoopsOnContext ( me : in out ;
|
||||
Modif : in out MapOfShape from TopTools)
|
||||
is static private;
|
||||
|
||||
MakeFaces ( me : in out ;
|
||||
Modif : in out MapOfShape from TopTools)
|
||||
is static private;
|
||||
|
||||
MakeShells (me : in out )
|
||||
is static private;
|
||||
|
||||
SelectShells (me : in out)
|
||||
is static private;
|
||||
|
||||
EncodeRegularity( me : in out)
|
||||
is static private;
|
||||
|
||||
MakeSolid (me : in out)
|
||||
is static private;
|
||||
|
||||
ToContext (me : in out;
|
||||
MapSF : in out DataMapOfShapeOffset from BRepOffset)
|
||||
is static private;
|
||||
|
||||
UpdateFaceOffset (me: in out)
|
||||
---Purpose: Private method use to update the map face<->offset
|
||||
is static private;
|
||||
|
||||
CorrectConicalFaces (me: in out)
|
||||
---Purpose: Private method used to correct degenerated edges on conical faces
|
||||
is static private;
|
||||
|
||||
MakeMissingWalls (me: in out)
|
||||
---Purpose: Private method used to build walls for thickening the shell
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
myOffset : Real from Standard;
|
||||
myTol : Real from Standard;
|
||||
myShape : Shape from TopoDS; -- Initial
|
||||
myMode : Mode from BRepOffset;
|
||||
myInter : Boolean from Standard;
|
||||
mySelfInter : Boolean from Standard;
|
||||
myJoin : JoinType from GeomAbs;
|
||||
myThickening : Boolean from Standard;
|
||||
|
||||
myFaceOffset : DataMapOfShapeReal from TopTools;
|
||||
|
||||
myFaces : MapOfShape from TopTools;
|
||||
myAnalyse : Analyse from BRepOffset;
|
||||
|
||||
myOffsetShape : Shape from TopoDS; -- Result
|
||||
myInitOffsetFace : Image from BRepAlgo;
|
||||
myInitOffsetEdge : Image from BRepAlgo;
|
||||
myImageOffset : Image from BRepAlgo;
|
||||
myWalls : ListOfShape from TopTools;
|
||||
myAsDes : AsDes from BRepAlgo;
|
||||
|
||||
myDone : Boolean from Standard;
|
||||
myError : Error from BRepOffset;
|
||||
|
||||
myMakeLoops : MakeLoops from BRepOffset;
|
||||
|
||||
end MakeOffset;
|
3446
src/BRepOffset/BRepOffset_MakeOffset.cxx
Executable file
3446
src/BRepOffset/BRepOffset_MakeOffset.cxx
Executable file
File diff suppressed because it is too large
Load Diff
170
src/BRepOffset/BRepOffset_Offset.cdl
Executable file
170
src/BRepOffset/BRepOffset_Offset.cdl
Executable file
@@ -0,0 +1,170 @@
|
||||
-- File: BRepOffset_Offset.cdl
|
||||
-- Created: Thu Oct 19 14:54:41 1995
|
||||
-- Author: Bruno DUMORTIER
|
||||
-- <dub@fuegox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class Offset from BRepOffset
|
||||
|
||||
---Purpose: class for the creation of Offseting.
|
||||
|
||||
uses
|
||||
|
||||
Status from BRepOffset,
|
||||
Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
Vertex from TopoDS,
|
||||
ListOfShape from TopTools,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
Shape from GeomAbs,
|
||||
JoinType from GeomAbs
|
||||
|
||||
is
|
||||
|
||||
Create returns Offset from BRepOffset;
|
||||
|
||||
Create( Face : Face from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
OffsetOutside : Boolean from Standard = Standard_True;
|
||||
JoinType : JoinType from GeomAbs = GeomAbs_Arc)
|
||||
---Purpose:
|
||||
returns Offset from BRepOffset;
|
||||
|
||||
Create( Face : Face from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
Created : DataMapOfShapeShape from TopTools;
|
||||
OffsetOutside : Boolean from Standard = Standard_True;
|
||||
JoinType : JoinType from GeomAbs = GeomAbs_Arc)
|
||||
---Purpose: This method will be called when you want to share
|
||||
-- the edges soon generated from an other face.
|
||||
-- e.g. when two faces are tangents the common edge
|
||||
-- will generate only one edge ( no pipe).
|
||||
--
|
||||
-- The Map will be fill as follow:
|
||||
--
|
||||
-- Created(E) = E'
|
||||
-- with: E = an edge of <Face>
|
||||
-- E' = the image of E in the offseting of
|
||||
-- another face sharing E with a
|
||||
-- continuity at least G1
|
||||
--
|
||||
returns Offset from BRepOffset;
|
||||
|
||||
Create( Path : Edge from TopoDS;
|
||||
Edge1 : Edge from TopoDS;
|
||||
Edge2 : Edge from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
Polynomial: Boolean from Standard = Standard_False;
|
||||
Tol : Real from Standard = 1.0e-4;
|
||||
Conti : Shape from GeomAbs = GeomAbs_C1)
|
||||
---Purpose:
|
||||
returns Offset from BRepOffset;
|
||||
|
||||
Create( Path : Edge from TopoDS;
|
||||
Edge1 : Edge from TopoDS;
|
||||
Edge2 : Edge from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
FirstEdge : Edge from TopoDS;
|
||||
LastEdge : Edge from TopoDS;
|
||||
Polynomial: Boolean from Standard = Standard_False;
|
||||
Tol : Real from Standard = 1.0e-4;
|
||||
Conti : Shape from GeomAbs = GeomAbs_C1)
|
||||
---Purpose:
|
||||
returns Offset from BRepOffset;
|
||||
|
||||
Create( Vertex : Vertex from TopoDS;
|
||||
LEdge : ListOfShape from TopTools;
|
||||
Offset : Real from Standard;
|
||||
Polynomial: Boolean from Standard = Standard_False;
|
||||
Tol : Real from Standard = 1.0e-4;
|
||||
Conti : Shape from GeomAbs = GeomAbs_C1)
|
||||
---Purpose: Tol and Conti are only used if Polynomial is True
|
||||
-- (Used to perfrom the approximation)
|
||||
returns Offset from BRepOffset;
|
||||
|
||||
Init( me : in out;
|
||||
Face : Face from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
OffsetOutside : Boolean from Standard = Standard_True;
|
||||
JoinType : JoinType from GeomAbs = GeomAbs_Arc)
|
||||
---Purpose:
|
||||
is static;
|
||||
|
||||
Init( me : in out;
|
||||
Face : Face from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
Created : DataMapOfShapeShape from TopTools;
|
||||
OffsetOutside : Boolean from Standard = Standard_True;
|
||||
JoinType : JoinType from GeomAbs = GeomAbs_Arc)
|
||||
---Purpose:
|
||||
is static;
|
||||
|
||||
Init( me : in out;
|
||||
Path : Edge from TopoDS;
|
||||
Edge1 : Edge from TopoDS;
|
||||
Edge2 : Edge from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
Polynomial: Boolean from Standard = Standard_False;
|
||||
Tol : Real from Standard = 1.0e-4;
|
||||
Conti : Shape from GeomAbs = GeomAbs_C1)
|
||||
---Purpose:
|
||||
is static;
|
||||
|
||||
Init( me : in out;
|
||||
Path : Edge from TopoDS;
|
||||
Edge1 : Edge from TopoDS;
|
||||
Edge2 : Edge from TopoDS;
|
||||
Offset : Real from Standard;
|
||||
FirstEdge : Edge from TopoDS;
|
||||
LastEdge : Edge from TopoDS;
|
||||
Polynomial: Boolean from Standard = Standard_False;
|
||||
Tol : Real from Standard = 1.0e-4;
|
||||
Conti : Shape from GeomAbs = GeomAbs_C1)
|
||||
---Purpose:
|
||||
is static;
|
||||
|
||||
Init( me: in out;
|
||||
Vertex : Vertex from TopoDS;
|
||||
LEdge : ListOfShape from TopTools;
|
||||
Offset : Real from Standard;
|
||||
Polynomial: Boolean from Standard = Standard_False;
|
||||
Tol : Real from Standard = 1.0e-4;
|
||||
Conti : Shape from GeomAbs = GeomAbs_C1)
|
||||
---Purpose: Tol and Conti are only used if Polynomial is True
|
||||
-- (Used to perfrom the approximation)
|
||||
is static;
|
||||
|
||||
Init( me : in out;
|
||||
Edge : Edge from TopoDS;
|
||||
Offset : Real from Standard)
|
||||
---Purpose: Only used in Rolling Ball. Pipe on Free Boundary
|
||||
is static;
|
||||
|
||||
InitialShape(me)
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns Shape from TopoDS;
|
||||
|
||||
|
||||
Face( me)
|
||||
---C++: return const &
|
||||
returns Face from TopoDS;
|
||||
|
||||
Generated(me; Shape : Shape from TopoDS)
|
||||
---Purpose:
|
||||
returns Shape from TopoDS;
|
||||
|
||||
Status( me)
|
||||
---Purpose:
|
||||
returns Status from BRepOffset;
|
||||
|
||||
fields
|
||||
|
||||
myShape : Shape from TopoDS;
|
||||
myStatus : Status from BRepOffset;
|
||||
myFace : Face from TopoDS;
|
||||
myMap : DataMapOfShapeShape from TopTools;
|
||||
|
||||
end Offset;
|
1543
src/BRepOffset/BRepOffset_Offset.cxx
Executable file
1543
src/BRepOffset/BRepOffset_Offset.cxx
Executable file
File diff suppressed because it is too large
Load Diff
9
src/BRepOffset/BRepOffset_Offset.lxx
Executable file
9
src/BRepOffset/BRepOffset_Offset.lxx
Executable file
@@ -0,0 +1,9 @@
|
||||
// File: BRepOffset_Offset.lxx
|
||||
// Created: Mon Feb 9 10:24:49 1998
|
||||
// Author: Bruno DUMORTIER
|
||||
// <dub@brunox.paris1.matra-dtv.fr>
|
||||
|
||||
inline const TopoDS_Shape& BRepOffset_Offset::InitialShape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
170
src/BRepOffset/BRepOffset_Tool.cdl
Executable file
170
src/BRepOffset/BRepOffset_Tool.cdl
Executable file
@@ -0,0 +1,170 @@
|
||||
-- File: BRepOffset_Tool.cdl
|
||||
-- Created: Mon Oct 23 14:15:53 1995
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@stylox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class Tool from BRepOffset
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS,
|
||||
Wire from TopoDS,
|
||||
Shape from TopoDS,
|
||||
Orientation from TopAbs,
|
||||
MapOfShape from TopTools,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
DataMapOfShapeListOfShape from TopTools,
|
||||
ListOfShape from TopTools,
|
||||
Vertex from TopoDS,
|
||||
State from TopAbs,
|
||||
Image from BRepAlgo,
|
||||
AsDes from BRepAlgo,
|
||||
Analyse from BRepOffset,
|
||||
Curve from Geom
|
||||
|
||||
is
|
||||
EdgeVertices (myclass; E : Edge from TopoDS;
|
||||
V1 : in out Vertex from TopoDS;
|
||||
V2 : in out Vertex from TopoDS);
|
||||
---Purpose: <V1> is the FirstVertex ,<V2> is the Last Vertex of <Edge>
|
||||
-- taking account the orientation of Edge.
|
||||
|
||||
OriEdgeInFace (myclass; E : Edge from TopoDS;
|
||||
F : Face from TopoDS)
|
||||
---Purpose: returns the cumul of the orientation of <Edge>
|
||||
-- and thc containing wire in <Face>
|
||||
returns Orientation from TopAbs;
|
||||
|
||||
|
||||
|
||||
OrientSection (myclass; E : Edge from TopoDS;
|
||||
F1,F2 : Face from TopoDS;
|
||||
O1,O2 : in out Orientation from TopAbs);
|
||||
---Purpose: <E> is a section between <F1> and <F2>. Computes
|
||||
-- <O1> the orientation of <E> in <F1> influenced by <F2>.
|
||||
-- idem for <O2>.
|
||||
|
||||
HasCommonShapes (myclass; F1,F2 : Face from TopoDS;
|
||||
LE : in out ListOfShape from TopTools;
|
||||
LV : in out ListOfShape from TopTools)
|
||||
---Purpose: Returns True if <F1> and <F2> has common Vertices
|
||||
-- or edges , <LE> contains the common edges. <LV> the
|
||||
-- common vertices.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Inter3D (myclass; F1, F2 : Face from TopoDS;
|
||||
LInt1 : in out ListOfShape from TopTools;
|
||||
LInt2 : in out ListOfShape from TopTools;
|
||||
Side : State from TopAbs;
|
||||
RefEdge : Edge from TopoDS;
|
||||
IsRefEdgeDefined : Boolean from Standard = Standard_False);
|
||||
|
||||
---Purpose: Computes the Section betwwen <F1> and <F2> the
|
||||
-- edges solution are stored in <LInt1> with the
|
||||
-- orientation on <F1>, the sames edges are stored in
|
||||
-- <Lint2> with the orientation on <F2>.
|
||||
|
||||
TryProject (myclass; F1, F2 : Face from TopoDS;
|
||||
Edges : ListOfShape from TopTools;
|
||||
LInt1 : in out ListOfShape from TopTools;
|
||||
LInt2 : in out ListOfShape from TopTools;
|
||||
Side : State from TopAbs;
|
||||
TolConf: Real from Standard)
|
||||
|
||||
---Purpose: Find if the edges <Edges> of the face <F2> are on
|
||||
-- the face <F1>.
|
||||
-- Set in <LInt1> <LInt2> the updated edges.
|
||||
-- If all the edges are computed, returns true.
|
||||
--
|
||||
returns Boolean from Standard;
|
||||
|
||||
PipeInter (myclass; F1, F2 : Face from TopoDS;
|
||||
LInt1 : in out ListOfShape from TopTools;
|
||||
LInt2 : in out ListOfShape from TopTools;
|
||||
Side : State from TopAbs);
|
||||
|
||||
Inter2d (myclass; F : Face from TopoDS;
|
||||
E1,E2 : Edge from TopoDS;
|
||||
LV : in out ListOfShape from TopTools;
|
||||
Tol : Real from Standard);
|
||||
|
||||
InterOrExtent (myclass; F1, F2 : Face from TopoDS;
|
||||
LInt1 : in out ListOfShape from TopTools;
|
||||
LInt2 : in out ListOfShape from TopTools;
|
||||
Side : State from TopAbs);
|
||||
|
||||
CheckBounds(myclass; F : Face from TopoDS;
|
||||
Analyse : Analyse from BRepOffset;
|
||||
enlargeU, enlargeVfirst, enlargeVlast : out Boolean from Standard);
|
||||
|
||||
EnLargeFace(myclass; F : Face from TopoDS;
|
||||
NF : in out Face from TopoDS;
|
||||
ChangeGeom : Boolean from Standard;
|
||||
UpDatePCurve : Boolean from Standard = Standard_False;
|
||||
enlargeU : Boolean from Standard = Standard_True;
|
||||
enlargeVfirst : Boolean from Standard = Standard_True;
|
||||
enlargeVlast : Boolean from Standard = Standard_True)
|
||||
---Purpose: if <ChangeGeom> is TRUE , the surface can be
|
||||
-- changed .
|
||||
-- if <UpdatePCurve> is TRUE, update the pcurves of the
|
||||
-- edges of <F> on the new surface.if the surface has been changed,
|
||||
-- Returns True if The Surface of <NF> has changed.
|
||||
--
|
||||
returns Boolean from Standard;
|
||||
|
||||
ExtentFace (myclass;
|
||||
F : Face from TopoDS;
|
||||
ConstShapes : in out DataMapOfShapeShape from TopTools;
|
||||
ToBuild : in out DataMapOfShapeShape from TopTools;
|
||||
Side : State from TopAbs ;
|
||||
TolConf : Real from Standard;
|
||||
NF : in out Face from TopoDS);
|
||||
|
||||
|
||||
BuildNeighbour (myclass;
|
||||
W : Wire from TopoDS;
|
||||
F : Face from TopoDS;
|
||||
NOnV1 : in out DataMapOfShapeShape from TopTools;
|
||||
NOnV2 : in out DataMapOfShapeShape from TopTools);
|
||||
---Purpose: Via the wire explorer store in <NOnV1> for
|
||||
-- an Edge <E> of <W> his Edge neighbour on the first
|
||||
-- vertex <V1> of <E>.
|
||||
-- Store in NOnV2 the Neighbour of <E>on the last
|
||||
-- vertex <V2> of <E>.
|
||||
|
||||
MapVertexEdges (myclass;
|
||||
S : Shape from TopoDS;
|
||||
MVE : in out DataMapOfShapeListOfShape from TopTools);
|
||||
---Purpose: Store in MVE for a vertex <V> in <S> the incident
|
||||
-- edges <E> in <S>.
|
||||
-- An Edge is Store only one Time for a vertex.
|
||||
|
||||
|
||||
|
||||
Deboucle3D (myclass;
|
||||
S : in Shape from TopoDS;
|
||||
Boundary : in MapOfShape from TopTools)
|
||||
---Purpose: Remove the non valid part of an offsetshape
|
||||
-- 1 - Remove all the free boundary and the faces
|
||||
-- connex to such edges.
|
||||
-- 2 - Remove all the shapes not valid in the result
|
||||
-- (according to the side of offseting)
|
||||
-- in this verion only the first point is implemented.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
CorrectOrientation (myclass ;
|
||||
SI : in Shape from TopoDS;
|
||||
NewEdges : in MapOfShape from TopTools;
|
||||
AsDes : in out AsDes from BRepAlgo;
|
||||
InitOffset : in out Image from BRepAlgo;
|
||||
Offset : in Real from Standard);
|
||||
|
||||
Gabarit(myclass ;
|
||||
aCurve : Curve from Geom)
|
||||
returns Real from Standard;
|
||||
|
||||
end Tool;
|
4005
src/BRepOffset/BRepOffset_Tool.cxx
Executable file
4005
src/BRepOffset/BRepOffset_Tool.cxx
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user