1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

97
src/FilletSurf/FilletSurf.cdl Executable file
View File

@@ -0,0 +1,97 @@
-- File: FilletSurf.cdl
-- Created: Fri Jul 26 11:05:18 1996
-- Author: Maria PUMBORIOS
-- <mps@sgi30>
---Copyright: Matra Datavision 1996
package FilletSurf
---Purpose: This package contains the API giving
-- only geometric informations about fillets
-- for Toyota Project UV4.
uses
TopoDS,
TopTools,
ChFi3d,
ChFiDS,
BRepAdaptor,
Adaptor3d,
math,
Geom,
Geom2d,
gp,
StdFail,
TopAbs
is
----------------------------------------------------------
-- enumeration used to describe the status of start and end section
-- of the fillet
-- TwoExtremityOnEdge
-- OneExtremityOnEdge
-- NoExtremityOnEdge
----------------------------------------------------------
--
--
enumeration StatusType is TwoExtremityOnEdge, OneExtremityOnEdge,
NoExtremityOnEdge
end StatusType;
----------------------------------------------------------
-- enumeration used to describe the status of the computation of the fillet
-- IsOk
-- IsNotOk
-- IsPartial
--
----------------------------------------------------------
enumeration StatusDone is IsOk, IsNotOk,IsPartial
end StatusDone;
----------------------------------------------------------
-- enumeration used to describe the status error
-- EmptyList
-- EdgeNotG1
-- FacesNotG1
-- EdgeNotOnShape
-- NotSharpEdge
-- PbFilletCompute
----------------------------------------------------------
enumeration ErrorTypeStatus is EmptyList, EdgeNotG1,FacesNotG1,EdgeNotOnShape,
NotSharpEdge, PbFilletCompute
end ErrorTypeStatus ;
-- this class is the API giving geometric informations about fillets:
class Builder;
-- this class is private and is only used by the class Builder:
private class InternalBuilder;
end FilletSurf;

View File

@@ -0,0 +1,205 @@
-- File: FilletSurf_Builder.cdl
-- Created: Fri Jul 26 11:28:31 1996
-- Author: Maria PUMBORIOS
-- <mps@sgi30>
---Copyright: Matra Datavision 1996
class Builder from FilletSurf
---Purpose: API giving the following geometric information about fillets
-- list of corresponding NUBS surfaces
-- for each surface:
-- the 2 support faces
-- on each face: the 3d curve and the corresponding 2d curve
-- the 2d curves on the fillet
-- status of start and end section of the fillet
-- first and last parameter on edge of the fillet.
uses
Shape,Edge,Face from TopoDS,
Surface from Geom,
Curve from Geom,
TrimmedCurve from Geom,
ListOfShape from TopTools,
Real from Standard,
Curve from Geom2d,
InternalBuilder, StatusType,ErrorTypeStatus,StatusDone from FilletSurf
raises
NotDone from StdFail,
OutOfRange from Standard
is
Create(S : Shape from TopoDS;
E : ListOfShape from TopTools;
R : Real from Standard;
Ta : Real from Standard= 1.0e-2;
Tapp3d : Real from Standard= 1.0e-4;
Tapp2d : Real from Standard =1.0e-5)
---Purpose: initialize of the informations necessary for the
-- computation of the fillet on the
-- Shape S from a list of edges E and a radius R.
--
-- Ta is the angular tolerance
-- Tapp3d is the 3d approximation tolerance
-- Tapp2d is the 2d approximation tolerance
--
--
--
returns Builder from FilletSurf;
Perform(me:in out);
---Purpose computation of the fillet (list of NUBS)
Simulate (me:in out);
-- computes only the sections used in the computation of the fillet
IsDone(me) returns StatusDone from FilletSurf;
---Purpose: gives the status about the computation of the fillet
-- returns:
-- IsOK :no problem during the computation
-- IsNotOk: no result is produced
-- IsPartial: the result is partial
StatusError(me) returns ErrorTypeStatus from FilletSurf;
---Purpose: gives informations about error status if
-- IsDone=IsNotOk
-- returns
-- EdgeNotG1: the edges are not G1
-- FacesNotG1 : two connected faces on a same support are
-- not G1
-- EdgeNotOnShape: the edge is not on shape
-- NotSharpEdge: the edge is not sharp
-- PbFilletCompute: problem during the computation of the fillet
NbSurface(me) returns Integer from Standard
---Purpose: gives the number of NUBS surfaces of the Fillet.
raises NotDone from StdFail;
SurfaceFillet (me;Index:Integer from Standard) returns Surface from Geom
---Purpose: gives the NUBS surface of index Index.
---C++: return const &
raises NotDone from StdFail,
OutOfRange from Standard;
TolApp3d (me;Index:Integer from Standard) returns Real from Standard
---Purpose: gives the 3d tolerance reached during approximation
-- of surface of index Index
raises NotDone from StdFail,
OutOfRange from Standard;
SupportFace1 (me;Index:Integer from Standard) returns Face from TopoDS
---Purpose:gives the first support face relative to SurfaceFillet(Index);
---C++:return const &
raises NotDone from StdFail,
OutOfRange from Standard;
SupportFace2 (me;Index:Integer from Standard) returns Face from TopoDS
---Purpose:gives the second support face relative to SurfaceFillet(Index);
---C++:return const &
raises NotDone from StdFail,
OutOfRange from Standard;
CurveOnFace1 (me;Index:Integer from Standard) returns Curve from Geom
---C++: return const &
--- Purpose: gives the 3d curve of SurfaceFillet(Index) on SupportFace1(Index)
raises NotDone from StdFail,
OutOfRange from Standard;
CurveOnFace2 (me;Index:Integer from Standard) returns Curve from Geom
---C++: return const &
---Purpose: gives the 3d curve of SurfaceFillet(Index) on SupportFace2(Index)
raises NotDone from StdFail,
OutOfRange from Standard;
PCurveOnFace1(me;Index:Integer from Standard) returns Curve from Geom2d
---Purpose:gives the PCurve associated to CurvOnSup1(Index) on the support face
---C++: return const&
raises NotDone from StdFail,
OutOfRange from Standard;
PCurve1OnFillet (me;Index:Integer from Standard) returns Curve from Geom2d
---Purpose: gives the PCurve associated to CurveOnFace1(Index) on the Fillet
---C++: return const&
raises NotDone from StdFail,
OutOfRange from Standard;
PCurveOnFace2(me;Index:Integer from Standard) returns Curve from Geom2d
---Purpose: gives the PCurve associated to CurveOnSup2(Index) on the support face
---C++: return const&
raises NotDone from StdFail,
OutOfRange from Standard;
PCurve2OnFillet (me;Index:Integer from Standard) returns Curve from Geom2d
---Purpose: gives the PCurve associated to CurveOnSup2(Index) on the fillet
---C++: return const&
raises NotDone from StdFail,
OutOfRange from Standard;
FirstParameter(me) returns Real from Standard
---Purpose:gives the parameter of the fillet on the first edge.
raises NotDone from StdFail;
LastParameter (me) returns Real from Standard
---Purpose: gives the parameter of the fillet on the last edge
raises NotDone from StdFail;
StartSectionStatus(me) returns StatusType from FilletSurf
-- returns:
-- twoExtremityonEdge: each extremity of start section of the Fillet is
-- on the edge of the corresponding support face.
-- OneExtremityOnEdge: only one of the extremities of start section of the Fillet
-- is on the edge of the corresponding support face.
-- NoExtremityOnEdge any extremity of the start section ofthe fillet is on
-- the edge of the corresponding support face.
raises NotDone from StdFail;
EndSectionStatus(me) returns StatusType from FilletSurf
-- returns:
-- twoExtremityonEdge: each extremity of end section of the Fillet is
-- on the edge of the corresponding support face.
-- OneExtremityOnEdge: only one of the extremities of end section of the Fillet
-- is on the edge of the corresponding support face.
-- NoExtremityOnEdge: any extremity of the end section of the fillet is on
-- the edge of the corresponding support face.
raises NotDone from StdFail;
NbSection(me;IndexSurf:Integer from Standard) returns Integer from Standard
-- gives the number of sections relative to SurfaceFillet(IndexSurf)
raises NotDone from StdFail,
OutOfRange from Standard;
Section(me;IndexSurf:Integer from Standard;IndexSec:Integer from Standard;
Circ: out TrimmedCurve from Geom)
-- gives the arc of circle corresponding to section number
-- IndexSec of SurfaceFillet(IndexSurf) (The basis curve of the
-- trimmed curve is a Geom_Circle)
raises NotDone from StdFail,
OutOfRange from Standard;
fields
myIntBuild : InternalBuilder from FilletSurf;
myisdone : StatusDone from FilletSurf;
myerrorstatus: ErrorTypeStatus from FilletSurf;
end Builder;

View File

@@ -0,0 +1,305 @@
// File: FilletSurf_Builder.cxx
// Created: ???
// Author:
//
// Modifed: Portage NT 7-5-97 DPF (return)
#include <FilletSurf_Builder.ixx>
#include <FilletSurf_InternalBuilder.hxx>
#include <TopoDS.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <ChFi3d_FilletShape.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <StdFail_NotDone.hxx>
#include <FilletSurf_ErrorTypeStatus.hxx>
//=======================================================================
//function : FilletSurf_Builder
//purpose :
//=======================================================================
FilletSurf_Builder::FilletSurf_Builder(const TopoDS_Shape& S,
const TopTools_ListOfShape& E,
const Standard_Real R,
const Standard_Real Ta,
const Standard_Real Tapp3d,
const Standard_Real Tapp2d ):
myIntBuild(S,ChFi3d_Polynomial,Ta,Tapp3d,Tapp2d)
{
myisdone=FilletSurf_IsOk;
int add =myIntBuild.Add(E,R);
if (add!=0) {
myisdone=FilletSurf_IsNotOk;
if (add==1) myerrorstatus=FilletSurf_EmptyList;
else if(add==2) myerrorstatus=FilletSurf_EdgeNotG1;
else if(add==3) myerrorstatus=FilletSurf_FacesNotG1;
else if(add==4) myerrorstatus=FilletSurf_EdgeNotOnShape;
else if(add==5) myerrorstatus=FilletSurf_NotSharpEdge;
}
}
//========================================================
//
//============================================================
void FilletSurf_Builder::Perform()
{
if (myisdone==FilletSurf_IsOk) {
myIntBuild.Perform();
if (myIntBuild.Done()) myisdone=FilletSurf_IsOk;
else if (myIntBuild.NbSurface()!=0) {
myisdone=FilletSurf_IsPartial;
myerrorstatus=FilletSurf_PbFilletCompute;
}
else {
myisdone=FilletSurf_IsNotOk;
myerrorstatus=FilletSurf_PbFilletCompute;
}
}
}
//=======================================================================
//function : IsDone
//purpose : gives the status of the computation of the fillet
//=======================================================================
FilletSurf_StatusDone FilletSurf_Builder::IsDone() const
{
return myisdone;
}
//=======================================================================
//function : ErrorTypeStatus
//purpose : gives the status of the error
//=======================================================================
FilletSurf_ErrorTypeStatus FilletSurf_Builder::StatusError() const
{
return myerrorstatus;
}
//=======================================================================
//function : NbSurface
//purpose : gives the number of NUBS surfaces of the Fillet
//=======================================================================
Standard_Integer FilletSurf_Builder::NbSurface() const
{
if (IsDone()!=FilletSurf_IsNotOk) return myIntBuild.NbSurface();
StdFail_NotDone::Raise("FilletSurf_Builder::NbSurface");
return 0;
}
//=======================================================================
//function : SurfaceFillet
//purpose : gives the NUBS surface of index Index
//=======================================================================
const Handle(Geom_Surface)& FilletSurf_Builder::SurfaceFillet(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface())) Standard_OutOfRange::Raise("FilletSurf_Builder::SurfaceFillet");
return myIntBuild.SurfaceFillet(Index);
}
//=======================================================================
//function : TolApp3d
//purpose : gives the 3d tolerance reached during approximation
//=======================================================================
Standard_Real FilletSurf_Builder::TolApp3d(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::TolApp3d");
return myIntBuild.TolApp3d(Index);
}
//=======================================================================
//function : SupportFace1
//purpose : gives the first support face relative to SurfaceFillet(Index)
//=======================================================================
const TopoDS_Face& FilletSurf_Builder::SupportFace1(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::SupportFace1");
return myIntBuild.SupportFace1(Index);
}
//=======================================================================
//function : SupportFace2
//purpose : gives the second support face relative to SurfaceFillet(Index)
//=======================================================================
const TopoDS_Face& FilletSurf_Builder::SupportFace2(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::SupportFace2");
return myIntBuild.SupportFace2(Index);
}
//===============================================================================
//function : CurveOnFace1
//purpose : gives the 3d curve of SurfaceFillet(Index) on SupportFace1(Index)
//===============================================================================
const Handle(Geom_Curve)& FilletSurf_Builder::CurveOnFace1(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::CurveOnFace1");
return myIntBuild.CurveOnFace1(Index);
}
//=======================================================================
//function : CurveOnFace2
//purpose : gives the 3d curve of SurfaceFillet(Index) on SupportFace2(Index
//=======================================================================
const Handle(Geom_Curve)& FilletSurf_Builder::CurveOnFace2(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::CurveOnFace2");
return myIntBuild.CurveOnFace2(Index);
}
//=======================================================================
//function : PCurveOnFace1
//purpose : gives the PCurve associated to CurveOnFace1(Index) on the support face
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_Builder::PCurveOnFace1(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise( "FilletSurf_Builder::PCurveOnFace1");
return myIntBuild.PCurveOnFace1(Index);
}
//=======================================================================
//function : PCurve1OnFillet
//purpose : gives the PCurve associated to CurveOnFace1(Index) on the Fillet
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_Builder::PCurve1OnFillet(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::PCurve1OnFillet");
return myIntBuild.PCurve1OnFillet(Index);
}
//=======================================================================
//function : PCurveOnFace2
//purpose : gives the PCurve associated to CurveOnFace2(Index) on the support face
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_Builder::PCurveOnFace2(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::PCurveOnFace2");
return myIntBuild.PCurveOnFace2(Index);
}
//=======================================================================
//function : PCurve2OnFillet
//purpose : gives the PCurve associated to CurveOnFace2(Index) on the Fillet
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_Builder::PCurve2OnFillet(const Standard_Integer Index) const
{
if ( (Index<1)||(Index>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::PCurve2OnFillet");
return myIntBuild.PCurve2OnFillet(Index);
}
//=======================================================================
//function : FirstParameter
//purpose : gives the parameter of the fillet on the first edge
//=======================================================================
Standard_Real FilletSurf_Builder::FirstParameter() const
{
if (IsDone()==FilletSurf_IsNotOk)
StdFail_NotDone::Raise("FilletSurf_Builder::FirstParameter");
return myIntBuild.FirstParameter();
}
//=======================================================================
//function : LastParameter
//purpose : gives the parameter of the fillet on the last edge
//=======================================================================
Standard_Real FilletSurf_Builder::LastParameter() const
{
if (IsDone()==FilletSurf_IsNotOk)
StdFail_NotDone::Raise("FilletSurf_Builder::LastParameter");
return myIntBuild.LastParameter();
}
//=======================================================================
//function : StatusStartSection
//purpose : returns:
// twoExtremityonEdge: each extremity of start section of the Fillet is
// on the edge of the corresponding support face.
// OneExtremityOnEdge: only one of the extremities of start section of the Fillet
// is on the edge of the corresponding support face.
// NoExtremityOnEdge: any extremity of the start section ofthe fillet is on
// the edge of the corresponding support face.
//=======================================================================
FilletSurf_StatusType FilletSurf_Builder::StartSectionStatus() const
{
if (IsDone()==FilletSurf_IsNotOk)
StdFail_NotDone::Raise("FilletSurf_Builder::StartSectionStatus" );
return myIntBuild.StartSectionStatus();
}
//=======================================================================
//function : StatusEndSection
//purpose : returns:
// twoExtremityonEdge: each extremity of end section of the Fillet is
// on the edge of the corresponding support face.
// OneExtremityOnEdge: only one of the extremities of end section of the Fillet
// is on the edge of the corresponding support face.
// NoExtremityOnEdge: any extremity of the end section of the fillet is on
// the edge of the corresponding support face.
//=======================================================================
FilletSurf_StatusType FilletSurf_Builder::EndSectionStatus() const
{
if (IsDone()==FilletSurf_IsNotOk)
StdFail_NotDone::Raise("FilletSurf_Builder::StartSectionStatus");
return myIntBuild.EndSectionStatus();
}
//=======================================================================
//function : Simulate
//purpose : computes only the sections used in the computation of the fillet
//=======================================================================
void FilletSurf_Builder::Simulate()
{
if (myisdone==FilletSurf_IsOk) {
myIntBuild.Simulate();
if (myIntBuild.Done()) myisdone=FilletSurf_IsOk;
else { myisdone=FilletSurf_IsNotOk;
myerrorstatus=FilletSurf_PbFilletCompute;}
}
}
//=======================================================================
//function : NbSection
//purpose : gives the number of sections relative to SurfaceFillet(IndexSurf)
//=======================================================================
Standard_Integer FilletSurf_Builder::NbSection(const Standard_Integer IndexSurf) const
{
if (IsDone()==FilletSurf_IsNotOk)
StdFail_NotDone::Raise("FilletSurf_Builder::NbSection)");
else if ( (IndexSurf<1)||(IndexSurf>NbSurface())) Standard_OutOfRange::Raise
("FilletSurf_Builder::NbSection");
return myIntBuild.NbSection(IndexSurf);
}
//=======================================================================
//function : Section
//purpose : gives the arc of circle corresponding to section number
// IndexSec of SurfaceFillet(IndexSurf) (The basis curve of the
// trimmed curve is a Geom_Circle)
//=======================================================================
void FilletSurf_Builder::Section(const Standard_Integer IndexSurf,
const Standard_Integer IndexSec,
Handle(Geom_TrimmedCurve)& Circ) const
{
if ((IndexSurf<1)||(IndexSurf>NbSurface()))
Standard_OutOfRange::Raise("FilletSurf_Builder::Section NbSurface");
else if ((IndexSec<1)||(IndexSec>NbSection(IndexSurf)))
Standard_OutOfRange::Raise("FilletSurf_Builder::Section NbSection");
else myIntBuild.Section(IndexSurf, IndexSec,Circ);
}

View File

@@ -0,0 +1,274 @@
-- File: BlendToy_Fillet.cdl
-- Created: Fri Jul 26 11:28:31 1996
-- Authors: Maria PUMBORIOS
-- Laurent BOURESCHE
-- <mps@sgi30>
---Copyright: Matra Datavision 1996
private class InternalBuilder from FilletSurf inherits FilBuilder from ChFi3d
---Purpose: This class is private. It is used by the class Builder
-- from FilletSurf. It computes geometric information about fillets.
uses
SurfData from ChFiDS,
HElSpine from ChFiDS,
Spine from ChFiDS,
SequenceOfSurfData from ChFiDS,
HSurface from BRepAdaptor,
TopolTool from Adaptor3d,
Shape,Edge,Face from TopoDS,
Surface from Geom,
Curve from Geom,
TrimmedCurve from Geom,
FilletShape from ChFi3d,
ListOfShape from TopTools,
Vector from math,
Real from Standard,
Curve from Geom2d,
Pnt from gp,
StatusType,ErrorTypeStatus,StatusDone from FilletSurf,
HCurve2d from BRepAdaptor,
Orientation from TopAbs
is
Create(S : Shape from TopoDS;
FShape : FilletShape from ChFi3d = ChFi3d_Polynomial;
Ta : Real from Standard = 1.0e-2;
Tapp3d : Real from Standard=1.0e-4;
Tapp2d : Real from Standard=1.0e-5)
returns InternalBuilder from FilletSurf;
Add(me : in out;
E : ListOfShape from TopTools;
R : Real from Standard)
---Purpose: Initializes the contour with a list of Edges
-- 0 : no problem
-- 1 : empty list
-- 2 : the edges are not G1
-- 3 : two connected faces on a same support are not G1
-- 4 : the edge is not on shape
-- 5 : NotSharpEdge: the edge is not sharp
returns Integer from Standard;
Perform(me : in out);
--- computation of the fillet
PerformSurf(me : in out;
SeqData : out SequenceOfSurfData from ChFiDS;
Guide : HElSpine from ChFiDS;
Spine : Spine from ChFiDS;
Choix : Integer from Standard;
S1 : HSurface from BRepAdaptor;
I1 : TopolTool from Adaptor3d;
S2 : HSurface from BRepAdaptor;
I2 : TopolTool from Adaptor3d;
MaxStep : Real from Standard;
Fleche : Real from Standard;
TolGuide : Real from Standard;
First,Last : in out Real from Standard;
Inside,Appro : Boolean from Standard;
Forward : Boolean from Standard;
RecOnS1,RecOnS2 : Boolean from Standard;
Soldep : Vector from math;
Intf,Intl : in out Boolean from Standard)
returns Boolean
is redefined protected;
---Purpose: This method calculates the elements of construction of the
-- fillet (constant or evolutive).
--
PerformSurf(me : in out;
SeqData : out SequenceOfSurfData from ChFiDS;
Guide : HElSpine from ChFiDS;
Spine : Spine from ChFiDS;
Choix : Integer from Standard;
S1 : HSurface from BRepAdaptor;
I1 : TopolTool from Adaptor3d;
PC1 : HCurve2d from BRepAdaptor;
Sref1 : HSurface from BRepAdaptor;
PCref1 : HCurve2d from BRepAdaptor;
Decroch1 : out Boolean from Standard;
S2 : HSurface from BRepAdaptor;
I2 : TopolTool from Adaptor3d;
Or2 : Orientation from TopAbs;
MaxStep : Real from Standard;
Fleche : Real from Standard;
TolGuide : Real from Standard;
First,Last : in out Real from Standard;
Inside,Appro,Forward : Boolean from Standard;
RecP,RecS,RecRst : Boolean from Standard;
Soldep : Vector from math)
is redefined protected;
PerformSurf(me : in out;
SeqData : out SequenceOfSurfData from ChFiDS;
Guide : HElSpine from ChFiDS;
Spine : Spine from ChFiDS;
Choix : Integer from Standard;
S1 : HSurface from BRepAdaptor;
I1 : TopolTool from Adaptor3d;
Or1 : Orientation from TopAbs;
S2 : HSurface from BRepAdaptor;
I2 : TopolTool from Adaptor3d;
PC2 : HCurve2d from BRepAdaptor;
Sref2 : HSurface from BRepAdaptor;
PCref2 : HCurve2d from BRepAdaptor;
Decroch2 : out Boolean from Standard;
MaxStep : Real from Standard;
Fleche : Real from Standard;
TolGuide : Real from Standard;
First,Last : in out Real from Standard;
Inside,Appro,Forward : Boolean from Standard;
RecP,RecS,RecRst : Boolean from Standard;
Soldep : Vector from math)
is redefined protected;
PerformSurf(me : in out;
Data : out SequenceOfSurfData from ChFiDS;
Guide : HElSpine from ChFiDS;
Spine : Spine from ChFiDS;
Choix : Integer from Standard;
S1 : HSurface from BRepAdaptor;
I1 : TopolTool from Adaptor3d;
PC1 : HCurve2d from BRepAdaptor;
Sref1 : HSurface from BRepAdaptor;
PCref1 : HCurve2d from BRepAdaptor;
Decroch1 : out Boolean from Standard;
Or1 : Orientation from TopAbs;
S2 : HSurface from BRepAdaptor;
I2 : TopolTool from Adaptor3d;
PC2 : HCurve2d from BRepAdaptor;
Sref2 : HSurface from BRepAdaptor;
PCref2 : HCurve2d from BRepAdaptor;
Decroch2 : out Boolean from Standard;
Or2 : Orientation from TopAbs;
MaxStep : Real from Standard;
Fleche : Real from Standard;
TolGuide : Real from Standard;
First,Last : in out Real from Standard;
Inside,Appro,Forward : Boolean from Standard;
RecP1,RecRst1 : Boolean from Standard;
RecP2,RecRst2 : Boolean from Standard;
Soldep : Vector from math)
is redefined protected;
Done (me) returns Boolean from Standard;
NbSurface(me) returns Integer from Standard;
---Purpose: gives the number of NUBS surfaces of the Fillet.
SurfaceFillet (me;Index:Integer from Standard)
---Purpose: gives the NUBS surface of index Index.
---C++: return const &
returns Surface from Geom;
TolApp3d (me;Index:Integer from Standard) returns Real from Standard;
---Purpose: gives the 3d tolerance reached during approximation
-- of the surface of index Index
SupportFace1 (me;Index:Integer from Standard)
---Purpose:gives the first support face relative to SurfaceFillet(Index);
---C++:return const &
returns Face from TopoDS;
SupportFace2 (me;Index:Integer from Standard)
---Purpose:gives the second support face relative to SurfaceFillet(Index);
---C++:return const &
returns Face from TopoDS;
CurveOnFace1 (me;Index:Integer from Standard)
---C++: return const &
--- Purpose: gives the 3d curve of SurfaceFillet(Index) on SupportFace1(Index)
returns Curve from Geom;
CurveOnFace2 (me;Index:Integer from Standard)
---C++: return const &
---Purpose: gives the 3d curve of SurfaceFillet(Index) on SupportFace2(Index)
returns Curve from Geom;
PCurveOnFace1(me;Index:Integer from Standard)
---Purpose:gives the PCurve associated to CurvOnSup1(Index) on the support face
---C++: return const&
returns Curve from Geom2d;
PCurve1OnFillet (me;Index:Integer from Standard)
---Purpose: gives the PCurve associated to CurveOnFace1(Index) on the Fillet
---C++: return const&
returns Curve from Geom2d;
PCurveOnFace2(me;Index:Integer from Standard)
---Purpose: gives the PCurve associated to CurveOnSup2(Index) on the support face
---C++: return const&
returns Curve from Geom2d;
PCurve2OnFillet (me;Index:Integer from Standard)
---Purpose: gives the PCurve associated to CurveOnSup2(Index) on the fillet
---C++: return const&
returns Curve from Geom2d;
FirstParameter(me)
---Purpose:gives the parameter of the fillet on the first edge.
--
--
--
returns Real from Standard;
LastParameter (me)
---Purpose: gives the parameter of the fillet on the last edge
--
returns Real from Standard;
StartSectionStatus(me)
-- returns:
-- TwoExtremityOnEdge: each extremity of start section of the Fillet is
-- on the edge of the corresponding support face.
-- OneExtremityOnEdge: only one of the extremities of start section of the Fillet
-- is on the edge of the corresponding support face.
-- NoExtremityOnEdge: any extremity of the start section ofthe fillet is on
-- the edge of the corresponding support face.
returns StatusType from FilletSurf;
EndSectionStatus(me)
-- returns:
-- twoExtremityonEdge : each extremity of end section of the Fillet is
-- on the edge of the corresponding support face.
-- OneExtremityOnEdge: only one of the extremities of end section of the Fillet
-- is on the edge of the corresponding support face.
-- NoExtremityOnEdge : any extremity of the end section of the fillet is on
-- the edge of the corresponding support face.
returns StatusType from FilletSurf;
Simulate (me:in out);
-- computes only the sections used in the computation of the fillet
NbSection(me;IndexSurf:Integer from Standard)
returns Integer from Standard;
-- gives the number of sections relative to SurfaceFillet(IndexSurf)
Section(me;IndexSurf:Integer from Standard;IndexSec:Integer from Standard;
Circ: out TrimmedCurve from Geom);
-- gives the arc of circle corresponding to section number
-- IndexSec of SurfaceFillet(IndexSurf) (The basis curve of the
-- trimmed curve is a Geom_Circle)
end InternalBuilder;

View File

@@ -0,0 +1,686 @@
#include <FilletSurf_InternalBuilder.ixx>
#include <FilletSurf_StatusDone.hxx>
#include <FilletSurf_ErrorTypeStatus.hxx>
#include <FilletSurf_StatusType.hxx>
#include <ChFi3d_FilBuilder.hxx>
#include <ChFi3d_Builder_0.hxx>
#include <ChFiDS_HData.hxx>
#include <ChFiDS_FilSpine.hxx>
#include <ChFiDS_HElSpine.hxx>
#include <ChFiDS_Stripe.hxx>
#include <ChFiDS_ListOfStripe.hxx>
#include <ChFiDS_ListIteratorOfListOfStripe.hxx>
#include <ChFiDS_SurfData.hxx>
#include <ChFiDS_SequenceOfSurfData.hxx>
#include <ChFiDS_FaceInterference.hxx>
#include <ChFiDS_CommonPoint.hxx>
#include <ChFiDS_CircSection.hxx>
#include <ChFiDS_SecHArray1.hxx>
#include <BRepBlend_Line.hxx>
#include <BRepBlend_ConstRad.hxx>
#include <BRepBlend_ConstRadInv.hxx>
#include <TopoDS.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAbs_Shape.hxx>
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Curve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Circle.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <ElSLib.hxx>
#include <gp_Circ.hxx>
#include <gp_Pln.hxx>
#include <IntCurveSurface_HInter.hxx>
#include <IntCurveSurface_IntersectionPoint.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <Standard_ConstructionError.hxx>
#include <Precision.hxx>
static Standard_Boolean isinlist(const TopoDS_Shape& E,
const TopTools_ListOfShape& L){
TopTools_ListIteratorOfListOfShape It;
for (It.Initialize(L); It.More(); It.Next()){
if(E.IsSame(It.Value())) return 1;
}
return 0;
}
static Standard_Boolean IntPlanEdge(Handle(BRepAdaptor_HCurve)& Ed,
const gp_Pln& P,
Standard_Real& w,
const Standard_Real tol3d)
{
Standard_Boolean done = 0;
Standard_Real f = Ed->FirstParameter();
Standard_Real l = Ed->LastParameter();
gp_Pnt Or = P.Location();
Handle(Geom_Plane) Pln = new Geom_Plane(P);
Handle(GeomAdaptor_HSurface)
Plan = new GeomAdaptor_HSurface(GeomAdaptor_Surface(Pln));
IntCurveSurface_HInter Intersection;
Standard_Integer nbp ,iip;
IntCurveSurface_IntersectionPoint IP;
Standard_Real dist = RealLast();
Intersection.Perform(Ed,Plan);
if(Intersection.IsDone()){
nbp = Intersection.NbPoints();
for (iip = 1; iip <= nbp; iip++){
IP = Intersection.Point(iip);
gp_Pnt pint = IP.Pnt();
Standard_Real d = pint.Distance(Or);
if(d<dist){
done = 1;
w = IP.W();
dist = d;
}
}
}
gp_Pnt pdeb = Ed->Value(f);
gp_Pnt pfin = Ed->Value(l);
Standard_Real u,v;
//on regarde si les extremites ne sont pas solution
ElSLib::Parameters(P,pdeb,u,v);
gp_Pnt projdeb = ElSLib::Value(u,v,P);
Standard_Real dprojdeb = pdeb.Distance(projdeb);
if(dprojdeb<tol3d){
Standard_Real d = pdeb.Distance(Or);
if(d<dist){
done = 1;
w = f;
dist = d;
}
}
ElSLib::Parameters(P,pfin,u,v);
gp_Pnt projfin = ElSLib::Value(u,v,P);
Standard_Real dprojfin = pfin.Distance(projfin);
if(dprojfin<tol3d){
Standard_Real d = pfin.Distance(Or);
if(d<dist){
done = 1;
w = l;
dist = d;
}
}
return done;
}
static Standard_Boolean ComputeEdgeParameter(const Handle(ChFiDS_Spine)& Spine,
const Standard_Integer ind,
const Standard_Real pelsp,
Standard_Real& ped,
const Standard_Real tol3d)
{
Handle(ChFiDS_HElSpine) Guide = Spine->ElSpine(ind);
gp_Pnt P; gp_Vec V;
Guide->D1(pelsp,P,V);
gp_Pln pln(P,V);
Handle(BRepAdaptor_HCurve) ed = new BRepAdaptor_HCurve();
ed->ChangeCurve() = Spine->CurrentElementarySpine(ind);
return IntPlanEdge(ed,pln,ped,tol3d);
}
//=======================================================================
//function : FilletSurf_InternalBuilder
//purpose :
//=======================================================================
FilletSurf_InternalBuilder::FilletSurf_InternalBuilder
(const TopoDS_Shape& S,
const ChFi3d_FilletShape FShape,
const Standard_Real Ta,
const Standard_Real Tapp3d,
const Standard_Real Tapp2d):ChFi3d_FilBuilder(S,FShape,Ta)
{
SetParams(Ta,Tapp3d,Tapp2d,
Tapp3d,Tapp2d,1.e-3);
SetContinuity(GeomAbs_C2,Ta);
}
//=======================================================================
//function : Add
//purpose : creation d une spine sur un paquet d'aretes
//
// 0 : pas de probleme
// 1 : liste vide
// 2 : aretes non g1
// 3 : faces adjacentes non G1
// 4 : l'arete n'est pas sur le shape
// 5 : l'arete n'est pas vive
//=======================================================================
Standard_Integer FilletSurf_InternalBuilder::Add(const TopTools_ListOfShape& E,
const Standard_Real R)
{
if(E.IsEmpty()) return 1;
TopTools_ListIteratorOfListOfShape It;
for(It.Initialize(E); It.More(); It.Next()){
TopoDS_Edge cured = TopoDS::Edge(It.Value());
if(cured.IsNull()) return 4;
if(!myEFMap.Contains(cured)) return 4;
//on controle que l arete est bien une arete de cassure
TopoDS_Face ff1,ff2;
for(It.Initialize(myEFMap(cured));It.More();It.Next()){
if (ff1.IsNull()) {
ff1 = TopoDS::Face(It.Value());
}
else {
ff2 = TopoDS::Face(It.Value());
if(!ff2.IsSame(ff1)){
break;
}
}
}
if(ff1.IsNull() || ff2.IsNull()) return 5;
if(ff1.IsSame(ff2)) return 5;
if(BRep_Tool::Continuity(cured,ff1,ff2) != GeomAbs_C0) return 5;
}
TopoDS_Edge ed = TopoDS::Edge(E.First());
ed.Orientation(TopAbs_FORWARD);
ChFi3d_FilBuilder::Add(R,ed);
Handle(ChFiDS_Stripe) st = myListStripe.First();
Handle(ChFiDS_Spine)& sp = st->ChangeSpine();
Standard_Boolean periodic = sp->IsPeriodic();
//On controle que les aretes de la liste E sont bien dans le contour,
//on retire les aretes du contour qui ne sont pas dans la liste,
//on controle que le residu est bien monobloc.
for(It.Initialize(E); It.More(); It.Next()){
TopoDS_Edge cured = TopoDS::Edge(It.Value());
if(!Contains(cured)) return 2;
}
Handle(ChFiDS_FilSpine) newsp = new ChFiDS_FilSpine();
Standard_Boolean debut = 0;
Standard_Integer premierquinyestpas = 0;
Standard_Integer yatrou = 0;
for(Standard_Integer i = 1; i <= sp->NbEdges(); i++){
TopoDS_Edge cured = sp->Edges(i);
if(isinlist(cured,E)){
debut = 1;
if(premierquinyestpas) {
yatrou = 1;
break;
}
newsp->SetEdges(cured);
}
else if(debut && !premierquinyestpas) premierquinyestpas = i;
}
if(!periodic && yatrou) return 2;
if(periodic && yatrou){
Standard_Boolean vraitrou = 0, debut = 0;
for(Standard_Integer i = sp->NbEdges(); i > yatrou; i--){
TopoDS_Edge cured = sp->Edges(i);
if(isinlist(cured,E)){
if(vraitrou) return 2;
newsp->PutInFirst(cured);
}
else if(debut) vraitrou = 1;
debut = 1;
}
}
if(newsp->NbEdges() != sp->NbEdges()) {
newsp->Load();
newsp->SetRadius(R);
sp = newsp;
}
//On construit l ElSpine dans la foulee
Handle(ChFiDS_HElSpine) hels = new ChFiDS_HElSpine();
gp_Vec TFirst,TLast;
gp_Pnt PFirst,PLast;
sp->D1(sp->FirstParameter(),PFirst,TFirst);
sp->D1(sp->LastParameter(),PLast,TLast);
hels->ChangeCurve().FirstParameter(sp->FirstParameter());
hels->ChangeCurve().SetFirstPointAndTgt(PFirst,TFirst);
hels->ChangeCurve().LastParameter(sp->LastParameter());
hels->ChangeCurve().SetLastPointAndTgt(PLast,TLast);
ChFi3d_PerformElSpine(hels,sp,myConti,tolesp);
sp->AppendElSpine(hels);
sp->SplitDone(Standard_True);
return 0;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void FilletSurf_InternalBuilder::Perform()
{
//On se contente d un PerformSetOfSurfOnElSpine.
Handle(ChFiDS_Stripe) Stripe = myListStripe.First();
Handle(ChFiDS_HData)& HData = Stripe->ChangeSetOfSurfData();
HData = new ChFiDS_HData();
Handle(ChFiDS_Spine)& Spine = Stripe->ChangeSpine();
TopAbs_Orientation RefOr1,RefOr2;
Standard_Integer RefChoix;
StripeOrientations(Spine,RefOr1,RefOr2,RefChoix);
Stripe->OrientationOnFace1(RefOr1);
Stripe->OrientationOnFace2(RefOr2);
Stripe->Choix(RefChoix);
PerformSetOfKGen(Stripe,0);
}
//=======================================================================
//function : PerformSurf
//purpose :
//=======================================================================
Standard_Boolean
FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData& SeqData,
const Handle(ChFiDS_HElSpine)& Guide,
const Handle(ChFiDS_Spine)& Spine,
const Standard_Integer Choix,
const Handle(BRepAdaptor_HSurface)& S1,
const Handle(Adaptor3d_TopolTool)& I1,
const Handle(BRepAdaptor_HSurface)& S2,
const Handle(Adaptor3d_TopolTool)& I2,
const Standard_Real MaxStep,
const Standard_Real Fleche,
const Standard_Real TolGuide,
Standard_Real& First,
Standard_Real& Last,
const Standard_Boolean Inside,
const Standard_Boolean Appro,
const Standard_Boolean Forward,
const Standard_Boolean RecOnS1,
const Standard_Boolean RecOnS2,
const math_Vector& Soldep,
Standard_Boolean& Intf,
Standard_Boolean& Intl)
{
Handle(ChFiDS_SurfData) Data = SeqData(1);
Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
if(fsp.IsNull()) Standard_ConstructionError::Raise
("PerformSurf : la spine n est pas celle d un conge");
Handle(BRepBlend_Line) lin;
TopAbs_Orientation Or = S1->ChangeSurface().Face().Orientation();
if(!fsp->IsConstant()) Standard_ConstructionError::Raise
("PerformSurf : pas de rayons variables");
// Standard_Boolean maybesingular; //pour scinder les Surfdata singulieres
BRepBlend_ConstRad Func(S1,S2,Guide);
BRepBlend_ConstRadInv FInv(S1,S2,Guide);
Func.Set(fsp->Radius(),Choix);
FInv.Set(fsp->Radius(),Choix);
switch (GetFilletShape()) {
case ChFi3d_Rational:
Func.Set(BlendFunc_Rational);
break;
case ChFi3d_QuasiAngular:
Func.Set(BlendFunc_QuasiAngular);
break;
case ChFi3d_Polynomial:
Func.Set(BlendFunc_Polynomial);
}
Standard_Real PFirst = First;
done = SimulData(Data,Guide,lin,S1,I1,
S2,I2,Func,FInv,PFirst,MaxStep,Fleche,
TolGuide,First,Last,Inside,Appro,Forward,Soldep,
20,RecOnS1,RecOnS2);
if(!done) return Standard_False;
if(lin->StartPointOnFirst().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(), tolesp);
}
if(lin->EndPointOnFirst().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(), tolesp);
}
if(lin->StartPointOnSecond().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(), tolesp);
}
if(lin->EndPointOnSecond().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(), tolesp);
}
done = CompleteData(Data,Func,lin,S1,S2,Or,0,0,0,0);
if(!done) Standard_Failure::Raise("PerformSurf : Echec approximation!");
// maybesingular = (Func.GetMinimalDistance()<=100*tolapp3d);
Standard_Boolean ok = 0;
if(!Forward){
Intf = 0;
const ChFiDS_CommonPoint& cpf1 = Data->VertexFirstOnS1();
if(cpf1.IsOnArc()){
TopoDS_Face F1 = S1->ChangeSurface().Face();
TopoDS_Face bid;
ok = Intf = !SearchFace(Spine,cpf1,F1,bid);
}
const ChFiDS_CommonPoint& cpf2 = Data->VertexFirstOnS2();
if(cpf2.IsOnArc() && !ok){
TopoDS_Face F2 = S2->ChangeSurface().Face();
TopoDS_Face bid;
Intf = !SearchFace(Spine,cpf2,F2,bid);
}
}
Intl = 0;
ok = 0;
const ChFiDS_CommonPoint& cpl1 = Data->VertexLastOnS1();
if(cpl1.IsOnArc()){
TopoDS_Face F1 = S1->ChangeSurface().Face();
TopoDS_Face bid;
ok = Intl = !SearchFace(Spine,cpl1,F1,bid);
}
const ChFiDS_CommonPoint& cpl2 = Data->VertexLastOnS2();
if(cpl2.IsOnArc() && !ok){
TopoDS_Face F2 = S2->ChangeSurface().Face();
TopoDS_Face bid;
Intl = !SearchFace(Spine,cpl2,F2,bid);
}
Data->FirstSpineParam(First);
Data->LastSpineParam (Last);
// if (maybesingular) SplitSurf(SeqData, lin);
// Necessite de trimer resultats : A faire
return Standard_True;
}
void FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&, const Handle_ChFiDS_HElSpine&, const Handle_ChFiDS_Spine&, const int, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const TopAbs_Orientation, const double, const double, const double, double&, double&, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const math_Vector&)
{
Standard_DomainError::Raise("BlendFunc_CSConstRad::Section : Not implemented");
}
void FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&, const Handle_ChFiDS_HElSpine&, const Handle_ChFiDS_Spine&, const int, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const TopAbs_Orientation, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const TopAbs_Orientation, const double, const double, const double, double&, double&, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const math_Vector&)
{
Standard_DomainError::Raise("BlendFunc_CSConstRad::Section : Not implemented");
}
void FilletSurf_InternalBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&, const Handle_ChFiDS_HElSpine&, const Handle_ChFiDS_Spine&, const int, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const TopAbs_Orientation, const Handle_BRepAdaptor_HSurface&, const Handle_Adaptor3d_TopolTool&, const Handle_BRepAdaptor_HCurve2d&, const Handle_BRepAdaptor_HSurface&, const Handle_BRepAdaptor_HCurve2d&, unsigned int&, const double, const double, const double, double&, double&, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const math_Vector&)
{
Standard_DomainError::Raise("BlendFunc_CSConstRad::Section : Not implemented");
}
Standard_Boolean FilletSurf_InternalBuilder::Done() const
{
return done;
}
//=======================================================================
//function : NbSurface
//purpose : gives the number of NUBS surfaces of the Fillet
//=======================================================================
Standard_Integer FilletSurf_InternalBuilder::NbSurface() const
{
return myListStripe.First()->SetOfSurfData()->Length();
}
//=======================================================================
//function : SurfaceFillet
//purpose : gives the NUBS surface of index Index
//=======================================================================
const Handle(Geom_Surface)& FilletSurf_InternalBuilder::SurfaceFillet(const Standard_Integer Index) const
{
Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->Surf();
return myDS->Surface(isurf).Surface();
}
//=======================================================================
//function : TolApp3d
//purpose : gives the 3d tolerance reached during approximation
//=======================================================================
Standard_Real FilletSurf_InternalBuilder::TolApp3d(const Standard_Integer Index) const
{
Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->Surf();
return myDS->Surface(isurf).Tolerance();
}
//=======================================================================
//function : SupportFace1
//purpose : gives the first support face relative to SurfaceFillet(Index)
//=======================================================================
const TopoDS_Face& FilletSurf_InternalBuilder::SupportFace1(const Standard_Integer Index) const
{
Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->IndexOfS1();
return TopoDS::Face(myDS->Shape(isurf));
}
//=======================================================================
//function : SupportFace2
//purpose : gives the second support face relative to SurfaceFillet(Index)
//=======================================================================
const TopoDS_Face& FilletSurf_InternalBuilder::SupportFace2(const Standard_Integer Index) const
{
Standard_Integer isurf = myListStripe.First()->SetOfSurfData()->Value(Index)->IndexOfS2();
return TopoDS::Face(myDS->Shape(isurf));
}
//===============================================================================
//function : CurveOnSup1
//purpose : gives the 3d curve of SurfaceFillet(Index) on SupportFace1(Index)
//===============================================================================
const Handle(Geom_Curve)& FilletSurf_InternalBuilder::CurveOnFace1(const Standard_Integer Index) const
{
Standard_Integer icurv = myListStripe.First()->SetOfSurfData()->Value(Index)->
InterferenceOnS1().LineIndex();
return myDS->Curve(icurv).Curve();
}
//=======================================================================
//function : CurveOnSup2
//purpose : gives the 3d curve of SurfaceFillet(Index) on SupportFace2(Index
//=======================================================================
const Handle(Geom_Curve)& FilletSurf_InternalBuilder::CurveOnFace2(const Standard_Integer Index) const
{
Standard_Integer icurv=myListStripe.First()->SetOfSurfData()->Value(Index)->
InterferenceOnS2().LineIndex();
return myDS->Curve(icurv).Curve();
}
//=======================================================================
//function : PCurveOnFace1
//purpose : gives the PCurve associated to CurvOnSup1(Index) on the support face
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurveOnFace1(const Standard_Integer Index) const
{
return myListStripe.First()->SetOfSurfData()->Value(Index)->
InterferenceOnS1().PCurveOnFace();
}
//=======================================================================
//function : PCurveOnFillet1
//purpose : gives the PCurve associated to CurveOnFace1(Index) on the Fillet
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurve1OnFillet(const Standard_Integer Index) const
{return myListStripe.First()->SetOfSurfData()->Value(Index)->
InterferenceOnS1().PCurveOnSurf();
}
//=======================================================================
//function : PCurveOnFace2
//purpose : gives the PCurve associated to CurvOnSup2(Index) on the support face
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurveOnFace2(const Standard_Integer Index) const
{
return myListStripe.First()->SetOfSurfData()->Value(Index)->
InterferenceOnS2().PCurveOnFace();
}
//=======================================================================
//function : PCurveOnFillet2
//purpose : gives the PCurve associated to CurveOnFace2(Index) on the Fillet
//=======================================================================
const Handle(Geom2d_Curve)& FilletSurf_InternalBuilder::PCurve2OnFillet(const Standard_Integer Index) const
{return myListStripe.First()->SetOfSurfData()->Value(Index)->
InterferenceOnS2().PCurveOnSurf();
}
//=======================================================================
//function : FirstParameter
//purpose : gives the parameter of the fillet on the first edge
//=======================================================================
Standard_Real FilletSurf_InternalBuilder::FirstParameter() const
{
const Handle(ChFiDS_Stripe)& st = myListStripe.First();
const Handle(ChFiDS_Spine)& sp = st->Spine();
const Handle(ChFiDS_SurfData)& sd = st->SetOfSurfData()->Value(1);
Standard_Real p = sd->FirstSpineParam();
Standard_Integer ind = 1;
if(sp->IsPeriodic()) ind = sp->Index(p);
Standard_Real ep;
if(ComputeEdgeParameter(sp,ind,p,ep,tolesp)) return ep;
return 0.0;
}
//=======================================================================
//function : LastParameter
//purpose : gives the parameter of the fillet on the last edge
//=======================================================================
Standard_Real FilletSurf_InternalBuilder::LastParameter() const
{
const Handle(ChFiDS_Stripe)& st = myListStripe.First();
const Handle(ChFiDS_Spine)& sp = st->Spine();
const Handle(ChFiDS_SurfData)& sd = st->SetOfSurfData()->Value(NbSurface());
Standard_Real p = sd->LastSpineParam();
Standard_Integer ind = sp->NbEdges();
if(sp->IsPeriodic()) ind = sp->Index(p);
Standard_Real ep;
if(ComputeEdgeParameter(sp,ind,p,ep,tolesp)) return ep;
return 0.0;
}
//=======================================================================
//function : StatusStartSection
//purpose : returns:
// twoExtremityonEdge: each extremity of start section of the Fillet is
// on the edge of the corresponding support face.
// OneExtremityOnEdge: only one of the extremities of start section of the Fillet
// is on the edge of the corresponding support face.
// NoExtremityOnEdge: any extremity of start section of the fillet is on
// the edge of the corresponding support face.
//=======================================================================
FilletSurf_StatusType FilletSurf_InternalBuilder::StartSectionStatus() const
{
Standard_Boolean isonedge1 = myListStripe.First()->SetOfSurfData()->Value(1)->
VertexFirstOnS1().IsOnArc();
Standard_Boolean isonedge2= myListStripe.First()->SetOfSurfData()->Value(1)->
VertexFirstOnS2().IsOnArc();;
if (isonedge1 && isonedge2)
{return FilletSurf_TwoExtremityOnEdge;}
else if ((!isonedge1)&& (!isonedge2))
{return FilletSurf_NoExtremityOnEdge ;}
else
{return FilletSurf_OneExtremityOnEdge;}
}
//=======================================================================
//function : StatusEndSection()
//purpose : returns:
// twoExtremityonEdge: each extremity of end section of the Fillet is
// on the edge of the corresponding support face.
// OneExtremityOnEdge: only one of the extremities of end section of the Fillet
// is on the edge of the corresponding support face.
// NoExtremityOnEdge: any extremity of end section of the fillet is on
// the edge of the corresponding support face.
//=======================================================================
FilletSurf_StatusType FilletSurf_InternalBuilder::EndSectionStatus() const
{
Standard_Boolean isonedge1 = myListStripe.First()->SetOfSurfData()->Value(NbSurface())->
VertexLastOnS1().IsOnArc();
Standard_Boolean isonedge2= myListStripe.First()->SetOfSurfData()->Value(NbSurface())->
VertexLastOnS2().IsOnArc();
if (isonedge1 && isonedge2)
{ return FilletSurf_TwoExtremityOnEdge;}
else if ((!isonedge1)&& (!isonedge2))
{ return FilletSurf_NoExtremityOnEdge;}
else
{ return FilletSurf_OneExtremityOnEdge;}
}
//=======================================================================
//function : Simulate
//purpose : computes only the sections used in the computation of the fillet
//=======================================================================
void FilletSurf_InternalBuilder::Simulate()
{
//ChFi3d_FilBuilder::Simulate(1);
Handle(ChFiDS_Stripe) Stripe = myListStripe.First();
Handle(ChFiDS_HData)& HData = Stripe->ChangeSetOfSurfData();
HData = new ChFiDS_HData();
Handle(ChFiDS_Spine)& Spine = Stripe->ChangeSpine();
TopAbs_Orientation RefOr1,RefOr2;
Standard_Integer RefChoix;
StripeOrientations(Spine,RefOr1,RefOr2,RefChoix);
Stripe->OrientationOnFace1(RefOr1);
Stripe->OrientationOnFace2(RefOr2);
Stripe->Choix(RefChoix);
PerformSetOfKGen(Stripe,1);
}
//=======================================================================
//function : NbSection
//purpose : gives the number of sections relative to SurfaceFillet(IndexSurf)
//=======================================================================
Standard_Integer FilletSurf_InternalBuilder::NbSection(const Standard_Integer IndexSurf) const
{
return Sect(1,IndexSurf)->Length();
}
//=======================================================================
//function : Section
//purpose : gives the arc of circle corresponding to section number
// IndexSec of SurfaceFillet(IndexSurf) (The basis curve of the
// trimmed curve is a Geom_Circle)
//=======================================================================
void FilletSurf_InternalBuilder::Section(const Standard_Integer IndexSurf, const Standard_Integer IndexSec, Handle(Geom_TrimmedCurve)& Circ) const
{
gp_Circ c;
Standard_Real deb,fin;
Sect(1,IndexSurf)->Value(IndexSec).Get(c,deb,fin);
Handle(Geom_Circle) Gc = new Geom_Circle(c);
Circ= new Geom_TrimmedCurve(Gc,deb,fin);
}