mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
44
src/ChFiKPart/ChFiKPart.cdl
Executable file
44
src/ChFiKPart/ChFiKPart.cdl
Executable file
@@ -0,0 +1,44 @@
|
||||
-- File: ChFiKPart.cdl
|
||||
-- Created: Wed Dec 8 10:36:10 1993
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@zerox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
package ChFiKPart
|
||||
|
||||
---Purpose: Fonctions de remplissage pour une SurfData, dans
|
||||
-- les cas particulers de conges/chanfreins suivants :
|
||||
-- - cylindre/plan entre 2 surfaces planes,
|
||||
-- - tore/sphere/cone entre un plan et un cylindre othogonal,
|
||||
-- - tore/sphere/cone entre un plan et un cone othogonal,
|
||||
-- - tore/sphere/cone entre un plan et un tore othogonal,
|
||||
-- - tore/cone entre un plan et une sphere.
|
||||
|
||||
uses
|
||||
ChFiDS,
|
||||
TopOpeBRepDS,
|
||||
Adaptor2d,
|
||||
Adaptor3d,
|
||||
TopoDS,
|
||||
TopAbs,
|
||||
gp,
|
||||
TCollection,
|
||||
TColStd,
|
||||
Standard
|
||||
|
||||
is
|
||||
|
||||
class RstMap instantiates DataMap from TCollection
|
||||
(Integer from Standard,
|
||||
HCurve2d from Adaptor2d,
|
||||
MapIntegerHasher from TColStd);
|
||||
|
||||
class ComputeData;
|
||||
---Purpose: Contient toutes les methodes de classe destinees a
|
||||
-- remplir une SurfData dans les cas particuliers
|
||||
-- enumeres ci-dessus.
|
||||
|
||||
end ChFiKPart;
|
||||
|
||||
|
70
src/ChFiKPart/ChFiKPart_ComputeData.cdl
Executable file
70
src/ChFiKPart/ChFiKPart_ComputeData.cdl
Executable file
@@ -0,0 +1,70 @@
|
||||
-- File: ChFiKPart_ComputeData.cdl
|
||||
-- Created: Thu Dec 23 14:40:32 1993
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@sdsun1>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class ComputeData from ChFiKPart
|
||||
|
||||
---Purpose: Methodes de classe permettant de remplir une
|
||||
-- SurfData dans les cas particuliers de conges
|
||||
-- suivants:
|
||||
-- - cylindre entre 2 surfaces planes,
|
||||
-- - tore/sphere entre un plan et un cylindre othogonal,
|
||||
-- - tore/sphere entre un plan et un cone othogonal,
|
||||
--
|
||||
-- - tore entre un plan et une droite orthogonale (rotule).
|
||||
|
||||
uses
|
||||
Orientation from TopAbs,
|
||||
Pnt2d from gp,
|
||||
HSurface from Adaptor3d,
|
||||
Spine from ChFiDS,
|
||||
SurfData from ChFiDS,
|
||||
DataStructure from TopOpeBRepDS
|
||||
is
|
||||
|
||||
Compute(myclass;
|
||||
DStr : in out DataStructure from TopOpeBRepDS;
|
||||
Data : in out SurfData from ChFiDS;
|
||||
S1,S2 : HSurface from Adaptor3d;
|
||||
Or1,Or2 : Orientation from TopAbs;
|
||||
Sp : Spine from ChFiDS;
|
||||
Iedge : Integer from Standard)
|
||||
---Purpose: Computes a simple fillet in several particular
|
||||
-- cases.
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeCorner(myclass;
|
||||
DStr : in out DataStructure from TopOpeBRepDS;
|
||||
Data : SurfData from ChFiDS;
|
||||
S1,S2 : HSurface from Adaptor3d;
|
||||
OrFace1,OrFace2,Or1,Or2 : Orientation from TopAbs;
|
||||
minRad,majRad : Real from Standard;
|
||||
P1S1,P2S1,P1S2,P2S2 : Pnt2d from gp)
|
||||
---Purpose: Computes a toric or spheric corner fillet.
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
ComputeCorner(myclass;
|
||||
DStr : in out DataStructure from TopOpeBRepDS;
|
||||
Data : SurfData from ChFiDS;
|
||||
S1,S2 : HSurface from Adaptor3d;
|
||||
OrFace1,OrFace2,Or1,Or2 : Orientation from TopAbs;
|
||||
Rad : Real from Standard;
|
||||
PS1,P1S2,P2S2 : Pnt2d from gp)
|
||||
---Purpose: Computes spheric corner fillet with non iso pcurve on S2.
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
ComputeCorner(myclass;
|
||||
DStr : in out DataStructure from TopOpeBRepDS;
|
||||
Data : SurfData from ChFiDS;
|
||||
S,S1,S2 : HSurface from Adaptor3d;
|
||||
OfS,OS,OS1,OS2 : Orientation from TopAbs;
|
||||
Radius : Real from Standard)
|
||||
---Purpose: Computes a toric corner rotule.
|
||||
returns Boolean from Standard;
|
||||
|
||||
end ComputeData;
|
||||
|
456
src/ChFiKPart/ChFiKPart_ComputeData.cxx
Executable file
456
src/ChFiKPart/ChFiKPart_ComputeData.cxx
Executable file
@@ -0,0 +1,456 @@
|
||||
// File: ChFiKPart_ComputeData.cxx
|
||||
// Created: Thu Dec 23 16:42:44 1993
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@sdsun1>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.ixx>
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
//#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAdaptor_HSurface.hxx>
|
||||
#include <IntSurf_Transition.hxx>
|
||||
#include <IntSurf_TypeTrans.hxx>
|
||||
#include <IntRes2d_Transition.hxx>
|
||||
#include <IntRes2d_TypeTrans.hxx>
|
||||
#include <IntRes2d_Position.hxx>
|
||||
#include <IntRes2d_IntersectionPoint.hxx>
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
#include <Geom2dInt_GInter.hxx>
|
||||
#include <TopExp.hxx>
|
||||
//#include <BRepAdaptor_HCurve2d.hxx>
|
||||
#include <ChFiDS_FilSpine.hxx>
|
||||
#include <ChFiDS_ChamfSpine.hxx>
|
||||
|
||||
#include <TopOpeBRepDS_Curve.hxx>
|
||||
#include <TopOpeBRepDS_Surface.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
#include <ChFiKPart_ComputeData_ChPlnPln.hxx>
|
||||
#include <ChFiKPart_ComputeData_ChPlnCyl.hxx>
|
||||
#include <ChFiKPart_ComputeData_ChPlnCon.hxx>
|
||||
#include <ChFiKPart_ComputeData_ChAsymPlnPln.hxx>
|
||||
#include <ChFiKPart_ComputeData_ChAsymPlnCyl.hxx>
|
||||
#include <ChFiKPart_ComputeData_ChAsymPlnCon.hxx>
|
||||
#include <ChFiKPart_ComputeData_FilPlnCon.hxx>
|
||||
#include <ChFiKPart_ComputeData_FilPlnCyl.hxx>
|
||||
#include <ChFiKPart_ComputeData_FilPlnPln.hxx>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData_CS.hxx>
|
||||
#include <ChFiKPart_ComputeData_Rotule.hxx>
|
||||
#include <ChFiKPart_ComputeData_Sphere.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
// Unused :
|
||||
#ifdef DEB
|
||||
static Standard_Real ComputeAbscissa(const BRepAdaptor_Curve& C,
|
||||
const Standard_Real UFirst)
|
||||
{
|
||||
Standard_Real fp = fp = C.FirstParameter();
|
||||
switch (C.GetType()) {
|
||||
case GeomAbs_Line:
|
||||
return UFirst - fp;
|
||||
case GeomAbs_Circle:
|
||||
return C.Circle().Radius()*(UFirst-fp);
|
||||
#ifndef DEB
|
||||
default:
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
Standard_NotImplemented::Raise("calcul abscisse non traite ");
|
||||
return 0.;
|
||||
}
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ChFiKPart_ComputeData::Compute
|
||||
(TopOpeBRepDS_DataStructure& DStr,
|
||||
Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle_Adaptor3d_HSurface& S1,
|
||||
const Handle_Adaptor3d_HSurface& S2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Handle(ChFiDS_Spine)& Sp,
|
||||
const Standard_Integer Iedge)
|
||||
{
|
||||
Standard_Real Wref = 0.;
|
||||
|
||||
Handle(ChFiDS_FilSpine) Spine = Handle(ChFiDS_FilSpine)::DownCast(Sp);
|
||||
Handle(ChFiDS_ChamfSpine) CSpine = Handle(ChFiDS_ChamfSpine)::DownCast(Sp);
|
||||
#ifndef DEB
|
||||
Standard_Boolean surfok = Standard_False;
|
||||
#else
|
||||
Standard_Boolean surfok;
|
||||
#endif
|
||||
GeomAbs_SurfaceType typ1 = S1->GetType();
|
||||
GeomAbs_SurfaceType typ2 = S2->GetType();
|
||||
GeomAbs_CurveType ctyp;
|
||||
|
||||
if (!Spine.IsNull())
|
||||
ctyp = Spine->CurrentElementarySpine(Iedge).GetType();
|
||||
else
|
||||
ctyp = CSpine->CurrentElementarySpine(Iedge).GetType();
|
||||
|
||||
// Recuperation des orientations.
|
||||
TopAbs_Orientation OrFace1 = TopAbs_FORWARD, OrFace2 = TopAbs_FORWARD;
|
||||
Handle(BRepAdaptor_HSurface) HS = Handle(BRepAdaptor_HSurface)::DownCast(S1);
|
||||
if (!HS.IsNull()) OrFace1 = HS->ChangeSurface().Face().Orientation();
|
||||
HS = Handle(BRepAdaptor_HSurface)::DownCast(S2);
|
||||
if (!HS.IsNull()) OrFace2 = HS->ChangeSurface().Face().Orientation();
|
||||
|
||||
if(!Spine.IsNull()){
|
||||
Standard_Real Radius = Spine->Radius(Iedge);
|
||||
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),S2->Plane(),
|
||||
Or1,Or2,Radius,Spine->Line(),
|
||||
Wref,OrFace1);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
|
||||
if (ctyp == GeomAbs_Line)
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,Radius,Spine->Line(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
else
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,Radius,Spine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
|
||||
if (ctyp == GeomAbs_Line)
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,Radius,Spine->Line(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
else
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,Radius,Spine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),S2->Cone(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,Radius,Spine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S2->Plane(),S1->Cone(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,Radius,Spine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else{
|
||||
Standard_NotImplemented::Raise("cas particulier non ecrit");
|
||||
}
|
||||
}
|
||||
else if(!CSpine.IsNull()){
|
||||
if (CSpine->IsChamfer() == ChFiDS_Sym) {
|
||||
Standard_Real dis;
|
||||
CSpine->GetDist(dis);
|
||||
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Plane(),
|
||||
Or1,Or2,dis, dis,CSpine->Line(),
|
||||
Wref,OrFace1);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis,dis ,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis,dis,CSpine->Line(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis,dis,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis,dis,CSpine->Line(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cone(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis,dis,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cone(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis,dis,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else{
|
||||
Standard_NotImplemented::Raise("cas particulier non ecrit");
|
||||
}
|
||||
}
|
||||
else if (CSpine->IsChamfer() == ChFiDS_TwoDist) {
|
||||
Standard_Real dis1,dis2;
|
||||
CSpine->Dists(dis1,dis2);
|
||||
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Plane(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Line(),
|
||||
Wref,OrFace1);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Line(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis2,dis1,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis2,dis1,CSpine->Line(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cone(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cone(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis2,dis1,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else{
|
||||
Standard_NotImplemented::Raise("cas particulier non ecrit");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_Real dis, Angle;
|
||||
Standard_Boolean DisOnP;
|
||||
CSpine->GetDistAngle(dis, Angle, DisOnP);
|
||||
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S1->Plane(),S2->Plane(),
|
||||
Or1,Or2, dis, Angle, CSpine->Line(),
|
||||
Wref,OrFace1, DisOnP);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis, Angle, CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True, DisOnP);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2, dis, Angle, CSpine->Line(),
|
||||
Wref,OrFace1,Standard_True, DisOnP);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis, Angle, CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False, DisOnP);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis, Angle, CSpine->Line(),
|
||||
Wref,OrFace2,Standard_False, DisOnP);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S1->Plane(),S2->Cone(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2, dis, Angle, CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True, DisOnP);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S2->Plane(),S1->Cone(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1, dis, Angle, CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False, DisOnP);
|
||||
}
|
||||
else{
|
||||
Standard_NotImplemented::Raise("cas particulier non ecrit");
|
||||
}
|
||||
}
|
||||
}
|
||||
return surfok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeCorner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_ComputeData::ComputeCorner
|
||||
(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const TopAbs_Orientation OrFace1,
|
||||
const TopAbs_Orientation,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real minRad,
|
||||
const Standard_Real majRad,
|
||||
const gp_Pnt2d& P1S1,
|
||||
const gp_Pnt2d& P2S1,
|
||||
const gp_Pnt2d& P1S2,
|
||||
const gp_Pnt2d& P2S2)
|
||||
{
|
||||
Standard_Boolean surfok;
|
||||
GeomAbs_SurfaceType typ1 = S1->GetType();
|
||||
GeomAbs_SurfaceType typ2 = S2->GetType();
|
||||
if ( typ1 != GeomAbs_Plane ){
|
||||
Standard_ConstructionError::Raise
|
||||
("la face du conge torique doit etre plane");
|
||||
}
|
||||
// On calcule comme ligne guide le cercle correspondant
|
||||
// a la section de S2, et divers elements de construction.
|
||||
|
||||
gp_Cylinder cyl;
|
||||
gp_Circ circ;
|
||||
Standard_Real First,Last,fu,lu;
|
||||
ChFiKPart_CornerSpine(S1,S2,P1S1,P2S1,P1S2,P2S2,majRad,cyl,circ,First,Last);
|
||||
if ( typ2 == GeomAbs_Cylinder ){
|
||||
cyl = S2->Cylinder();
|
||||
fu = P1S2.X();
|
||||
lu = P2S2.X();
|
||||
}
|
||||
else{
|
||||
fu = First;
|
||||
lu = Last;
|
||||
}
|
||||
surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),cyl,
|
||||
fu,lu,Or1,Or2,minRad,circ,
|
||||
First,OrFace1,Standard_True);
|
||||
if(surfok){
|
||||
if ( typ2 != GeomAbs_Cylinder ){
|
||||
Data->ChangeInterferenceOnS2().ChangePCurveOnFace() =
|
||||
ChFiKPart_PCurve(P1S2,P2S2,First,Last);
|
||||
}
|
||||
Data->ChangeVertexFirstOnS1().SetPoint(S1->Value(P1S1.X(),P1S1.Y()));
|
||||
Data->ChangeVertexLastOnS1().SetPoint(S1->Value(P2S1.X(),P2S1.Y()));
|
||||
Data->ChangeVertexFirstOnS2().SetPoint(S2->Value(P1S2.X(),P1S2.Y()));
|
||||
Data->ChangeVertexLastOnS2().SetPoint(S2->Value(P2S2.X(),P2S2.Y()));
|
||||
Data->ChangeInterferenceOnS1().SetFirstParameter(First);
|
||||
Data->ChangeInterferenceOnS1().SetLastParameter(Last);
|
||||
Data->ChangeInterferenceOnS2().SetFirstParameter(First);
|
||||
Data->ChangeInterferenceOnS2().SetLastParameter(Last);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeCorner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_ComputeData::ComputeCorner
|
||||
(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const TopAbs_Orientation OrFace1,
|
||||
const TopAbs_Orientation OrFace2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Rad,
|
||||
const gp_Pnt2d& PS1,
|
||||
const gp_Pnt2d& P1S2,
|
||||
const gp_Pnt2d& P2S2)
|
||||
{
|
||||
return ChFiKPart_Sphere(DStr,Data,S1,S2,OrFace1,OrFace2,Or1,Or2,Rad,PS1,P1S2,P2S2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeCorner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_ComputeData::ComputeCorner
|
||||
(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const TopAbs_Orientation OfS,
|
||||
const TopAbs_Orientation OS,
|
||||
const TopAbs_Orientation OS1,
|
||||
const TopAbs_Orientation OS2,
|
||||
const Standard_Real Radius)
|
||||
{
|
||||
GeomAbs_SurfaceType typ = S->GetType();
|
||||
GeomAbs_SurfaceType typ1 = S1->GetType();
|
||||
GeomAbs_SurfaceType typ2 = S2->GetType();
|
||||
if (typ != GeomAbs_Plane ||
|
||||
typ1 != GeomAbs_Plane ||
|
||||
typ2 != GeomAbs_Plane){
|
||||
Standard_ConstructionError::Raise
|
||||
("rotule torique seulement entre des plans");
|
||||
}
|
||||
return ChFiKPart_MakeRotule(DStr,Data,S->Plane(),S1->Plane(),
|
||||
S2->Plane(),OS,OS1,OS2,Radius,OfS);
|
||||
}
|
59
src/ChFiKPart/ChFiKPart_ComputeData_CS.cxx
Executable file
59
src/ChFiKPart/ChFiKPart_ComputeData_CS.cxx
Executable file
@@ -0,0 +1,59 @@
|
||||
// File: ChFiKPart_ComputeData_CS.cxx
|
||||
// Created: Wed Apr 13 16:57:48 1994
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@phylox>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData_CS.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
|
||||
void ChFiKPart_CornerSpine(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const gp_Pnt2d& P1S1,
|
||||
const gp_Pnt2d& P2S1,
|
||||
const gp_Pnt2d& P1S2,
|
||||
const gp_Pnt2d& P2S2,
|
||||
const Standard_Real R,
|
||||
gp_Cylinder& cyl,
|
||||
gp_Circ& circ,
|
||||
Standard_Real& First,
|
||||
Standard_Real& Last)
|
||||
|
||||
{
|
||||
gp_Ax3 ax = S1->Plane().Position();
|
||||
gp_Vec V1(ax.XDirection());
|
||||
gp_Vec V2(ax.YDirection());
|
||||
gp_Pnt P;
|
||||
gp_Vec du,dv;
|
||||
S2->D1(P1S2.X(),P1S2.Y(),P,du,dv);
|
||||
gp_Vec V(P,S1->Value(P1S1.X(),P1S1.Y()));
|
||||
V = V.Dot(V1)*V1+V.Dot(V2)*V2;
|
||||
V.Normalize();
|
||||
gp_Pnt P2 = S2->Value(P2S2.X(),P2S2.Y());
|
||||
gp_Vec Vorien(P,P2);
|
||||
gp_Pnt cent;
|
||||
gp_Dir dx(V);
|
||||
if(V.Dot(Vorien) >= 0.){
|
||||
cent.SetCoord(P.X()+R*V.X(),P.Y()+R*V.Y(),P.Z()+R*V.Z());
|
||||
dx.Reverse();
|
||||
}
|
||||
else {
|
||||
cent.SetCoord(P.X()-R*V.X(),P.Y()-R*V.Y(),P.Z()-R*V.Z());
|
||||
}
|
||||
gp_Dir dy(gp_Vec(cent,P2));
|
||||
dy = (dx^dy)^dx;
|
||||
gp_Ax2 circax2(cent,dx^dy,dx);
|
||||
gp_Ax3 cylax3(circax2);
|
||||
if((du^dv).Dot(dx) < 0.) cylax3.ZReverse();
|
||||
First = 0.;
|
||||
Last = ElCLib::CircleParameter(circax2,P2);
|
||||
circ.SetPosition(circax2);
|
||||
circ.SetRadius(R);
|
||||
cyl.SetPosition(cylax3);
|
||||
cyl.SetRadius(R);
|
||||
}
|
28
src/ChFiKPart/ChFiKPart_ComputeData_CS.hxx
Executable file
28
src/ChFiKPart/ChFiKPart_ComputeData_CS.hxx
Executable file
@@ -0,0 +1,28 @@
|
||||
// File: ChFiKPart_ComputeData_CS.hxx
|
||||
// Created: Tue Jun 28 10:52:20 1994
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
|
||||
#ifndef ChFiKPart_ComputeData_CS_HeaderFile
|
||||
#define ChFiKPart_ComputeData_CS_HeaderFile
|
||||
|
||||
|
||||
void ChFiKPart_CornerSpine(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const gp_Pnt2d& P1S1,
|
||||
const gp_Pnt2d& P2S1,
|
||||
const gp_Pnt2d& P1S2,
|
||||
const gp_Pnt2d& P2S2,
|
||||
const Standard_Real R,
|
||||
gp_Cylinder& cyl,
|
||||
gp_Circ& circ,
|
||||
Standard_Real& First,
|
||||
Standard_Real& Last);
|
||||
|
||||
|
||||
#endif
|
559
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCon.cxx
Executable file
559
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCon.cxx
Executable file
@@ -0,0 +1,559 @@
|
||||
// File: ChFiKPart_ComputeData_ChAsymPlnCon.cxx
|
||||
// Created: Thu Jun 18 09:30:15 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// <pne@cleox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChAsym
|
||||
//purpose : Compute the chamfer in the particular case Plane/Cone or
|
||||
// Cylinder/Plane
|
||||
// Compute the SurfData <Data> of the chamfer build on the <Spine>
|
||||
// between the plane <Pln> and the cone <Con>, with the
|
||||
// distances <Dis1> on <Pln> and <Dis2> on <Con>.
|
||||
// <Or1> and <Or2> are the orientations of <Pln> and <Con>
|
||||
// and <Ofpl> this of the face carried by <Pln>.
|
||||
// <First> is the start point on the <Spine>
|
||||
// <Plandab> is equal to True if the plane is the surface S1
|
||||
// <fu> and <lu> are the first and last u parameters of the
|
||||
// cone
|
||||
//out : True if the chanfer has been computed
|
||||
// False else
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab,
|
||||
const Standard_Boolean DisOnP)
|
||||
{
|
||||
// Compute the chamfer surface(cone)
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
gp_Dir norf = Dpl;
|
||||
if (Ofpl == TopAbs_REVERSED ) norf.Reverse();
|
||||
if ( Or1 == TopAbs_REVERSED ) Dpl.Reverse();
|
||||
|
||||
// compute the origin of the conical chamfer PtPl
|
||||
gp_Pnt Or = Con.Location();
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(PosPl,Or,u,v);
|
||||
gp_Pnt2d pt2dPln(u,v);
|
||||
ElSLib::PlaneD0(u,v,PosPl,Or);
|
||||
gp_Pnt PtPl = Or;
|
||||
|
||||
gp_Pnt PtSp;
|
||||
gp_Vec DSp;
|
||||
ElCLib::D1(First,Spine,PtSp,DSp);
|
||||
gp_Dir Dx(gp_Vec(PtPl,PtSp));
|
||||
|
||||
//compute the normal to the cone in PtSp
|
||||
gp_Vec deru,derv;
|
||||
gp_Pnt PtCon;
|
||||
ElSLib::Parameters(Con,PtSp,u,v);
|
||||
ElSLib::D1(u,v,Con,PtCon ,deru,derv);
|
||||
gp_Dir Dcon( deru.Crossed(derv) );
|
||||
if ( Or2 == TopAbs_REVERSED ) Dcon.Reverse();
|
||||
|
||||
Standard_Boolean dedans = ( Dx.Dot(Dcon) <= 0.);
|
||||
Standard_Boolean ouvert = ( Dpl.Dot(Dcon) >= 0.);
|
||||
|
||||
// variables used to compute the semiangle of the chamfer
|
||||
Standard_Real angCon = Con.SemiAngle();
|
||||
Standard_Real move;
|
||||
Standard_Real ChamfRad,SemiAngl;
|
||||
Standard_Boolean pointu = Standard_False;
|
||||
Standard_Real dis;
|
||||
Standard_Boolean iscylinder = Standard_False;
|
||||
Standard_Boolean isConPar = Standard_False;
|
||||
|
||||
if ( (plandab && DisOnP) || (!plandab && !DisOnP) ) {
|
||||
Standard_Real tgang = Tan(Angle), Dis11;
|
||||
Standard_Real tgCon = Abs(Tan(angCon));
|
||||
if (ouvert) {
|
||||
move = Dis * tgang / (1. - tgCon * tgang);
|
||||
Dis11 = move * tgCon;
|
||||
dis = Dis + Dis11;
|
||||
}
|
||||
else {
|
||||
move = Dis * tgang / (1. + tgCon * tgang);
|
||||
Dis11 = move * tgCon;
|
||||
dis = Dis - Dis11;
|
||||
}
|
||||
|
||||
// compute the parameters of the conical chamfer
|
||||
if (dedans) {
|
||||
ChamfRad = Spine.Radius() - Dis;
|
||||
if ( Abs(ChamfRad) < Precision::Confusion() ) pointu = Standard_True;
|
||||
if( ChamfRad < 0 ) {
|
||||
#ifdef DEB
|
||||
cout<<"le chanfrein ne passe pas"<<endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
SemiAngl = PI / 2. - Angle;
|
||||
}
|
||||
else {
|
||||
ChamfRad = Spine.Radius() + Dis;
|
||||
SemiAngl = Angle - PI / 2.;
|
||||
}
|
||||
|
||||
if (ouvert) {
|
||||
if (Abs(angCon) - Abs(SemiAngl) > -Precision::Confusion() ) {
|
||||
cout<<"mauvais choix d'angle pour le chanfrein"<<endl;
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_Real Dis1;
|
||||
move = Dis * Cos(angCon);
|
||||
if (ouvert) {
|
||||
SemiAngl = Abs(angCon) + Angle;
|
||||
|
||||
if ( (PI / 2. - SemiAngl) < Precision::Confusion() ) {
|
||||
cout <<"mauvais choix d'angle pour le chanfrein"<<endl;
|
||||
return Standard_False;
|
||||
}
|
||||
Dis1 = move * Tan(SemiAngl) - Dis * Abs(Sin(angCon));
|
||||
|
||||
if (!dedans) SemiAngl = -SemiAngl;
|
||||
|
||||
}
|
||||
else {
|
||||
SemiAngl = Abs(angCon) - Angle;
|
||||
|
||||
if ( Abs(SemiAngl) < Precision::Confusion() ) {
|
||||
iscylinder = Standard_True;
|
||||
Dis1 = Dis * Abs(Sin(angCon));
|
||||
}
|
||||
else {
|
||||
Dis1 = Dis * Abs(Sin(angCon)) - move * Tan(SemiAngl);
|
||||
}
|
||||
|
||||
if (SemiAngl > Precision::Confusion())
|
||||
isConPar = Standard_True;
|
||||
|
||||
if (dedans) SemiAngl = -SemiAngl;
|
||||
|
||||
}
|
||||
|
||||
// compute the parameters of the conical chamfer
|
||||
if (dedans) {
|
||||
ChamfRad = Spine.Radius() - Dis1;
|
||||
|
||||
if ( Abs(ChamfRad) < Precision::Confusion() ) pointu = Standard_True;
|
||||
if( ChamfRad < 0 ) {
|
||||
#ifdef DEB
|
||||
cout<<"le chanfrein ne passe pas"<<endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ChamfRad = Spine.Radius() + Dis1;
|
||||
//Dpl.Reverse();
|
||||
}
|
||||
|
||||
if (ouvert)
|
||||
dis = Dis1 + Dis * Abs(Sin(angCon));
|
||||
else
|
||||
dis = Dis1 - Dis * Abs(Sin(angCon));
|
||||
}
|
||||
|
||||
Or.SetCoord( Or.X()+ move*Dpl.X(),
|
||||
Or.Y()+ move*Dpl.Y(),
|
||||
Or.Z()+ move*Dpl.Z());
|
||||
gp_Pnt Pt(Or.X()+dis*PosPl.XDirection().X(),
|
||||
Or.Y()+dis*PosPl.XDirection().Y(),
|
||||
Or.Z()+dis*PosPl.XDirection().Z());
|
||||
|
||||
gp_Ax3 ChamfAx3(PtPl,Dpl,Dx);
|
||||
|
||||
|
||||
if (iscylinder) {
|
||||
Handle (Geom_CylindricalSurface)
|
||||
gcyl = new Geom_CylindricalSurface( ChamfAx3, ChamfRad );
|
||||
|
||||
// changes due to the fact the parameters of the chamfer must go increasing
|
||||
// from surface S1 to surface S2
|
||||
if (!plandab) {
|
||||
gcyl->VReverse();// be carefull : the SemiAngle was changed
|
||||
ChamfAx3 = gcyl->Position();
|
||||
}
|
||||
|
||||
// changes due to the fact we have reversed the V direction of
|
||||
// parametrization
|
||||
if (ChamfAx3.YDirection().Dot(DSp) <= 0.) {
|
||||
ChamfAx3.YReverse();
|
||||
gcyl->SetPosition(ChamfAx3);
|
||||
}
|
||||
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gcyl,DStr));
|
||||
|
||||
Standard_Boolean torevcha = !ChamfAx3.Direct();
|
||||
gp_Dir cylaxe = (ChamfAx3.Axis()).Direction();
|
||||
torevcha = ( (torevcha && !plandab) || (!torevcha && plandab));
|
||||
|
||||
if (torevcha) cylaxe.Reverse();
|
||||
Standard_Boolean toreverse = (norf.Dot(cylaxe) < 0.);
|
||||
|
||||
if ((toreverse && dedans) || (!toreverse && !dedans))
|
||||
Data->ChangeOrientation() = TopAbs_REVERSED;
|
||||
else
|
||||
Data->ChangeOrientation() = TopAbs_FORWARD;
|
||||
|
||||
//we load the faceInterference with the pcurves and
|
||||
// the 3d curves
|
||||
|
||||
// Case of the plane face
|
||||
// NB: in the case 'pointu', no pcurve on the plane surface
|
||||
// and no intersection plane-chamfer are needed
|
||||
|
||||
// intersection plane-chamfer
|
||||
Handle(Geom_Circle) GCirPln;
|
||||
Handle(Geom2d_Circle) GCir2dPln;
|
||||
gp_Ax2 CirAx2 = ChamfAx3.Ax2();
|
||||
CirAx2.SetLocation(PtPl);
|
||||
|
||||
Pt.SetCoord(PtPl.X()+ChamfRad*Dx.X(),
|
||||
PtPl.Y()+ChamfRad*Dx.Y(),
|
||||
PtPl.Z()+ChamfRad*Dx.Z());
|
||||
gp_Circ CirPln(CirAx2,ChamfRad);
|
||||
GCirPln = new Geom_Circle(CirPln);
|
||||
|
||||
//pcurve on the plane
|
||||
ElSLib::PlaneParameters(PosPl,Pt ,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d d2d(DSp.Dot(PosPl.XDirection()),DSp.Dot(PosPl.YDirection()));
|
||||
gp_Ax22d ax2dPln(pt2dPln, gp_Dir2d(gp_Vec2d(pt2dPln,p2dPln)),d2d);
|
||||
gp_Circ2d cir2dPln(ax2dPln,ChamfRad);
|
||||
GCir2dPln = new Geom2d_Circle(cir2dPln);
|
||||
|
||||
//pcurve on chamfer
|
||||
gp_Pnt2d p2dch;
|
||||
p2dch.SetCoord(0.,0.);
|
||||
// ElSLib::CylinderD1(0.,0.,ChamfAx3,ChamfRad,Pt,deru,derv);
|
||||
gp_Lin2d lin2dch(p2dch,gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dCh1 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//orientation
|
||||
TopAbs_Orientation trans;
|
||||
gp_Dir norpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
toreverse = (norpl.Dot(cylaxe) < 0.);
|
||||
|
||||
toreverse = (toreverse && plandab) || (!toreverse && !plandab);
|
||||
|
||||
if ((toreverse && dedans) || (!toreverse && !dedans)) {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
|
||||
if (plandab) {
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
else {
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
|
||||
// Case of the conical face
|
||||
|
||||
//intersection cone-chamfer
|
||||
Standard_Real Rad;
|
||||
if (dedans)
|
||||
Rad = ChamfRad + dis;
|
||||
else
|
||||
Rad = ChamfRad - dis;
|
||||
|
||||
CirAx2.SetLocation(Or);
|
||||
gp_Circ CirCon(CirAx2, Rad);
|
||||
Handle(Geom_Circle) GCirCon = new Geom_Circle(CirCon);
|
||||
|
||||
//pcurve on chamfer
|
||||
if (plandab)
|
||||
v = sqrt(dis*dis + move*move);
|
||||
else
|
||||
v = - sqrt(dis*dis + move*move);
|
||||
p2dch.SetCoord(0.,v);
|
||||
ElSLib::CylinderD1(0.,v,ChamfAx3,ChamfRad,Pt,deru,derv);
|
||||
lin2dch.SetLocation(p2dch);
|
||||
Handle(Geom2d_Line) GLin2dCh2 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//pcurve on cone
|
||||
Pt.SetCoord(Or.X()+Rad*Dx.X(),
|
||||
Or.Y()+Rad*Dx.Y(),
|
||||
Or.Z()+Rad*Dx.Z());
|
||||
ElSLib::Parameters(Con,Pt ,u,v);
|
||||
Standard_Real tol = Precision::PConfusion();
|
||||
if(u >= 2*PI - tol && u <= 2*PI) u = 0.;
|
||||
if(u >= fu - tol && u < fu) u = fu;
|
||||
if(u <= lu + tol && u > lu) u = lu;
|
||||
if(u < fu || u > lu) u = ElCLib::InPeriod(u,fu,fu + 2*PI);
|
||||
ElSLib::D1(u,v,Con,Pt,deru,derv);
|
||||
gp_Pnt2d p2dCon(u,v);
|
||||
gp_Dir2d d2dCon;
|
||||
if ( deru.Dot(DSp)<=0. )
|
||||
d2dCon = - gp::DX2d();
|
||||
else
|
||||
d2dCon = gp::DX2d();
|
||||
gp_Lin2d lin2dCon(p2dCon,d2dCon);
|
||||
Handle(Geom2d_Line) GLin2dCon = new Geom2d_Line(lin2dCon);
|
||||
|
||||
//orientation
|
||||
gp_Dir norcon = deru.Crossed(derv);
|
||||
|
||||
gp_Dir DirCon = (Con.Axis()).Direction();
|
||||
if (angCon > Precision::Confusion()) DirCon.Reverse();
|
||||
Standard_Boolean torevcon = ( norcon.Dot(DirCon) < 0. );
|
||||
|
||||
if ((torevcon && dedans) || (!torevcon && !dedans) ) {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCon,DStr),
|
||||
trans,GLin2dCon,GLin2dCh2);
|
||||
}
|
||||
else {
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCon,DStr),
|
||||
trans,GLin2dCon,GLin2dCh2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle (Geom_ConicalSurface)
|
||||
gcon = new Geom_ConicalSurface( ChamfAx3, SemiAngl, ChamfRad );
|
||||
|
||||
// changes due to the fact the parameters of the chamfer must go increasing
|
||||
// from surface S1 to surface S2
|
||||
if (!plandab) {
|
||||
gcon->VReverse();// be carefull : the SemiAngle was changed
|
||||
ChamfAx3 = gcon->Position();
|
||||
SemiAngl = gcon->SemiAngle();
|
||||
}
|
||||
|
||||
// changes due to the fact we have reversed the V direction of
|
||||
// parametrization
|
||||
if (ChamfAx3.YDirection().Dot(DSp) <= 0.) {
|
||||
ChamfAx3.YReverse();
|
||||
gcon->SetPosition(ChamfAx3);
|
||||
}
|
||||
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gcon,DStr));
|
||||
|
||||
//compute the chamfer's orientation according to the orientation
|
||||
// of the faces
|
||||
|
||||
//search the normal to the conical chamfer
|
||||
gp_Pnt P;
|
||||
u = 0.;
|
||||
if (plandab)
|
||||
v = sqrt(dis*dis + move*move);
|
||||
else
|
||||
v = - sqrt(dis*dis + move*move);
|
||||
|
||||
ElSLib::ConeD1(u,v,ChamfAx3,ChamfRad,SemiAngl,P,deru,derv);
|
||||
gp_Dir norchamf(deru.Crossed(derv));
|
||||
|
||||
Standard_Boolean toreverse = (norf.Dot(norchamf) < 0.);
|
||||
|
||||
if (isConPar) toreverse = !toreverse;
|
||||
|
||||
if (toreverse)
|
||||
Data->ChangeOrientation() = TopAbs_REVERSED;
|
||||
else
|
||||
Data->ChangeOrientation() = TopAbs_FORWARD;
|
||||
|
||||
//we load the faceInterference with the pcurves and
|
||||
// the 3d curves
|
||||
|
||||
// Case of the plane face
|
||||
// NB: in the case 'pointu', no pcurve on the plane surface
|
||||
// and no intersection plane-chamfer are needed
|
||||
|
||||
// intersection plane-chamfer
|
||||
Handle(Geom_Circle) GCirPln;
|
||||
Handle(Geom2d_Circle) GCir2dPln;
|
||||
gp_Ax2 CirAx2 = ChamfAx3.Ax2();
|
||||
CirAx2.SetLocation(PtPl);
|
||||
|
||||
if (!pointu) {
|
||||
Pt.SetCoord(PtPl.X()+ChamfRad*Dx.X(),
|
||||
PtPl.Y()+ChamfRad*Dx.Y(),
|
||||
PtPl.Z()+ChamfRad*Dx.Z());
|
||||
gp_Circ CirPln(CirAx2,ChamfRad);
|
||||
GCirPln = new Geom_Circle(CirPln);
|
||||
|
||||
//pcurve on the plane
|
||||
ElSLib::PlaneParameters(PosPl,Pt ,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d d2d(DSp.Dot(PosPl.XDirection()),DSp.Dot(PosPl.YDirection()));
|
||||
gp_Ax22d ax2dPln(pt2dPln, gp_Dir2d(gp_Vec2d(pt2dPln,p2dPln)),d2d);
|
||||
gp_Circ2d cir2dPln(ax2dPln,ChamfRad);
|
||||
GCir2dPln = new Geom2d_Circle(cir2dPln);
|
||||
}
|
||||
|
||||
//pcurve on chamfer
|
||||
gp_Pnt2d p2dch;
|
||||
p2dch.SetCoord(0.,0.);
|
||||
ElSLib::ConeD1(0.,0.,ChamfAx3,ChamfRad,SemiAngl,Pt,deru,derv);
|
||||
gp_Lin2d lin2dch(p2dch,gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dCh1 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//orientation
|
||||
TopAbs_Orientation trans;
|
||||
gp_Dir norpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
if (!pointu)
|
||||
norchamf.SetXYZ (deru.Crossed(derv).XYZ());
|
||||
toreverse = ( norchamf.Dot(norpl) <= 0. );
|
||||
|
||||
if (isConPar) toreverse = !toreverse;
|
||||
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab)){
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
|
||||
if (plandab) {
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
else {
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
|
||||
// Case of the conical face
|
||||
|
||||
//intersection cone-chamfer
|
||||
Standard_Real Rad;
|
||||
if (dedans)
|
||||
Rad = ChamfRad + dis;
|
||||
else
|
||||
Rad = ChamfRad - dis;
|
||||
|
||||
CirAx2.SetLocation(Or);
|
||||
gp_Circ CirCon(CirAx2, Rad);
|
||||
Handle(Geom_Circle) GCirCon = new Geom_Circle(CirCon);
|
||||
|
||||
//pcurve on chamfer
|
||||
if (plandab)
|
||||
v = sqrt(dis*dis + move*move);
|
||||
else
|
||||
v = - sqrt(dis*dis + move*move);
|
||||
p2dch.SetCoord(0.,v);
|
||||
ElSLib::ConeD1(0.,v,ChamfAx3,ChamfRad,SemiAngl,Pt,deru,derv);
|
||||
lin2dch.SetLocation(p2dch);
|
||||
Handle(Geom2d_Line) GLin2dCh2 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//pcurve on cone
|
||||
norchamf.SetXYZ (deru.Crossed(derv).XYZ());
|
||||
|
||||
Pt.SetCoord(Or.X()+Rad*Dx.X(),
|
||||
Or.Y()+Rad*Dx.Y(),
|
||||
Or.Z()+Rad*Dx.Z());
|
||||
ElSLib::Parameters(Con,Pt ,u,v);
|
||||
Standard_Real tol = Precision::PConfusion();
|
||||
if (u >= 2*PI - tol && u <= 2*PI) u = 0.;
|
||||
if (u >= fu - tol && u < fu) u = fu;
|
||||
if (u <= lu + tol && u > lu) u = lu;
|
||||
if (u < fu || u > lu) u = ElCLib::InPeriod(u,fu,fu + 2*PI);
|
||||
ElSLib::D1(u,v,Con,Pt,deru,derv);
|
||||
gp_Pnt2d p2dCon(u,v);
|
||||
gp_Dir2d d2dCon;
|
||||
if ( deru.Dot(DSp)<=0. )
|
||||
d2dCon = - gp::DX2d();
|
||||
else
|
||||
d2dCon = gp::DX2d();
|
||||
gp_Lin2d lin2dCon(p2dCon,d2dCon);
|
||||
Handle(Geom2d_Line) GLin2dCon = new Geom2d_Line(lin2dCon);
|
||||
|
||||
//orientation
|
||||
gp_Dir norcon = deru.Crossed(derv);
|
||||
|
||||
gp_Dir DirCon = (Con.Axis()).Direction();
|
||||
gp_Dir DirChamf = (gcon->Axis()).Direction();
|
||||
if (angCon > Precision::Confusion()) DirCon.Reverse();
|
||||
if (SemiAngl > Precision::Confusion()) DirChamf.Reverse();
|
||||
|
||||
Standard_Boolean torevcon = ( norcon.Dot(DirCon) > 0. );
|
||||
Standard_Boolean torevcha = ( norchamf.Dot(DirChamf) > 0. );
|
||||
|
||||
toreverse = ( (torevcon && !torevcha) || (!torevcon && torevcha) );
|
||||
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ) {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCon,DStr),
|
||||
trans,GLin2dCon,GLin2dCh2);
|
||||
}
|
||||
else {
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCon,DStr),
|
||||
trans,GLin2dCon,GLin2dCh2);
|
||||
}
|
||||
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
26
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCon.hxx
Executable file
26
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCon.hxx
Executable file
@@ -0,0 +1,26 @@
|
||||
// File: ChFiKPart_ComputeData_ChAsymPlnCon.hxx
|
||||
// Created: Thu Jun 18 09:32:08 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// <pne@cleox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_ChAsymPlnCon_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_ChAsymPlnCon_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab,
|
||||
const Standard_Boolean DisOnP);
|
||||
|
||||
#endif
|
561
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCyl.cxx
Executable file
561
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCyl.cxx
Executable file
@@ -0,0 +1,561 @@
|
||||
// File: ChFiKPart_ComputeData_ChAsymPlnCyl.cxx
|
||||
// Created: Tue Jun 16 11:22:58 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// <pne@cleox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
|
||||
//pour tester
|
||||
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChAsym
|
||||
//purpose : Compute the chamfer in the particular case Plane/Cylinder
|
||||
// or Cylinder/Plane
|
||||
// Compute the SurfData <Data> of the chamfer build on the <Spine>
|
||||
// between the plane <Pln> and the cylinder <Cyl>, with the
|
||||
// distances <Dis> and <Angle> on <Pln> on <Cyl>.
|
||||
// <Or1> and <Or2> are the orientations of <Pln> and <Cyl>
|
||||
// and <Ofpl> this of the face carried by <Pln>.
|
||||
// <First> is the start point on the <Spine>
|
||||
// <Plandab> is equal to True if the plane is the surface S1
|
||||
// <fu> and <lu> are the first and last u parameters of the
|
||||
// cylinder
|
||||
// DisOnPlan is equal to True if Dis on plan, else False
|
||||
//out : True if the chanfer has been computed
|
||||
// False else
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab,
|
||||
const Standard_Boolean DisOnP)
|
||||
{
|
||||
// compute the chamfer surface(cone)
|
||||
|
||||
// compute the normals to the plane surface & to the plane face
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
gp_Dir norf = Dpl;
|
||||
if ( Ofpl == TopAbs_REVERSED) norf.Reverse();
|
||||
if (Or1 == TopAbs_REVERSED) Dpl.Reverse();
|
||||
|
||||
// compute the origin Or of the cone
|
||||
gp_Pnt Or = Cyl.Location();
|
||||
Standard_Real u, v;
|
||||
ElSLib::PlaneParameters(PosPl, Or, u, v);
|
||||
gp_Pnt2d pt2dPln(u, v);
|
||||
ElSLib::PlaneD0(u, v, PosPl, Or);
|
||||
gp_Pnt PtPl = Or; // projection of the cylinder origin
|
||||
//on the plane
|
||||
|
||||
gp_Pnt PtSp;//start 3d point on the Spine
|
||||
gp_Vec DSp; //tangent vector to the spine on PtSp
|
||||
ElCLib::D1(First, Spine, PtSp, DSp);
|
||||
gp_Dir Dx(gp_Vec(Or, PtSp));
|
||||
gp_Dir Dy(DSp);
|
||||
ElSLib::Parameters(Cyl, PtSp, u, v);
|
||||
gp_Pnt PtCyl;//point on the cylinder and on the Spine
|
||||
gp_Vec Vu, Vv;
|
||||
ElSLib::D1(u, v, Cyl, PtCyl, Vu, Vv);
|
||||
gp_Dir Dcyl(Vu.Crossed(Vv));//normal to the cylinder in PtSp
|
||||
if (Or2 == TopAbs_REVERSED) Dcyl.Reverse();
|
||||
Standard_Boolean dedans = ( Dcyl.Dot(Dx) <= 0.);
|
||||
|
||||
Standard_Boolean pointu = Standard_False;
|
||||
Standard_Real ConRad, Rad, SemiAngl;
|
||||
|
||||
//Calcul des distance
|
||||
Standard_Real dis1, dis2, cosNPCyl, sinNPCyl;
|
||||
|
||||
if ( (plandab && DisOnP) || (!plandab && !DisOnP) ) {
|
||||
dis1 = Dis;
|
||||
cosNPCyl = Dpl.Dot(Dcyl);
|
||||
sinNPCyl = sqrt(1. - cosNPCyl * cosNPCyl);
|
||||
dis2 = Dis / (sinNPCyl / tan(Angle) - cosNPCyl);
|
||||
}
|
||||
else {
|
||||
dis2 = Dis;
|
||||
cosNPCyl = Dpl.Dot(Dcyl);
|
||||
sinNPCyl = sqrt(1. - cosNPCyl * cosNPCyl);
|
||||
dis1 = Dis / (sinNPCyl / tan(Angle) - cosNPCyl);
|
||||
}
|
||||
|
||||
Or.SetCoord(Or.X() + dis2 * Dpl.X(),
|
||||
Or.Y() + dis2 * Dpl.Y(),
|
||||
Or.Z() + dis2 * Dpl.Z());
|
||||
|
||||
// variables used to compute the semiangle of the cone
|
||||
gp_Dir Vec1(Or.X() - PtPl.X(), Or.Y() - PtPl.Y(), Or.Z() - PtPl.Z());
|
||||
gp_Pnt Pt(Or.X() + dis1*PosPl.XDirection().X(),
|
||||
Or.Y() + dis1*PosPl.XDirection().Y(),
|
||||
Or.Z() + dis1*PosPl.XDirection().Z());
|
||||
gp_Dir Vec2( Pt.X() - PtPl.X(), Pt.Y() - PtPl.Y(), Pt.Z() - PtPl.Z());
|
||||
|
||||
// compute the parameters of the conical surface
|
||||
if (dedans) {
|
||||
Rad = Cyl.Radius() - dis1;
|
||||
if ( Abs(Rad) <= Precision::Confusion() ) pointu = Standard_True;
|
||||
if(Rad < 0 ) {
|
||||
cout<<"le chanfrein ne passe pas"<<endl;
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Rad = Cyl.Radius() + dis1;
|
||||
gp_Dir Dplr = Dpl.Reversed();
|
||||
Dpl = Dplr;
|
||||
}
|
||||
ConRad = Cyl.Radius();
|
||||
SemiAngl = Vec1.Angle(Vec2);
|
||||
gp_Ax3 ConAx3(Or, Dpl, Dx);
|
||||
|
||||
Handle (Geom_ConicalSurface)
|
||||
gcon = new Geom_ConicalSurface( ConAx3, SemiAngl, ConRad );
|
||||
|
||||
// changes due to the fact the parameters of the chamfer must go increasing
|
||||
// from surface S1 to surface S2
|
||||
if ( (dedans && !plandab) || (!dedans && plandab) ) {
|
||||
gcon->VReverse();// be carefull : the SemiAngle was changed
|
||||
ConAx3 = gcon->Position();
|
||||
SemiAngl = gcon->SemiAngle();
|
||||
}
|
||||
|
||||
// changes due to the fact we have reversed the V direction of
|
||||
// parametrization
|
||||
if (ConAx3.YDirection().Dot(DSp) <= 0.) {
|
||||
ConAx3.YReverse();
|
||||
gcon->SetPosition(ConAx3);
|
||||
}
|
||||
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gcon, DStr));
|
||||
|
||||
// compute the chamfer's orientation according to the orientation
|
||||
// of the faces
|
||||
|
||||
//search the normal to the cone
|
||||
gp_Vec deru, derv;
|
||||
ElSLib::ConeD1(0., 0., ConAx3, ConRad, SemiAngl, Pt, deru, derv);
|
||||
|
||||
gp_Dir norCon(deru.Crossed(derv));
|
||||
|
||||
Standard_Boolean toreverse = ( norCon.Dot(norf) <= 0.);
|
||||
if (toreverse) {
|
||||
Data->ChangeOrientation() = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
Data->ChangeOrientation() = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
//we load of the faceInterference with the pcurves and
|
||||
// the 3d curves
|
||||
|
||||
// Case of the plane face
|
||||
// NB: in the case 'pointu', no pcurve on the plane surface
|
||||
// and no intersection plane-chamfer are needed
|
||||
Handle(Geom2d_Circle) GCir2dPln;
|
||||
Handle(Geom_Circle) GCirPln;
|
||||
gp_Ax2 CirAx2 = ConAx3.Ax2();
|
||||
CirAx2.SetLocation(PtPl);
|
||||
|
||||
if (!pointu) {
|
||||
// intersection plane-chamfer
|
||||
gp_Circ CirPln(CirAx2, Rad);
|
||||
GCirPln = new Geom_Circle(CirPln);
|
||||
|
||||
//pcurve on the plane
|
||||
ElSLib::PlaneParameters(PosPl, Pt, u, v);
|
||||
gp_Pnt2d p2dPln(u, v);
|
||||
gp_Dir2d d2d(DSp.Dot(PosPl.XDirection()), DSp.Dot(PosPl.YDirection()));
|
||||
gp_Ax22d ax2dPln(pt2dPln, gp_Dir2d(gp_Vec2d(pt2dPln, p2dPln)), d2d);
|
||||
gp_Circ2d cir2dPln(ax2dPln, Rad);
|
||||
GCir2dPln = new Geom2d_Circle(cir2dPln);
|
||||
}
|
||||
|
||||
//pcurve on the chamfer
|
||||
gp_Pnt2d p2dch;
|
||||
if (plandab)
|
||||
v= -sqrt(dis1 * dis1 + dis2 * dis2);
|
||||
else
|
||||
v = sqrt(dis1 * dis1 + dis2 * dis2);
|
||||
p2dch.SetCoord(0., v);
|
||||
ElSLib::ConeD1(0., v, ConAx3, ConRad, SemiAngl, Pt, deru, derv);
|
||||
gp_Lin2d lin2dch(p2dch, gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dCh1 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//orientation
|
||||
TopAbs_Orientation trans;
|
||||
gp_Dir norpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
toreverse = ( norCon.Dot(norpl) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab)){
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln, DStr),
|
||||
trans, GCir2dPln, GLin2dCh1);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln, DStr),
|
||||
trans,GCir2dPln, GLin2dCh1);
|
||||
}
|
||||
|
||||
// Case of the cylindrical face
|
||||
|
||||
//intersection cylinder-chamfer
|
||||
CirAx2.SetLocation(Or);
|
||||
gp_Circ CirCyl(CirAx2, ConRad);
|
||||
Handle(Geom_Circle) GCirCyl = new Geom_Circle(CirCyl);
|
||||
|
||||
//pcurve on the chamfer
|
||||
p2dch.SetCoord(0., 0.);
|
||||
ElSLib::ConeD1(0., 0., ConAx3, ConRad, SemiAngl, Pt, deru, derv);
|
||||
lin2dch.SetLocation(p2dch);
|
||||
Handle(Geom2d_Line) GLin2dCh2 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//pcurve on the cylinder
|
||||
norCon.SetXYZ (deru.Crossed(derv).XYZ());
|
||||
|
||||
Pt.SetCoord(Or.X() + ConRad * Dx.X(),
|
||||
Or.Y() + ConRad * Dx.Y(),
|
||||
Or.Z() + ConRad * Dx.Z());
|
||||
ElSLib::Parameters(Cyl, Pt ,u, v);
|
||||
Standard_Real tol = Precision::PConfusion();
|
||||
Standard_Boolean careaboutsens = 0;
|
||||
if(Abs(lu - fu - 2 * PI) < tol) careaboutsens = 1;
|
||||
if(u >= fu - tol && u < fu) u = fu;
|
||||
if(u <= lu + tol && u > lu) u = lu;
|
||||
if(u < fu || u > lu) u = ChFiKPart_InPeriod(u, fu, fu + 2 * PI, tol);
|
||||
|
||||
ElSLib::D1(u, v, Cyl, Pt, deru, derv);
|
||||
gp_Dir norcyl = deru.Crossed(derv);
|
||||
gp_Dir2d d2dCyl = gp::DX2d();
|
||||
if( deru.Dot(Dy) < 0. ){
|
||||
d2dCyl.Reverse();
|
||||
if(careaboutsens && Abs(fu - u)<tol) u = lu;
|
||||
}
|
||||
else if(careaboutsens && Abs(lu - u)<tol) u = fu;
|
||||
gp_Pnt2d p2dCyl(u, v);
|
||||
gp_Lin2d lin2dCyl(p2dCyl, d2dCyl);
|
||||
Handle(Geom2d_Line) GLin2dCyl = new Geom2d_Line(lin2dCyl);
|
||||
|
||||
//orientation
|
||||
toreverse = ( norCon.Dot(norcyl) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ) {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCyl, DStr),
|
||||
trans, GLin2dCyl, GLin2dCh2);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCyl, DStr),
|
||||
trans, GLin2dCyl, GLin2dCh2);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChAsym
|
||||
//purpose : cas cylindre/plan ou plan/cylindre.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab,
|
||||
const Standard_Boolean DisOnP)
|
||||
{
|
||||
// calcul du conge plan.
|
||||
// or1 et or2 permettent de determiner dans lequel des 4 cotes crees par
|
||||
// l'intersection des 2 surfaces_on est
|
||||
// _|_ et Ofpl qui est l'orientation de la face du plan permettant
|
||||
// |4 de determiner le cote de la matiere
|
||||
|
||||
gp_Pnt OrSpine = ElCLib::Value(First, Spine);
|
||||
gp_Pnt POnCyl, POnPln, OrCyl;
|
||||
|
||||
gp_Dir XDir = Spine.Direction();
|
||||
gp_Ax3 AxPln = Pln.Position();
|
||||
gp_Dir NorPln = AxPln.XDirection().Crossed(AxPln.YDirection());
|
||||
gp_Dir NorF(NorPln);
|
||||
if (Or1 == TopAbs_REVERSED)
|
||||
{NorF.Reverse();}
|
||||
|
||||
gp_Ax3 AxCyl = Cyl.Position();
|
||||
// OrCyl est le point sur l'axe du cylindre dans le plan normal a l'axe
|
||||
// contenant OrSpine
|
||||
gp_Pnt Loc = AxCyl.Location();
|
||||
gp_Vec LocSp(Loc, OrSpine);
|
||||
gp_XYZ temp = AxCyl.Direction().XYZ();
|
||||
temp = temp.Multiplied(LocSp.XYZ().Multiplied(temp) );
|
||||
OrCyl.SetXYZ( (Loc.XYZ()).Added(temp) );
|
||||
|
||||
//construction de POnPln
|
||||
gp_Vec VecTranslPln,tmp;
|
||||
|
||||
tmp = gp_Vec(OrSpine,OrCyl);
|
||||
if ((Or2 == TopAbs_FORWARD && Cyl.Direct()) ||
|
||||
(Or2 == TopAbs_REVERSED && !Cyl.Direct()))
|
||||
{tmp.Reverse();}
|
||||
|
||||
VecTranslPln = gp_Vec( XDir.Crossed(NorPln) );
|
||||
if( VecTranslPln.Dot(tmp) <= 0. )
|
||||
{VecTranslPln.Reverse();}
|
||||
|
||||
gp_Vec VecTranslCyl;
|
||||
VecTranslCyl = gp_Vec(OrSpine,OrCyl);
|
||||
|
||||
// Calcul des distances dis1 et dis2, en fonction de Dis et Angle
|
||||
gp_Vec DirSOrC = VecTranslCyl.Normalized();
|
||||
Standard_Real cosA1 = DirSOrC.Dot(VecTranslPln.Normalized());
|
||||
Standard_Real sinA1 = Sqrt(1. - cosA1 * cosA1);
|
||||
#ifndef DEB
|
||||
Standard_Real dis1 = 0.;
|
||||
#else
|
||||
Standard_Real dis1;
|
||||
#endif
|
||||
Standard_Real dis2, ray = Cyl.Radius();
|
||||
Standard_Boolean IsDisOnP = ( (plandab && DisOnP) || (!plandab && !DisOnP) );
|
||||
|
||||
if (IsDisOnP) {
|
||||
dis1 = Dis;
|
||||
Standard_Real sinAl = Sin(Angle), cosAl = Cos(Angle);
|
||||
Standard_Real h = dis1 * sinAl;
|
||||
Standard_Real cosAhOC = cosA1 * sinAl + sinA1 * cosAl;
|
||||
Standard_Real sinAhOC = sinA1 * sinAl - cosA1 * cosAl;
|
||||
if (cosA1 > 0) sinAhOC = -sinAhOC;
|
||||
Standard_Real temp1 = h / ray,
|
||||
temp2 = sinAhOC * sinAhOC + temp1 * cosAhOC;
|
||||
|
||||
dis2 = temp2 + temp1 * (cosAhOC - temp1);
|
||||
|
||||
if (dis2 < -1.E-09) {
|
||||
cout<<"angle du chanfrein trop grand"<<endl;
|
||||
return Standard_False;
|
||||
}
|
||||
else if (dis2 < 1.E-09) {
|
||||
dis2 = ray * Sqrt(2. * temp2);
|
||||
}
|
||||
else {
|
||||
dis2 = ray * Sqrt(2. * (temp2 - sinAhOC * Sqrt(dis2)) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
dis2 = Dis;
|
||||
}
|
||||
|
||||
//construction de POnCyl
|
||||
Standard_Real alpha = ( 2*ASin(dis2*0.5/ray) );
|
||||
gp_Vec VecTemp = VecTranslCyl.Reversed();
|
||||
|
||||
if ( ( XDir.Crossed(gp_Dir(VecTranslCyl)) ).Dot(NorF) < 0.) {
|
||||
VecTemp.Rotate(gp_Ax1(OrCyl,XDir),alpha);
|
||||
}
|
||||
else {
|
||||
VecTemp.Rotate(gp_Ax1(OrCyl,XDir.Reversed()),alpha);}
|
||||
|
||||
POnCyl.SetXYZ( OrCyl.XYZ().Added(VecTemp.XYZ()) );
|
||||
Standard_Real UOnCyl,VOnCyl,UOnPln,VOnPln;
|
||||
gp_Vec DUOnCyl, DVOnCyl;
|
||||
ElSLib::Parameters(Cyl,POnCyl,UOnCyl,VOnCyl);
|
||||
ElSLib::CylinderD1(UOnCyl, VOnCyl, AxCyl, Cyl.Radius(),
|
||||
POnCyl, DUOnCyl, DVOnCyl);
|
||||
|
||||
// Construction du point sur le plan
|
||||
if (!IsDisOnP) {
|
||||
gp_Vec Corde(POnCyl, OrSpine);
|
||||
gp_Vec TCyl = DUOnCyl.Crossed(DVOnCyl);
|
||||
|
||||
TCyl = XDir.Crossed(TCyl);
|
||||
TCyl.Normalize();
|
||||
Corde.Normalize();
|
||||
Standard_Real cosCorTan = TCyl.Dot(Corde);
|
||||
Standard_Real tgCorTan = 1. / (cosCorTan * cosCorTan);
|
||||
tgCorTan = Sqrt(tgCorTan - 1.);
|
||||
|
||||
Standard_Real tgAng = tan(Angle);
|
||||
tgAng = (tgAng + tgCorTan) / (1. - tgAng * tgCorTan);
|
||||
|
||||
Standard_Real cosA11 = dis2 / (2. * ray);
|
||||
Standard_Real sinA11 = Sqrt(1. - cosA11 * cosA11);
|
||||
if (cosA1 > 0) sinA11 = -sinA11;
|
||||
dis1 = (sinA1 + cosA1 * tgAng) * cosA11;
|
||||
dis1 -= (cosA1 - sinA1 * tgAng) * sinA11;
|
||||
dis1 = (dis2 * tgAng) / dis1;
|
||||
}
|
||||
|
||||
VecTranslPln.Multiply(dis1);
|
||||
|
||||
POnPln.SetXYZ( (OrSpine.XYZ()).Added(VecTranslPln.XYZ()) );
|
||||
|
||||
//construction du chanfrein
|
||||
ElSLib::Parameters(Pln,POnPln,UOnPln,VOnPln);
|
||||
POnPln = ElSLib::PlaneValue(UOnPln,VOnPln,AxPln);
|
||||
|
||||
//construction de YDir pour aller de face1 vers face2.
|
||||
gp_Vec YDir(POnPln,POnCyl);
|
||||
if (!plandab){
|
||||
YDir.Reverse();
|
||||
}
|
||||
gp_Ax3 AxCh(POnPln,XDir.Crossed(YDir),XDir);
|
||||
|
||||
Handle(Geom_Plane) Chamfer = new Geom_Plane(AxCh);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(Chamfer,DStr));
|
||||
|
||||
// On charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
//----------- edge plan-Chamfer
|
||||
gp_Pnt2d PPln2d(UOnPln,VOnPln);
|
||||
gp_Dir2d VPln2d(XDir.Dot(AxPln.XDirection()),
|
||||
XDir.Dot(AxPln.YDirection()));
|
||||
gp_Lin2d Lin2dPln(PPln2d,VPln2d);
|
||||
|
||||
POnPln = ElSLib::Value(UOnPln,VOnPln,Pln);
|
||||
gp_Lin C3d(POnPln,XDir);
|
||||
|
||||
Standard_Real U,VOnChamfer;
|
||||
ElSLib::PlaneParameters(AxCh,POnPln,U,VOnChamfer);
|
||||
gp_Lin2d LOnChamfer(gp_Pnt2d(U,VOnChamfer),gp::DX2d());
|
||||
|
||||
Handle(Geom_Line) L3d = new Geom_Line (C3d);
|
||||
Handle(Geom2d_Line) LFac = new Geom2d_Line(Lin2dPln);
|
||||
Handle(Geom2d_Line) LFil = new Geom2d_Line(LOnChamfer);
|
||||
|
||||
gp_Dir NorFil=AxCh.Direction();
|
||||
Standard_Boolean toreverse = ( NorFil.Dot(NorPln) <= 0. );
|
||||
gp_Dir DirPlnCyl(gp_Vec(POnPln, POnCyl));
|
||||
gp_Dir DirSPln(gp_Vec(OrSpine, POnPln));
|
||||
Standard_Boolean PosChamfPln = DirPlnCyl.Dot(DirSPln) > 0;
|
||||
|
||||
if ( !IsDisOnP && PosChamfPln )
|
||||
toreverse = !toreverse;
|
||||
// On regarde si l orientation du Chamfer est la meme que celle du plan
|
||||
if (toreverse)
|
||||
{Data->ChangeOrientation() = TopAbs::Reverse(Ofpl);}
|
||||
else
|
||||
{Data->ChangeOrientation() = Ofpl;}
|
||||
|
||||
TopAbs_Orientation trans = TopAbs_FORWARD;
|
||||
if ((!plandab && toreverse) || (plandab && !toreverse))
|
||||
{trans=TopAbs_REVERSED;}
|
||||
|
||||
//trans permet de determiner le cote "matiere" sur S1(2) delimite par L3d
|
||||
if (plandab)
|
||||
{Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);}
|
||||
else
|
||||
{Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);}
|
||||
|
||||
//------------edge cylindre-Chamfer
|
||||
gp_Pnt2d PCyl2d(UOnCyl,VOnCyl);
|
||||
gp_Dir2d VCyl2d=gp::DY2d();
|
||||
if ( XDir.Dot(AxCyl.Direction())<0 )
|
||||
{VCyl2d.Reverse();}
|
||||
gp_Lin2d Lin2dCyl(PCyl2d,VCyl2d);
|
||||
|
||||
POnCyl = ElSLib::Value(UOnCyl,VOnCyl,Cyl);
|
||||
C3d = gp_Lin(POnCyl,XDir);
|
||||
|
||||
ElSLib::PlaneParameters(AxCh,POnCyl,U,VOnChamfer);
|
||||
LOnChamfer = gp_Lin2d(gp_Pnt2d(U,VOnChamfer),gp::DX2d());
|
||||
|
||||
L3d = new Geom_Line (C3d);
|
||||
LFac = new Geom2d_Line(Lin2dCyl);
|
||||
LFil = new Geom2d_Line(LOnChamfer);
|
||||
|
||||
gp_Vec deru,derv;
|
||||
ElSLib::CylinderD1(UOnCyl,VOnCyl,AxCyl,Cyl.Radius(),POnCyl,deru,derv);
|
||||
gp_Dir NorCyl(deru.Crossed(derv));
|
||||
gp_Dir DirSCyl(gp_Vec(OrSpine, POnCyl));
|
||||
Standard_Boolean PosChamfCyl = DirPlnCyl.Dot(DirSCyl) < 0;
|
||||
toreverse = ( NorFil.Dot(NorCyl) <= 0. );
|
||||
|
||||
|
||||
if ( IsDisOnP && PosChamfCyl)
|
||||
toreverse = !toreverse;
|
||||
trans = TopAbs_REVERSED;
|
||||
if ((!plandab && toreverse) || (plandab && !toreverse))
|
||||
{trans=TopAbs_FORWARD;}
|
||||
|
||||
if (plandab)
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);
|
||||
else
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
43
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCyl.hxx
Executable file
43
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnCyl.hxx
Executable file
@@ -0,0 +1,43 @@
|
||||
// File: ChFiKPart_ComputeData_ChAsymPlnCyl.hxx
|
||||
// Created: Wed Jun 17 16:51:19 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// <pne@cleox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_ChAsymPlnCyl_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_ChAsymPlnCyl_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab,
|
||||
const Standard_Boolean DisOnP);
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab,
|
||||
const Standard_Boolean DisOnP);
|
||||
|
||||
|
||||
#endif
|
222
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnPln.cxx
Executable file
222
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnPln.cxx
Executable file
@@ -0,0 +1,222 @@
|
||||
// File: ChFiKPart_ComputeData_ChAsymPlnPln.cxx
|
||||
// Created: Tue Jun 16 09:21:42 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// <pne@cleox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.ixx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
|
||||
#include <Geom_Plane.hxx>
|
||||
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChAsym
|
||||
//Purpose : Compute the chamfer in the particular case plane/plane.
|
||||
// Compute the SurfData <Data> of the chamfer on the <Spine>
|
||||
// between the plane <Pl1> and the plane <Pl2>, with distances
|
||||
// <Dis> and Angle on <Pl1> .
|
||||
// <First> is the parameter of the start point on the <Spine>
|
||||
// <Or1> and <Or2> are the orientations of the plane <Pl1> and
|
||||
// <Pl2>, and <Of1> the orientation of the face build on the
|
||||
// plane <Pl1>.
|
||||
//Out : True if the chamfer has been computed
|
||||
// False else
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Of1,
|
||||
const Standard_Boolean DisOnP1)
|
||||
{
|
||||
|
||||
// Creation of the plane which carry the chamfer
|
||||
|
||||
// compute the normals to the planes Pl1 and Pl2
|
||||
gp_Ax3 Pos1 = Pl1.Position();
|
||||
gp_Dir D1 = Pos1.XDirection().Crossed(Pos1.YDirection());
|
||||
if (Or1 == TopAbs_REVERSED) { D1.Reverse(); }
|
||||
|
||||
gp_Ax3 Pos2 = Pl2.Position();
|
||||
gp_Dir D2 = Pos2.XDirection().Crossed(Pos2.YDirection());
|
||||
if (Or2 == TopAbs_REVERSED) { D2.Reverse(); }
|
||||
|
||||
// compute the intersection line of Pl1 and Pl2
|
||||
IntAna_QuadQuadGeo LInt (Pl1, Pl2, Precision::Angular(),
|
||||
Precision::Confusion());
|
||||
|
||||
gp_Pnt P;
|
||||
Standard_Real Fint;
|
||||
if (LInt.IsDone()) {
|
||||
Fint = ElCLib::Parameter(LInt.Line(1), ElCLib::Value(First, Spine));
|
||||
P = ElCLib::Value(Fint, LInt.Line(1));
|
||||
}
|
||||
else { return Standard_False; }
|
||||
|
||||
gp_Dir LinAx1 = Spine.Direction();
|
||||
gp_Dir VecTransl1 = LinAx1.Crossed(D1);
|
||||
if ( VecTransl1.Dot(D2) < 0. )
|
||||
VecTransl1.Reverse();
|
||||
|
||||
gp_Dir VecTransl2 = LinAx1.Crossed(D2);
|
||||
if ( VecTransl2.Dot(D1) < 0. )
|
||||
VecTransl2.Reverse();
|
||||
|
||||
Standard_Real cosP, sinP, dis1, dis2;
|
||||
cosP = VecTransl1.Dot(VecTransl2);
|
||||
sinP = sqrt(1. - cosP * cosP);
|
||||
|
||||
if (DisOnP1) {
|
||||
dis1 = Dis;
|
||||
dis2 = Dis / (cosP + sinP / Tan(Angle));
|
||||
}
|
||||
else {
|
||||
dis1 = Dis / (cosP + sinP / Tan(Angle));
|
||||
dis2 = Dis;
|
||||
}
|
||||
// Compute a point on the plane Pl1 and on the chamfer
|
||||
gp_Pnt P1( P.X() + dis1 * VecTransl1.X(),
|
||||
P.Y() + dis1 * VecTransl1.Y(),
|
||||
P.Z() + dis1 * VecTransl1.Z());
|
||||
|
||||
// Point on the plane Pl2 and on the chamfer
|
||||
gp_Pnt P2( P.X() + dis2 * VecTransl2.X(),
|
||||
P.Y() + dis2 * VecTransl2.Y(),
|
||||
P.Z() + dis2 * VecTransl2.Z());
|
||||
|
||||
//the middle point of P1 P2 is the origin of the chamfer
|
||||
gp_Pnt Po ( (P1.X() + P2.X()) / 2., (P1.Y() + P2.Y()) / 2., (P1.Z() + P2.Z()) / 2.);
|
||||
|
||||
// compute a second point on the plane Pl2
|
||||
gp_Pnt Pp = ElCLib::Value(Fint + 10., LInt.Line(1));
|
||||
gp_Pnt P22(Pp.X() + dis2 * VecTransl2.X(),
|
||||
Pp.Y() + dis2 * VecTransl2.Y(),
|
||||
Pp.Z() + dis2 * VecTransl2.Z());
|
||||
|
||||
// Compute the normal vector <AxisPlan> to the chamfer's plane
|
||||
gp_Dir V1 ( P2.X() - P1.X(), P2.Y() - P1.Y(), P2.Z() - P1.Z());
|
||||
gp_Dir V2 ( P22.X() - P1.X(), P22.Y() - P1.Y(), P22.Z() - P1.Z());
|
||||
gp_Dir AxisPlan = V1.Crossed(V2);
|
||||
|
||||
gp_Dir xdir = LinAx1; // u axis
|
||||
gp_Ax3 PlanAx3 (Po, AxisPlan, xdir);
|
||||
if (PlanAx3.YDirection().Dot(D2)>=0.) PlanAx3.YReverse();
|
||||
|
||||
Handle(Geom_Plane) gpl= new Geom_Plane(PlanAx3);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gpl, DStr));
|
||||
|
||||
// About the orientation of the chamfer plane
|
||||
// Compute the normal to the face 1
|
||||
gp_Dir norpl = Pos1.XDirection().Crossed(Pos1.YDirection());
|
||||
gp_Dir norface1 = norpl;
|
||||
if (Of1 == TopAbs_REVERSED ) { norface1.Reverse(); }
|
||||
|
||||
// Compute the orientation of the chamfer plane
|
||||
gp_Dir norplch = gpl->Pln().Position().XDirection().Crossed (
|
||||
gpl->Pln().Position().YDirection());
|
||||
|
||||
gp_Dir DirCh12(gp_Vec(P1, P2));
|
||||
Standard_Boolean toreverse = ( norplch.Dot(norface1) <= 0. );
|
||||
if (VecTransl1.Dot(DirCh12) > 0) toreverse = !toreverse;
|
||||
|
||||
if (toreverse)
|
||||
Data->ChangeOrientation() = TopAbs_REVERSED;
|
||||
else
|
||||
Data->ChangeOrientation() = TopAbs_FORWARD;
|
||||
|
||||
// Loading of the FaceInterferences with pcurves & 3d curves.
|
||||
|
||||
// case face 1
|
||||
gp_Lin linPln(P1, xdir);
|
||||
Handle(Geom_Line) GLinPln1 = new Geom_Line(linPln);
|
||||
|
||||
Standard_Real u, v;
|
||||
ElSLib::PlaneParameters(Pos1, P1, u, v);
|
||||
gp_Pnt2d p2dPln(u, v);
|
||||
gp_Dir2d dir2dPln( xdir.Dot(Pos1.XDirection()),
|
||||
xdir.Dot(Pos1.YDirection()));
|
||||
gp_Lin2d lin2dPln(p2dPln, dir2dPln);
|
||||
Handle(Geom2d_Line) GLin2dPln1 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
ElSLib::PlaneParameters(PlanAx3, P1, u, v);
|
||||
p2dPln.SetCoord(u, v);
|
||||
lin2dPln.SetLocation(p2dPln);
|
||||
lin2dPln.SetDirection(gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dPlnCh1 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
TopAbs_Orientation trans;
|
||||
toreverse = ( norplch.Dot(norpl) <= 0. );
|
||||
if (VecTransl1.Dot(DirCh12) > 0) toreverse = !toreverse;
|
||||
if (toreverse)
|
||||
trans = TopAbs_FORWARD;
|
||||
else
|
||||
trans = TopAbs_REVERSED;
|
||||
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln1, DStr),
|
||||
trans, GLin2dPln1, GLin2dPlnCh1);
|
||||
|
||||
|
||||
// case face 2
|
||||
|
||||
linPln.SetLocation(P2);
|
||||
Handle(Geom_Line) GLinPln2 = new Geom_Line(linPln);
|
||||
|
||||
ElSLib::PlaneParameters(Pos2, P2, u, v);
|
||||
p2dPln.SetCoord(u, v);
|
||||
dir2dPln.SetCoord( xdir.Dot(Pos2.XDirection()),
|
||||
xdir.Dot(Pos2.YDirection()));
|
||||
lin2dPln.SetLocation(p2dPln);
|
||||
lin2dPln.SetDirection(dir2dPln);
|
||||
Handle(Geom2d_Line) GLin2dPln2 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
ElSLib::PlaneParameters(PlanAx3, P2, u, v);
|
||||
p2dPln.SetCoord(u, v);
|
||||
lin2dPln.SetLocation(p2dPln);
|
||||
lin2dPln.SetDirection(gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dPlnCh2 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
norpl = Pos2.XDirection().Crossed(Pos2.YDirection());
|
||||
toreverse = ( norplch.Dot(norpl) <= 0. );
|
||||
if (VecTransl2.Dot(DirCh12) < 0) toreverse = !toreverse;
|
||||
if (toreverse)
|
||||
trans = TopAbs_REVERSED;
|
||||
else
|
||||
trans = TopAbs_FORWARD;
|
||||
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln2,DStr),
|
||||
trans, GLin2dPln2, GLin2dPlnCh2);
|
||||
|
||||
return Standard_True;
|
||||
|
||||
}
|
25
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnPln.hxx
Executable file
25
src/ChFiKPart/ChFiKPart_ComputeData_ChAsymPlnPln.hxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: ChFiKPart_ComputeData_ChAsymPlnPln.hxx
|
||||
// Created: Tue Jun 16 10:06:56 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// <pne@cleox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_ChAsymPlnPln_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_ChAsymPlnPln_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChAsym(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis,
|
||||
const Standard_Real Angle,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Of1,
|
||||
const Standard_Boolean DisOnP1);
|
||||
|
||||
|
||||
|
||||
#endif
|
375
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCon.cxx
Executable file
375
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCon.cxx
Executable file
@@ -0,0 +1,375 @@
|
||||
// File: ChFiKPart_ComputeData_ChPlnCon.cxx
|
||||
// Created: Tue May 30 16:38:45 1995
|
||||
// Author: Stagiaire Flore Lantheaume
|
||||
// <fla@phylox>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_ChAsymPlnCon.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChamfer
|
||||
//purpose : Compute the chamfer in the particular case Plane/Cone or
|
||||
// Cylinder/Plane
|
||||
// Compute the SurfData <Data> of the chamfer build on the <Spine>
|
||||
// between the plane <Pln> and the cone <Con>, with the
|
||||
// distances <Dis1> on <Pln> and <Dis2> on <Con>.
|
||||
// <Or1> and <Or2> are the orientations of <Pln> and <Con>
|
||||
// and <Ofpl> this of the face carried by <Pln>.
|
||||
// <First> is the start point on the <Spine>
|
||||
// <Plandab> is equal to True if the plane is the surface S1
|
||||
// <fu> and <lu> are the first and last u parameters of the
|
||||
// cone
|
||||
//out : True if the chanfer has been computed
|
||||
// False else
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab)
|
||||
{
|
||||
|
||||
Standard_Real angcon = Con.SemiAngle();
|
||||
Standard_Real sincon =Abs(Sin(angcon));
|
||||
Standard_Real angle;
|
||||
Standard_Boolean IsResol;
|
||||
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
if ( Or1 == TopAbs_REVERSED ) Dpl.Reverse();
|
||||
|
||||
// compute the origin of the conical chamfer PtPl
|
||||
gp_Pnt Or = Con.Location();
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(PosPl,Or,u,v);
|
||||
#ifdef DEB
|
||||
gp_Pnt2d pt2dPln(u,v);
|
||||
#endif
|
||||
ElSLib::PlaneD0(u,v,PosPl,Or);
|
||||
|
||||
gp_Pnt PtSp;
|
||||
gp_Vec DSp;
|
||||
ElCLib::D1(First,Spine,PtSp,DSp);
|
||||
#ifdef DEB
|
||||
gp_Dir Dx(gp_Vec(Or,PtSp));
|
||||
#endif
|
||||
//compute the normal to the cone in PtSp
|
||||
gp_Vec deru,derv;
|
||||
gp_Pnt PtCon;
|
||||
ElSLib::Parameters(Con,PtSp,u,v);
|
||||
ElSLib::D1(u,v,Con,PtCon ,deru,derv);
|
||||
gp_Dir Dcon( deru.Crossed(derv) );
|
||||
if ( Or2 == TopAbs_REVERSED ) Dcon.Reverse();
|
||||
|
||||
Standard_Boolean ouvert = ( Dpl.Dot(Dcon) >= 0.);
|
||||
|
||||
if (!ouvert) {
|
||||
if (Abs(Dis1 - Dis2 * sincon) > Precision::Confusion()) {
|
||||
Standard_Real abscos = Abs(Dis2 - Dis1 * sincon);
|
||||
angle = ATan((Dis1 * Cos(angcon)) / abscos);
|
||||
}
|
||||
else {
|
||||
angle = angcon;
|
||||
}
|
||||
}
|
||||
else {
|
||||
angle = ATan((Dis1 * Cos(angcon)) / (Dis2 + Dis1 * sincon));
|
||||
}
|
||||
|
||||
Standard_Boolean DisOnP = Standard_False;
|
||||
|
||||
IsResol = ChFiKPart_MakeChAsym(DStr, Data, Pln, Con, fu, lu, Or1, Or2,
|
||||
Dis2, angle, Spine, First, Ofpl, plandab, DisOnP);
|
||||
|
||||
return IsResol;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
// Compute the chamfer surface(cone)
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
gp_Dir norf = Dpl;
|
||||
if (Ofpl == TopAbs_REVERSED ) norf.Reverse();
|
||||
if ( Or1 == TopAbs_REVERSED ) Dpl.Reverse();
|
||||
|
||||
// compute the origin of the conical chamfer PtPl
|
||||
gp_Pnt Or = Con.Location();
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(PosPl,Or,u,v);
|
||||
gp_Pnt2d pt2dPln(u,v);
|
||||
ElSLib::PlaneD0(u,v,PosPl,Or);
|
||||
gp_Pnt PtPl = Or;
|
||||
|
||||
gp_Pnt PtSp;
|
||||
gp_Vec DSp;
|
||||
ElCLib::D1(First,Spine,PtSp,DSp);
|
||||
gp_Dir Dx(gp_Vec(PtPl,PtSp));
|
||||
|
||||
//compute the normal to the cone in PtSp
|
||||
gp_Vec deru,derv;
|
||||
gp_Pnt PtCon;
|
||||
ElSLib::Parameters(Con,PtSp,u,v);
|
||||
ElSLib::D1(u,v,Con,PtCon ,deru,derv);
|
||||
gp_Dir Dcon( deru.Crossed(derv) );
|
||||
if ( Or2 == TopAbs_REVERSED ) Dcon.Reverse();
|
||||
|
||||
Standard_Boolean dedans = ( Dx.Dot(Dcon) <= 0.);
|
||||
Standard_Boolean ouvert = ( Dpl.Dot(Dcon) >= 0.);
|
||||
|
||||
// variables used to compute the semiangle of the chamfer
|
||||
Standard_Real angle = Con.SemiAngle();
|
||||
Standard_Real move = Dis2 * Cos(angle);
|
||||
Or.SetCoord( Or.X()+ move*Dpl.X(),
|
||||
Or.Y()+ move*Dpl.Y(),
|
||||
Or.Z()+ move*Dpl.Z());
|
||||
|
||||
gp_Dir Vec1(Or.X()-PtPl.X(), Or.Y()-PtPl.Y(), Or.Z()-PtPl.Z());
|
||||
Standard_Real Dis;
|
||||
if (ouvert)
|
||||
Dis = Dis1 + Dis2*Abs(Sin(angle));
|
||||
else
|
||||
Dis = Dis1 - Dis2*Abs(Sin(angle));
|
||||
|
||||
gp_Pnt Pt(Or.X()+Dis*PosPl.XDirection().X(),
|
||||
Or.Y()+Dis*PosPl.XDirection().Y(),
|
||||
Or.Z()+Dis*PosPl.XDirection().Z());
|
||||
gp_Dir Vec2( Pt.X()-PtPl.X(), Pt.Y()-PtPl.Y(), Pt.Z()-PtPl.Z());
|
||||
|
||||
// compute the parameters of the conical chamfer
|
||||
Standard_Real ChamfRad,SemiAngl;
|
||||
Standard_Boolean pointu = Standard_False;
|
||||
|
||||
if (dedans) {
|
||||
ChamfRad = Spine.Radius() - Dis1;
|
||||
if ( Abs(ChamfRad)<=Precision::Confusion() ) pointu = Standard_True;
|
||||
if( ChamfRad < 0 ) {
|
||||
#ifdef DEB
|
||||
cout<<"le chanfrein ne passe pas"<<endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ChamfRad = Spine.Radius() + Dis1;
|
||||
gp_Dir Dplr = Dpl.Reversed();
|
||||
Dpl = Dplr;
|
||||
}
|
||||
|
||||
gp_Ax3 ChamfAx3(PtPl,Dpl,Dx);
|
||||
SemiAngl = Vec1.Angle(Vec2);
|
||||
|
||||
Handle (Geom_ConicalSurface)
|
||||
gcon = new Geom_ConicalSurface( ChamfAx3, SemiAngl, ChamfRad );
|
||||
|
||||
// changes due to the fact the parameters of the chamfer must go increasing
|
||||
// from surface S1 to surface S2
|
||||
if ( (dedans && !plandab) || (!dedans && plandab) ) {
|
||||
gcon->VReverse();// be carefull : the SemiAngle was changed
|
||||
ChamfAx3 = gcon->Position();
|
||||
SemiAngl = gcon->SemiAngle();
|
||||
}
|
||||
|
||||
// changes due to the fact we have reversed the V direction of
|
||||
// parametrization
|
||||
if (ChamfAx3.YDirection().Dot(DSp) <= 0.) {
|
||||
ChamfAx3.YReverse();
|
||||
gcon->SetPosition(ChamfAx3);
|
||||
}
|
||||
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gcon,DStr));
|
||||
|
||||
|
||||
//compute the chamfer's orientation according to the orientation
|
||||
// of the faces
|
||||
|
||||
//search the normal to the conical chamfer
|
||||
gp_Pnt P;
|
||||
u=0.;
|
||||
if (plandab)
|
||||
v = sqrt(Dis*Dis + move*move);
|
||||
else
|
||||
v = - sqrt(Dis*Dis + move*move);
|
||||
ElSLib::ConeD1(u,v,ChamfAx3,ChamfRad,SemiAngl,P,deru,derv);
|
||||
gp_Dir norchamf(deru.Crossed(derv));
|
||||
|
||||
Standard_Boolean toreverse = (norf.Dot(norchamf)<= 0.);
|
||||
|
||||
if (toreverse)
|
||||
Data->ChangeOrientation() = TopAbs_REVERSED;
|
||||
else
|
||||
Data->ChangeOrientation() = TopAbs_FORWARD;
|
||||
|
||||
|
||||
//we load the faceInterference with the pcurves and
|
||||
// the 3d curves
|
||||
|
||||
// Case of the plane face
|
||||
// NB: in the case 'pointu', no pcurve on the plane surface
|
||||
// and no intersection plane-chamfer are needed
|
||||
|
||||
// intersection plane-chamfer
|
||||
Handle(Geom_Circle) GCirPln;
|
||||
Handle(Geom2d_Circle) GCir2dPln;
|
||||
gp_Ax2 CirAx2 = ChamfAx3.Ax2();
|
||||
CirAx2.SetLocation(PtPl);
|
||||
|
||||
if (!pointu) {
|
||||
Pt.SetCoord(PtPl.X()+ChamfRad*Dx.X(),
|
||||
PtPl.Y()+ChamfRad*Dx.Y(),
|
||||
PtPl.Z()+ChamfRad*Dx.Z());
|
||||
gp_Circ CirPln(CirAx2,ChamfRad);
|
||||
GCirPln = new Geom_Circle(CirPln);
|
||||
|
||||
//pcurve on the plane
|
||||
ElSLib::PlaneParameters(PosPl,Pt ,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d d2d(DSp.Dot(PosPl.XDirection()),DSp.Dot(PosPl.YDirection()));
|
||||
gp_Ax22d ax2dPln(pt2dPln, gp_Dir2d(gp_Vec2d(pt2dPln,p2dPln)),d2d);
|
||||
gp_Circ2d cir2dPln(ax2dPln,ChamfRad);
|
||||
GCir2dPln = new Geom2d_Circle(cir2dPln);
|
||||
}
|
||||
|
||||
//pcurve on chamfer
|
||||
gp_Pnt2d p2dch;
|
||||
p2dch.SetCoord(0.,0.);
|
||||
ElSLib::ConeD1(0.,0.,ChamfAx3,ChamfRad,SemiAngl,Pt,deru,derv);
|
||||
gp_Lin2d lin2dch(p2dch,gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dCh1 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//orientation
|
||||
TopAbs_Orientation trans;
|
||||
gp_Dir norpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
if (!pointu)
|
||||
norchamf.SetXYZ (deru.Crossed(derv).XYZ());
|
||||
toreverse = ( norchamf.Dot(norpl) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab)){
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
|
||||
|
||||
// Case of the conical face
|
||||
|
||||
//intersection cone-chamfer
|
||||
Standard_Real Rad;
|
||||
if (dedans)
|
||||
Rad = ChamfRad + Dis;
|
||||
else
|
||||
Rad = ChamfRad - Dis;
|
||||
|
||||
CirAx2.SetLocation(Or);
|
||||
gp_Circ CirCon(CirAx2, Rad);
|
||||
Handle(Geom_Circle) GCirCon = new Geom_Circle(CirCon);
|
||||
|
||||
//pcurve on chamfer
|
||||
if (plandab)
|
||||
v = sqrt(Dis*Dis + move*move);
|
||||
else
|
||||
v = - sqrt(Dis*Dis + move*move);
|
||||
p2dch.SetCoord(0.,v);
|
||||
ElSLib::ConeD1(0.,v,ChamfAx3,ChamfRad,SemiAngl,Pt,deru,derv);
|
||||
lin2dch.SetLocation(p2dch);
|
||||
Handle(Geom2d_Line) GLin2dCh2 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//pcurve on cone
|
||||
norchamf.SetXYZ (deru.Crossed(derv).XYZ());
|
||||
|
||||
Pt.SetCoord(Or.X()+Rad*Dx.X(),
|
||||
Or.Y()+Rad*Dx.Y(),
|
||||
Or.Z()+Rad*Dx.Z());
|
||||
ElSLib::Parameters(Con,Pt ,u,v);
|
||||
Standard_Real tol = Precision::PConfusion();
|
||||
if(u >= 2*PI - tol && u <= 2*PI) u = 0.;
|
||||
if(u >= fu - tol && u < fu) u = fu;
|
||||
if(u <= lu + tol && u > lu) u = lu;
|
||||
if(u < fu || u > lu) u = ElCLib::InPeriod(u,fu,fu + 2*PI);
|
||||
ElSLib::D1(u,v,Con,Pt,deru,derv);
|
||||
gp_Pnt2d p2dCon(u,v);
|
||||
gp_Dir2d d2dCon;
|
||||
if ( deru.Dot(DSp)<=0. )
|
||||
d2dCon = - gp::DX2d();
|
||||
else
|
||||
d2dCon = gp::DX2d();
|
||||
gp_Lin2d lin2dCon(p2dCon,d2dCon);
|
||||
Handle(Geom2d_Line) GLin2dCon = new Geom2d_Line(lin2dCon);
|
||||
|
||||
//orientation
|
||||
gp_Dir norcon = deru.Crossed(derv);
|
||||
toreverse = ( norchamf.Dot(norcon) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ) {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCon,DStr),
|
||||
trans,GLin2dCon,GLin2dCh2);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCon,DStr),
|
||||
trans,GLin2dCon,GLin2dCh2);
|
||||
}
|
||||
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
25
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCon.hxx
Executable file
25
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCon.hxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: ChFiKPart_ComputeData_ChPlnCon.hxx
|
||||
// Created: Tue May 30 16:40:46 1995
|
||||
// Author: Stagiaire Flore Lantheaume
|
||||
// <fla@phylox>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_ChPlnCon_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_ChPlnCon_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab);
|
||||
|
||||
#endif
|
504
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.cxx
Executable file
504
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.cxx
Executable file
@@ -0,0 +1,504 @@
|
||||
// File: ChFiKPart_ComputeData_ChPlnCyl.cxx
|
||||
// Created: Fri May 19 14:57:07 1995
|
||||
// Author: Flore Lantheaume
|
||||
// <fla@phylox>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
|
||||
//pour tester
|
||||
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChamfer
|
||||
//purpose : Compute the chamfer in the particular case Plane/Cylinder
|
||||
// or Cylinder/Plane
|
||||
// Compute the SurfData <Data> of the chamfer build on the <Spine>
|
||||
// between the plane <Pln> and the cylinder <Cyl>, with the
|
||||
// distances <Dis1> on <Pln> and <Dis2> on <Cyl>.
|
||||
// <Or1> and <Or2> are the orientations of <Pln> and <Cyl>
|
||||
// and <Ofpl> this of the face carried by <Pln>.
|
||||
// <First> is the start point on the <Spine>
|
||||
// <Plandab> is equal to True if the plane is the surface S1
|
||||
// <fu> and <lu> are the first and last u parameters of the
|
||||
// cylinder
|
||||
//out : True if the chanfer has been computed
|
||||
// False else
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab)
|
||||
{
|
||||
|
||||
// compute the chamfer surface(cone)
|
||||
|
||||
// compute the normals to the plane surface & to the plane face
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
gp_Dir norf = Dpl;
|
||||
if ( Ofpl == TopAbs_REVERSED) norf.Reverse();
|
||||
if (Or1 == TopAbs_REVERSED) Dpl.Reverse();
|
||||
|
||||
// compute the origin Or of the cone
|
||||
gp_Pnt Or = Cyl.Location();
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(PosPl,Or,u,v);
|
||||
gp_Pnt2d pt2dPln(u,v);
|
||||
ElSLib::PlaneD0(u,v,PosPl,Or);
|
||||
gp_Pnt PtPl = Or; // projection of the cylinder origin
|
||||
//on the plane
|
||||
|
||||
gp_Pnt PtSp;//start 3d point on the Spine
|
||||
gp_Vec DSp; //tangent vector to the spine on PtSp
|
||||
ElCLib::D1(First,Spine,PtSp,DSp);
|
||||
gp_Dir Dx(gp_Vec(Or,PtSp));
|
||||
gp_Dir Dy(DSp);
|
||||
ElSLib::Parameters(Cyl,PtSp,u,v);
|
||||
gp_Pnt PtCyl;//point on the cylinder and on the Spine
|
||||
gp_Vec Vu,Vv;
|
||||
ElSLib::D1(u,v,Cyl,PtCyl,Vu,Vv);
|
||||
gp_Dir Dcyl(Vu.Crossed(Vv));//normal to the cylinder in PtSp
|
||||
if (Or2 == TopAbs_REVERSED) Dcyl.Reverse();
|
||||
Standard_Boolean dedans = ( Dcyl.Dot(Dx) <= 0.);
|
||||
|
||||
Standard_Boolean pointu = Standard_False;
|
||||
Standard_Real ConRad, Rad, SemiAngl ;
|
||||
Or.SetCoord(Or.X()+Dis2*Dpl.X(),
|
||||
Or.Y()+Dis2*Dpl.Y(),
|
||||
Or.Z()+Dis2*Dpl.Z());
|
||||
|
||||
// variables used to compute the semiangle of the cone
|
||||
gp_Dir Vec1(Or.X()-PtPl.X(), Or.Y()-PtPl.Y(), Or.Z()-PtPl.Z());
|
||||
gp_Pnt Pt(Or.X()+Dis1*PosPl.XDirection().X(),
|
||||
Or.Y()+Dis1*PosPl.XDirection().Y(),
|
||||
Or.Z()+Dis1*PosPl.XDirection().Z());
|
||||
gp_Dir Vec2( Pt.X()-PtPl.X(), Pt.Y()-PtPl.Y(), Pt.Z()-PtPl.Z());
|
||||
|
||||
// compute the parameters of the conical surface
|
||||
if (dedans) {
|
||||
Rad = Cyl.Radius()- Dis1;
|
||||
if ( Abs(Rad) <= Precision::Confusion() ) pointu = Standard_True;
|
||||
if(Rad < 0 ) {
|
||||
cout<<"le chanfrein ne passe pas"<<endl;
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Rad = Cyl.Radius()+Dis1;
|
||||
gp_Dir Dplr = Dpl.Reversed();
|
||||
Dpl = Dplr;
|
||||
}
|
||||
ConRad = Cyl.Radius();
|
||||
SemiAngl = Vec1.Angle(Vec2);
|
||||
gp_Ax3 ConAx3(Or,Dpl,Dx);
|
||||
|
||||
Handle (Geom_ConicalSurface)
|
||||
gcon = new Geom_ConicalSurface( ConAx3, SemiAngl, ConRad );
|
||||
|
||||
// changes due to the fact the parameters of the chamfer must go increasing
|
||||
// from surface S1 to surface S2
|
||||
if ( (dedans && !plandab) || (!dedans && plandab) ) {
|
||||
gcon->VReverse();// be carefull : the SemiAngle was changed
|
||||
ConAx3 = gcon->Position();
|
||||
SemiAngl = gcon->SemiAngle();
|
||||
}
|
||||
|
||||
// changes due to the fact we have reversed the V direction of
|
||||
// parametrization
|
||||
if (ConAx3.YDirection().Dot(DSp) <= 0.) {
|
||||
ConAx3.YReverse();
|
||||
gcon->SetPosition(ConAx3);
|
||||
}
|
||||
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gcon,DStr));
|
||||
|
||||
|
||||
// compute the chamfer's orientation according to the orientation
|
||||
// of the faces
|
||||
|
||||
//search the normal to the cone
|
||||
|
||||
gp_Vec deru, derv;
|
||||
ElSLib::ConeD1(0.,0.,ConAx3,ConRad,SemiAngl,Pt,deru,derv);
|
||||
|
||||
gp_Dir norCon(deru.Crossed(derv));
|
||||
|
||||
Standard_Boolean toreverse = ( norCon.Dot(norf) <= 0.);
|
||||
if (toreverse) {
|
||||
Data->ChangeOrientation() = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
Data->ChangeOrientation() = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
//we load of the faceInterference with the pcurves and
|
||||
// the 3d curves
|
||||
|
||||
// Case of the plane face
|
||||
// NB: in the case 'pointu', no pcurve on the plane surface
|
||||
// and no intersection plane-chamfer are needed
|
||||
Handle(Geom2d_Circle) GCir2dPln;
|
||||
Handle(Geom_Circle) GCirPln;
|
||||
gp_Ax2 CirAx2 = ConAx3.Ax2();
|
||||
CirAx2.SetLocation(PtPl);
|
||||
|
||||
if (!pointu) {
|
||||
|
||||
// intersection plane-chamfer
|
||||
gp_Circ CirPln(CirAx2,Rad);
|
||||
GCirPln = new Geom_Circle(CirPln);
|
||||
|
||||
//pcurve on the plane
|
||||
ElSLib::PlaneParameters(PosPl,Pt ,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d d2d(DSp.Dot(PosPl.XDirection()),DSp.Dot(PosPl.YDirection()));
|
||||
gp_Ax22d ax2dPln(pt2dPln, gp_Dir2d(gp_Vec2d(pt2dPln,p2dPln)),d2d);
|
||||
gp_Circ2d cir2dPln(ax2dPln,Rad);
|
||||
GCir2dPln = new Geom2d_Circle(cir2dPln);
|
||||
}
|
||||
|
||||
//pcurve on the chamfer
|
||||
gp_Pnt2d p2dch;
|
||||
if (plandab)
|
||||
v= -sqrt(Dis1*Dis1+Dis2*Dis2);
|
||||
else
|
||||
v = sqrt(Dis1*Dis1+Dis2*Dis2);
|
||||
p2dch.SetCoord(0.,v);
|
||||
ElSLib::ConeD1(0.,v,ConAx3,ConRad,SemiAngl,Pt,deru,derv);
|
||||
gp_Lin2d lin2dch(p2dch,gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dCh1 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//orientation
|
||||
TopAbs_Orientation trans;
|
||||
gp_Dir norpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
toreverse = ( norCon.Dot(norpl) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab)){
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirPln,DStr),
|
||||
trans,GCir2dPln,GLin2dCh1);
|
||||
}
|
||||
|
||||
// Case of the cylindrical face
|
||||
|
||||
//intersection cylinder-chamfer
|
||||
CirAx2.SetLocation(Or);
|
||||
gp_Circ CirCyl(CirAx2,ConRad);
|
||||
Handle(Geom_Circle) GCirCyl = new Geom_Circle(CirCyl);
|
||||
|
||||
//pcurve on the chamfer
|
||||
p2dch.SetCoord(0.,0.);
|
||||
ElSLib::ConeD1(0.,0.,ConAx3,ConRad,SemiAngl,Pt,deru,derv);
|
||||
lin2dch.SetLocation(p2dch);
|
||||
Handle(Geom2d_Line) GLin2dCh2 = new Geom2d_Line(lin2dch);
|
||||
|
||||
//pcurve on the cylinder
|
||||
norCon.SetXYZ (deru.Crossed(derv).XYZ());
|
||||
|
||||
Pt.SetCoord(Or.X()+ConRad*Dx.X(),
|
||||
Or.Y()+ConRad*Dx.Y(),
|
||||
Or.Z()+ConRad*Dx.Z());
|
||||
ElSLib::Parameters(Cyl,Pt ,u,v);
|
||||
Standard_Real tol = Precision::PConfusion();
|
||||
Standard_Boolean careaboutsens = 0;
|
||||
if(Abs(lu - fu - 2*PI) < tol) careaboutsens = 1;
|
||||
if(u >= fu - tol && u < fu) u = fu;
|
||||
if(u <= lu + tol && u > lu) u = lu;
|
||||
if(u < fu || u > lu) u = ChFiKPart_InPeriod(u,fu,fu + 2*PI,tol);
|
||||
|
||||
ElSLib::D1(u,v,Cyl,Pt,deru,derv);
|
||||
gp_Dir norcyl = deru.Crossed(derv);
|
||||
gp_Dir2d d2dCyl = gp::DX2d();
|
||||
if( deru.Dot(Dy) < 0. ){
|
||||
d2dCyl.Reverse();
|
||||
if(careaboutsens && Abs(fu-u)<tol) u = lu;
|
||||
}
|
||||
else if(careaboutsens && Abs(lu-u)<tol) u = fu;
|
||||
gp_Pnt2d p2dCyl(u,v);
|
||||
gp_Lin2d lin2dCyl(p2dCyl,d2dCyl);
|
||||
Handle(Geom2d_Line) GLin2dCyl = new Geom2d_Line(lin2dCyl);
|
||||
|
||||
//orientation
|
||||
toreverse = ( norCon.Dot(norcyl) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ) {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
|
||||
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCyl,DStr),
|
||||
trans,GLin2dCyl,GLin2dCh2);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCirCyl,DStr),
|
||||
trans,GLin2dCyl,GLin2dCh2);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// File: ChFiKPart_ComputeData_ChPlnCyl.cxx
|
||||
// Created: Fri May 10 09:43:15 1996
|
||||
// Author: Stagiaire Xuan Trang PHAMPHU
|
||||
// <xpu@phylox>
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChamfer
|
||||
//purpose : cas cylindre/plan ou plan/cylindre.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab)
|
||||
{
|
||||
//calcul du conge plan.
|
||||
//or1 et or2 permettent de determiner dans lequel des 4 cotes crees par
|
||||
//l'intersection des 2 surfaces_ on est
|
||||
// _|_ et Ofpl qui est l'orientation de la face du plan permettant
|
||||
// |4 de determiner le cote de la matiere
|
||||
|
||||
Standard_Real dis1=Dis1, dis2=Dis2;
|
||||
if (!plandab){
|
||||
dis1 = Dis2;
|
||||
dis2 = Dis1;}
|
||||
|
||||
gp_Pnt OrSpine = ElCLib::Value(First,Spine);
|
||||
gp_Pnt POnCyl, POnPln, OrCyl;
|
||||
|
||||
gp_Dir XDir = Spine.Direction();
|
||||
gp_Ax3 AxPln = Pln.Position();
|
||||
gp_Dir NorPln = AxPln.XDirection().Crossed(AxPln.YDirection());
|
||||
gp_Dir NorF(NorPln);
|
||||
if (Or1 == TopAbs_REVERSED)
|
||||
{NorF.Reverse();}
|
||||
|
||||
gp_Ax3 AxCyl = Cyl.Position();
|
||||
// OrCyl est le point sur l'axe du cylindre dans le plan normal a l'axe
|
||||
// contenant OrSpine
|
||||
gp_Pnt Loc = AxCyl.Location();
|
||||
gp_Vec LocSp(Loc, OrSpine);
|
||||
gp_XYZ temp = AxCyl.Direction().XYZ();
|
||||
temp = temp.Multiplied(LocSp.XYZ().Multiplied(temp) );
|
||||
OrCyl.SetXYZ( (Loc.XYZ()).Added(temp) );
|
||||
// gp_XYZ temp = AxCyl.Direction().XYZ();
|
||||
// temp = temp.Multiplied( OrSpine.XYZ().Multiplied(temp) );
|
||||
// OrCyl.SetXYZ( (AxCyl.Location().XYZ()).Added(temp) );
|
||||
|
||||
|
||||
//construction de POnPln
|
||||
gp_Vec VecTranslPln,tmp;
|
||||
|
||||
tmp = gp_Vec(OrSpine,OrCyl);
|
||||
if ((Or2 == TopAbs_FORWARD && Cyl.Direct()) ||
|
||||
(Or2 == TopAbs_REVERSED && !Cyl.Direct()))
|
||||
{tmp.Reverse();}
|
||||
|
||||
VecTranslPln = gp_Vec( XDir.Crossed(NorPln) );
|
||||
if( VecTranslPln.Dot(tmp) <= 0. )
|
||||
{VecTranslPln.Reverse();}
|
||||
VecTranslPln.Multiply(dis1);
|
||||
|
||||
POnPln.SetXYZ( (OrSpine.XYZ()).Added(VecTranslPln.XYZ()) );
|
||||
|
||||
//construction de POnCyl
|
||||
Standard_Real alpha = ( 2*ASin(dis2*0.5/Cyl.Radius()) );
|
||||
// gp_Vec VecTranslCyl;
|
||||
// VecTranslCyl = gp_Vec(OrSpine,OrCyl);
|
||||
|
||||
// if ( ( XDir.Crossed(gp_Dir(VecTranslCyl)) ).Dot(NorF) <=0. )
|
||||
// {VecTranslCyl.Rotate(gp_Ax1(OrSpine,XDir),alpha);}
|
||||
// else
|
||||
// {VecTranslCyl.Rotate(gp_Ax1(OrSpine,XDir.Reversed()),alpha);}
|
||||
|
||||
// POnCyl.SetXYZ( OrCyl.XYZ().Added(VecTranslCyl.XYZ()) );
|
||||
|
||||
gp_Vec VecCylTransl = gp_Vec(OrCyl,OrSpine);
|
||||
|
||||
if ( ( XDir.Crossed(gp_Dir(VecCylTransl)) ).Dot(NorF) > 0.) {
|
||||
VecCylTransl.Rotate(gp_Ax1(OrCyl,XDir),alpha);
|
||||
}
|
||||
else {
|
||||
VecCylTransl.Rotate(gp_Ax1(OrCyl,XDir.Reversed()),alpha);}
|
||||
|
||||
POnCyl.SetXYZ( OrCyl.XYZ().Added(VecCylTransl.XYZ()) );
|
||||
|
||||
//construction du chanfrein
|
||||
Standard_Real UOnCyl,VOnCyl,UOnPln,VOnPln;
|
||||
ElSLib::Parameters(Cyl,POnCyl,UOnCyl,VOnCyl);
|
||||
POnCyl = ElSLib::CylinderValue(UOnCyl,VOnCyl,AxCyl,Cyl.Radius());
|
||||
ElSLib::Parameters(Pln,POnPln,UOnPln,VOnPln);
|
||||
POnPln = ElSLib::PlaneValue(UOnPln,VOnPln,AxPln);
|
||||
|
||||
//construction de YDir pour aller de face1 vers face2.
|
||||
gp_Vec YDir(POnPln,POnCyl);
|
||||
if (!plandab){
|
||||
YDir.Reverse();
|
||||
}
|
||||
gp_Ax3 AxCh(POnPln,XDir.Crossed(YDir),XDir);
|
||||
|
||||
Handle(Geom_Plane) Chamfer = new Geom_Plane(AxCh);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(Chamfer,DStr));
|
||||
|
||||
// On charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
//----------- edge plan-Chamfer
|
||||
gp_Pnt2d PPln2d(UOnPln,VOnPln);
|
||||
gp_Dir2d VPln2d(XDir.Dot(AxPln.XDirection()),
|
||||
XDir.Dot(AxPln.YDirection()));
|
||||
gp_Lin2d Lin2dPln(PPln2d,VPln2d);
|
||||
|
||||
POnPln = ElSLib::Value(UOnPln,VOnPln,Pln);
|
||||
gp_Lin C3d(POnPln,XDir);
|
||||
|
||||
Standard_Real U,VOnChamfer;
|
||||
ElSLib::PlaneParameters(AxCh,POnPln,U,VOnChamfer);
|
||||
gp_Lin2d LOnChamfer(gp_Pnt2d(U,VOnChamfer),gp::DX2d());
|
||||
|
||||
Handle(Geom_Line) L3d = new Geom_Line (C3d);
|
||||
Handle(Geom2d_Line) LFac = new Geom2d_Line(Lin2dPln);
|
||||
Handle(Geom2d_Line) LFil = new Geom2d_Line(LOnChamfer);
|
||||
|
||||
gp_Dir NorFil=AxCh.Direction();
|
||||
Standard_Boolean toreverse = ( NorFil.Dot(NorPln) <= 0. );
|
||||
|
||||
gp_Dir DirPlnCyl(gp_Vec(POnPln, POnCyl));
|
||||
gp_Dir DirSPln(gp_Vec(OrSpine, POnPln));
|
||||
Standard_Boolean PosChamfPln = DirPlnCyl.Dot(DirSPln) > 0;
|
||||
|
||||
if (PosChamfPln )
|
||||
toreverse = !toreverse;
|
||||
// On regarde si l orientation du Chamfer est la meme que celle du plan
|
||||
if (toreverse)
|
||||
{Data->ChangeOrientation() = TopAbs::Reverse(Ofpl);}
|
||||
else
|
||||
{Data->ChangeOrientation() = Ofpl;}
|
||||
|
||||
TopAbs_Orientation trans = TopAbs_FORWARD;
|
||||
if ((!plandab && toreverse) || (plandab && !toreverse))
|
||||
{trans=TopAbs_REVERSED;}
|
||||
|
||||
//trans permet de determiner le cote "matiere" sur S1(2) delimite par L3d
|
||||
if (plandab)
|
||||
{Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);}
|
||||
else
|
||||
{Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);}
|
||||
|
||||
//------------edge cylindre-Chamfer
|
||||
gp_Pnt2d PCyl2d(UOnCyl,VOnCyl);
|
||||
gp_Dir2d VCyl2d=gp::DY2d();
|
||||
if ( XDir.Dot(AxCyl.Direction())<0 )
|
||||
{VCyl2d.Reverse();}
|
||||
gp_Lin2d Lin2dCyl(PCyl2d,VCyl2d);
|
||||
|
||||
POnCyl = ElSLib::Value(UOnCyl,VOnCyl,Cyl);
|
||||
C3d = gp_Lin(POnCyl,XDir);
|
||||
|
||||
ElSLib::PlaneParameters(AxCh,POnCyl,U,VOnChamfer);
|
||||
LOnChamfer = gp_Lin2d(gp_Pnt2d(U,VOnChamfer),gp::DX2d());
|
||||
|
||||
L3d = new Geom_Line (C3d);
|
||||
LFac = new Geom2d_Line(Lin2dCyl);
|
||||
LFil = new Geom2d_Line(LOnChamfer);
|
||||
|
||||
gp_Vec deru,derv;
|
||||
ElSLib::CylinderD1(UOnCyl,VOnCyl,AxCyl,Cyl.Radius(),POnCyl,deru,derv);
|
||||
gp_Dir NorCyl(deru.Crossed(derv));
|
||||
|
||||
toreverse = ( NorFil.Dot(NorCyl) <= 0. );
|
||||
|
||||
gp_Dir DirSCyl(gp_Vec(OrSpine, POnCyl));
|
||||
Standard_Boolean PosChamfCyl = DirPlnCyl.Dot(DirSCyl) < 0;
|
||||
|
||||
|
||||
if (PosChamfCyl)
|
||||
toreverse = !toreverse;
|
||||
|
||||
trans = TopAbs_REVERSED;
|
||||
if ((!plandab && toreverse) || (plandab && !toreverse))
|
||||
{trans=TopAbs_FORWARD;}
|
||||
|
||||
if (plandab)
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);
|
||||
else
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),trans,LFac,LFil);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
45
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.hxx
Executable file
45
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.hxx
Executable file
@@ -0,0 +1,45 @@
|
||||
// File: ChFiKPart_ComputeData_ChPlnCyl.hxx
|
||||
// Created: Mon May 22 12:04:42 1995
|
||||
// Author: Stagiaire Flore Lantheaume
|
||||
// <fla@phylox>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_ChPlnCyl_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_ChPlnCyl_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab);
|
||||
|
||||
// File: ChFiKPart_ComputeData_ChPlnCyl.cxx
|
||||
// Created: Fri May 10 09:43:15 1996
|
||||
// Author: Stagiaire Xuan Trang PHAMPHU
|
||||
// <xpu@phylox>
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab);
|
||||
|
||||
#endif
|
219
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnPln.cxx
Executable file
219
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnPln.cxx
Executable file
@@ -0,0 +1,219 @@
|
||||
// File: ChFiKPart_ComputeData_ChPlnPln.cxx
|
||||
// Created: Fri Apr 28 09:48:55 1995
|
||||
// Author Flore Lantheaume
|
||||
// <fla@phylox>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
|
||||
#include <Geom_Plane.hxx>
|
||||
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChamfer
|
||||
//Purpose : Compute the chamfer in the particular case plane/plane.
|
||||
// Compute the SurfData <Data> of the chamfer on the <Spine>
|
||||
// between the plane <Pl1> and the plane <Pl2>, with distances
|
||||
// <Dis1> on <Pl1> and <Dis2> on <Pl2>.
|
||||
// <First> is the parameter of the start point on the <Spine>
|
||||
// <Or1> and <Or2> are the orientations of the plane <Pl1> and
|
||||
// <Pl2>, and <Of1> the orientation of the face build on the
|
||||
// plane <Pl1>.
|
||||
//Out : True if the chamfer has been computed
|
||||
// False else
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Of1)
|
||||
{
|
||||
|
||||
// Creation of the plane which carry the chamfer
|
||||
|
||||
// compute the normals to the planes Pl1 and Pl2
|
||||
gp_Ax3 Pos1 = Pl1.Position();
|
||||
gp_Dir D1 = Pos1.XDirection().Crossed(Pos1.YDirection());
|
||||
if (Or1 == TopAbs_REVERSED) { D1.Reverse(); }
|
||||
gp_Ax3 Pos2 = Pl2.Position();
|
||||
gp_Dir D2 = Pos2.XDirection().Crossed(Pos2.YDirection());
|
||||
if (Or2 == TopAbs_REVERSED) { D2.Reverse(); }
|
||||
|
||||
// compute the intersection line of Pl1 and Pl2
|
||||
IntAna_QuadQuadGeo LInt (Pl1,Pl2,Precision::Angular(),
|
||||
Precision::Confusion());
|
||||
|
||||
gp_Pnt P;
|
||||
Standard_Real Fint;
|
||||
if (LInt.IsDone()) {
|
||||
Fint = ElCLib::Parameter(LInt.Line(1),ElCLib::Value(First,Spine));
|
||||
P = ElCLib::Value(Fint,LInt.Line(1));
|
||||
}
|
||||
else { return Standard_False; }
|
||||
|
||||
gp_Dir LinAx1 = Spine.Direction();
|
||||
gp_Dir VecTransl1 = LinAx1.Crossed(D1);
|
||||
if ( VecTransl1.Dot(D2) <=0. )
|
||||
VecTransl1.Reverse();
|
||||
|
||||
gp_Dir VecTransl2 = LinAx1.Crossed(D2);
|
||||
if ( VecTransl2.Dot(D1) <=0. )
|
||||
VecTransl2.Reverse();
|
||||
|
||||
|
||||
// Compute a point on the plane Pl1 and on the chamfer
|
||||
gp_Pnt P1( P.X()+Dis1*VecTransl1.X(),
|
||||
P.Y()+Dis1*VecTransl1.Y(),
|
||||
P.Z()+Dis1*VecTransl1.Z());
|
||||
|
||||
// Point on the plane Pl2 and on the chamfer
|
||||
gp_Pnt P2( P.X()+Dis2*VecTransl2.X(),
|
||||
P.Y()+Dis2*VecTransl2.Y(),
|
||||
P.Z()+Dis2*VecTransl2.Z());
|
||||
|
||||
//the middle point of P1 P2 is the origin of the chamfer
|
||||
gp_Pnt Po ( (P1.X()+P2.X())/2. ,(P1.Y()+P2.Y())/2. , (P1.Z()+P2.Z())/2. );
|
||||
|
||||
// compute a second point on the plane Pl2
|
||||
gp_Pnt Pp = ElCLib::Value(Fint+10.,LInt.Line(1));
|
||||
gp_Pnt P22(Pp.X()+Dis2*VecTransl2.X(),
|
||||
Pp.Y()+Dis2*VecTransl2.Y(),
|
||||
Pp.Z()+Dis2*VecTransl2.Z());
|
||||
|
||||
// Compute the normal vector <AxisPlan> to the chamfer's plane
|
||||
gp_Dir V1 ( P2.X()-P1.X(), P2.Y()-P1.Y(), P2.Z()-P1.Z());
|
||||
gp_Dir V2 ( P22.X()-P1.X(), P22.Y()-P1.Y(), P22.Z()-P1.Z());
|
||||
gp_Dir AxisPlan = V1.Crossed(V2);
|
||||
|
||||
gp_Dir xdir = LinAx1; // u axis
|
||||
gp_Ax3 PlanAx3 ( Po, AxisPlan, xdir);
|
||||
if (PlanAx3.YDirection().Dot(D2)>=0.) PlanAx3.YReverse();
|
||||
|
||||
Handle(Geom_Plane) gpl= new Geom_Plane(PlanAx3);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gpl,DStr));
|
||||
|
||||
|
||||
// About the orientation of the chamfer plane
|
||||
// Compute the normal to the face 1
|
||||
gp_Dir norpl = Pos1.XDirection().Crossed(Pos1.YDirection());
|
||||
gp_Dir norface1 = norpl;
|
||||
if (Of1 == TopAbs_REVERSED ) { norface1.Reverse(); }
|
||||
|
||||
// Compute the orientation of the chamfer plane
|
||||
gp_Dir norplch = gpl->Pln().Position().XDirection().Crossed (
|
||||
gpl->Pln().Position().YDirection());
|
||||
|
||||
gp_Dir DirCh12(gp_Vec(P1, P2));
|
||||
Standard_Boolean toreverse = ( norplch.Dot(norface1) <= 0. );
|
||||
if (VecTransl1.Dot(DirCh12) > 0) toreverse = !toreverse;
|
||||
|
||||
if (toreverse)
|
||||
Data->ChangeOrientation() = TopAbs_REVERSED;
|
||||
else
|
||||
Data->ChangeOrientation() = TopAbs_FORWARD;
|
||||
|
||||
|
||||
|
||||
// Loading of the FaceInterferences with pcurves & 3d curves.
|
||||
|
||||
// case face 1
|
||||
gp_Lin linPln(P1, xdir);
|
||||
Handle(Geom_Line) GLinPln1 = new Geom_Line(linPln);
|
||||
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(Pos1,P1,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d dir2dPln( xdir.Dot(Pos1.XDirection()),
|
||||
xdir.Dot(Pos1.YDirection()));
|
||||
gp_Lin2d lin2dPln(p2dPln,dir2dPln);
|
||||
Handle(Geom2d_Line) GLin2dPln1 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
ElSLib::PlaneParameters(PlanAx3,P1,u,v);
|
||||
p2dPln.SetCoord(u,v);
|
||||
lin2dPln.SetLocation(p2dPln);
|
||||
lin2dPln.SetDirection(gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dPlnCh1 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
TopAbs_Orientation trans;
|
||||
toreverse = ( norplch.Dot(norpl) <= 0. );
|
||||
if (VecTransl1.Dot(DirCh12) > 0) toreverse = !toreverse;
|
||||
if (toreverse)
|
||||
trans = TopAbs_FORWARD;
|
||||
else
|
||||
trans = TopAbs_REVERSED;
|
||||
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln1,DStr),
|
||||
trans,GLin2dPln1,GLin2dPlnCh1);
|
||||
|
||||
|
||||
// case face 2
|
||||
|
||||
linPln.SetLocation(P2);
|
||||
Handle(Geom_Line) GLinPln2 = new Geom_Line(linPln);
|
||||
|
||||
ElSLib::PlaneParameters(Pos2,P2,u,v);
|
||||
p2dPln.SetCoord(u,v);
|
||||
dir2dPln.SetCoord( xdir.Dot(Pos2.XDirection()),
|
||||
xdir.Dot(Pos2.YDirection()));
|
||||
lin2dPln.SetLocation(p2dPln);
|
||||
lin2dPln.SetDirection(dir2dPln);
|
||||
Handle(Geom2d_Line) GLin2dPln2 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
ElSLib::PlaneParameters(PlanAx3,P2,u,v);
|
||||
p2dPln.SetCoord(u,v);
|
||||
lin2dPln.SetLocation(p2dPln);
|
||||
lin2dPln.SetDirection(gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dPlnCh2 = new Geom2d_Line(lin2dPln);
|
||||
|
||||
|
||||
norpl = Pos2.XDirection().Crossed(Pos2.YDirection());
|
||||
toreverse = ( norplch.Dot(norpl) <= 0. );
|
||||
if (VecTransl2.Dot(DirCh12) < 0) toreverse = !toreverse;
|
||||
if (toreverse)
|
||||
trans = TopAbs_REVERSED;
|
||||
else
|
||||
trans = TopAbs_FORWARD;
|
||||
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln2,DStr),
|
||||
trans,GLin2dPln2,GLin2dPlnCh2);
|
||||
|
||||
return Standard_True;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
23
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnPln.hxx
Executable file
23
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnPln.hxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: ChFiKPart_ComputeData_ChPlnPln..hxx
|
||||
// Created: Fri Apr 28 09:52:32 1995
|
||||
// Author: Stagiaire Flore Lautheanne
|
||||
// <fla@phylox>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_ChPlnPln_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_ChPlnPln_HeaderFile
|
||||
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Of1);
|
||||
|
||||
#endif
|
189
src/ChFiKPart/ChFiKPart_ComputeData_Fcts.cxx
Executable file
189
src/ChFiKPart/ChFiKPart_ComputeData_Fcts.cxx
Executable file
@@ -0,0 +1,189 @@
|
||||
// File: ChFiKPart_ComputeData_Fcts.cxx
|
||||
// Created: Mon May 22 13:50:25 1995
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
|
||||
#include <TopOpeBRepDS_Curve.hxx>
|
||||
#include <TopOpeBRepDS_Surface.hxx>
|
||||
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : InPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real ChFiKPart_InPeriod(const Standard_Real U,
|
||||
const Standard_Real UFirst,
|
||||
const Standard_Real ULast,
|
||||
const Standard_Real Eps)
|
||||
{
|
||||
Standard_Real u = U, period = ULast - UFirst;
|
||||
while (Eps < (UFirst-u)) u += period;
|
||||
while (Eps > (ULast -u)) u -= period;
|
||||
if ( u < UFirst) u = UFirst;
|
||||
return u;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PCurve
|
||||
//purpose : Calcule une droite sous forme de BSpline pour garantir
|
||||
// les parametres.
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom2d_BSplineCurve) ChFiKPart_PCurve(const gp_Pnt2d& UV1,
|
||||
const gp_Pnt2d& UV2,
|
||||
const Standard_Real Pardeb,
|
||||
const Standard_Real Parfin)
|
||||
{
|
||||
TColgp_Array1OfPnt2d p(1,2);
|
||||
TColStd_Array1OfReal k(1,2);
|
||||
TColStd_Array1OfInteger m(1,2);
|
||||
m.Init(2);
|
||||
k(1) = Pardeb;
|
||||
k(2) = Parfin;
|
||||
p(1) = UV1;
|
||||
p(2) = UV2;
|
||||
Handle(Geom2d_BSplineCurve) Pcurv = new Geom2d_BSplineCurve(p,k,m,1);
|
||||
return Pcurv;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ProjPC
|
||||
//purpose : Pour les coins spheriques dont les contours ne sont
|
||||
// pas des isos on projette le cercle.
|
||||
//=======================================================================
|
||||
|
||||
void ChFiKPart_ProjPC(const GeomAdaptor_Curve& Cg,
|
||||
const GeomAdaptor_Surface& Sg,
|
||||
Handle(Geom2d_Curve)& Pcurv)
|
||||
{
|
||||
if (Sg.GetType() < GeomAbs_BezierSurface) {
|
||||
Handle(GeomAdaptor_HCurve) HCg = new GeomAdaptor_HCurve(Cg);
|
||||
Handle(GeomAdaptor_HSurface) HSg = new GeomAdaptor_HSurface(Sg);
|
||||
ProjLib_ProjectedCurve Projc (HSg,HCg);
|
||||
switch (Projc.GetType()) {
|
||||
case GeomAbs_Line :
|
||||
{
|
||||
Pcurv = new Geom2d_Line(Projc.Line());
|
||||
}
|
||||
break;
|
||||
case GeomAbs_BezierCurve :
|
||||
{
|
||||
Handle(Geom2d_BezierCurve) BezProjc = Projc.Bezier();
|
||||
TColgp_Array1OfPnt2d TP(1,BezProjc->NbPoles());
|
||||
if (BezProjc->IsRational()) {
|
||||
TColStd_Array1OfReal TW(1,BezProjc->NbPoles());
|
||||
BezProjc->Poles(TP);
|
||||
BezProjc->Weights(TW);
|
||||
Pcurv = new Geom2d_BezierCurve(TP,TW);
|
||||
}
|
||||
else {
|
||||
BezProjc->Poles(TP);
|
||||
Pcurv = new Geom2d_BezierCurve(TP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
TColgp_Array1OfPnt2d TP(1,Projc.NbPoles());
|
||||
if (Projc.IsRational()) {
|
||||
TColStd_Array1OfReal TW(1,Projc.NbPoles());
|
||||
Projc.PolesAndWeights(TP,TW);
|
||||
Pcurv = new Geom2d_BezierCurve(TP,TW);
|
||||
}
|
||||
else {
|
||||
Projc.Poles(TP);
|
||||
Pcurv = new Geom2d_BezierCurve(TP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case GeomAbs_BSplineCurve :
|
||||
{
|
||||
Handle(Geom2d_BSplineCurve) BspProjc = Projc.BSpline();
|
||||
TColgp_Array1OfPnt2d TP(1,BspProjc->NbPoles());
|
||||
TColStd_Array1OfReal TK(1,BspProjc->NbKnots());
|
||||
TColStd_Array1OfInteger TM(1,BspProjc->NbKnots());
|
||||
|
||||
BspProjc->Knots(TK);
|
||||
BspProjc->Multiplicities(TM);
|
||||
if (BspProjc->IsRational()) {
|
||||
TColStd_Array1OfReal TW(1,BspProjc->NbPoles());
|
||||
BspProjc->Poles(TP);
|
||||
BspProjc->Weights(TW);
|
||||
Pcurv = new Geom2d_BSplineCurve(TP,TW,TK,TM,BspProjc->Degree());
|
||||
}
|
||||
else {
|
||||
BspProjc->Poles(TP);
|
||||
Pcurv = new Geom2d_BSplineCurve(TP,TK,TM,BspProjc->Degree());
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
TColgp_Array1OfPnt2d TP(1,Projc.NbPoles());
|
||||
TColStd_Array1OfReal TK(1,Projc.NbKnots());
|
||||
TColStd_Array1OfInteger TM(1,Projc.NbKnots());
|
||||
Projc.KnotsAndMultiplicities(TK,TM);
|
||||
if (Projc.IsRational()) {
|
||||
TColStd_Array1OfReal TW(1,Projc.NbPoles());
|
||||
Projc.PolesAndWeights(TP,TW);
|
||||
Pcurv = new Geom2d_BSplineCurve(TP,TW,TK,TM,Projc.Degree());
|
||||
}
|
||||
else {
|
||||
Projc.Poles(TP);
|
||||
Pcurv = new Geom2d_BSplineCurve(TP,TK,TM,Projc.Degree());
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default :
|
||||
Standard_NotImplemented::Raise("echec approximation de la pcurve ");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_NotImplemented::Raise("approx pcurve sur une surface gauche");
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IndexCurveInDS
|
||||
//purpose : Met une Curve dans la DS et renvoie son index.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer ChFiKPart_IndexCurveInDS(const Handle(Geom_Curve)& C,
|
||||
TopOpeBRepDS_DataStructure& DStr)
|
||||
{
|
||||
return DStr.AddCurve(TopOpeBRepDS_Curve(C,0.));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IndexSurfaceInDS
|
||||
//purpose : Met une Surface dans la DS et renvoie son index.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer ChFiKPart_IndexSurfaceInDS(const Handle(Geom_Surface)& S,
|
||||
TopOpeBRepDS_DataStructure& DStr)
|
||||
{
|
||||
return DStr.AddSurface(TopOpeBRepDS_Surface(S,0.));
|
||||
}
|
||||
|
41
src/ChFiKPart/ChFiKPart_ComputeData_Fcts.hxx
Executable file
41
src/ChFiKPart/ChFiKPart_ComputeData_Fcts.hxx
Executable file
@@ -0,0 +1,41 @@
|
||||
// File: ChFiKPart_ComputeData_Fcts.hxx
|
||||
// Created: Mon May 22 13:52:09 1995
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_Fcts_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_Fcts_HeaderFile
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <TopOpeBRepDS_DataStructure.hxx>
|
||||
|
||||
Standard_Real ChFiKPart_InPeriod(const Standard_Real U,
|
||||
const Standard_Real UFirst,
|
||||
const Standard_Real ULast,
|
||||
const Standard_Real Eps);
|
||||
|
||||
Handle(Geom2d_BSplineCurve) ChFiKPart_PCurve(const gp_Pnt2d& UV1,
|
||||
const gp_Pnt2d& UV2,
|
||||
const Standard_Real Pardeb,
|
||||
const Standard_Real Parfin);
|
||||
|
||||
void ChFiKPart_ProjPC(const GeomAdaptor_Curve& Cg,
|
||||
const GeomAdaptor_Surface& Sg,
|
||||
Handle(Geom2d_Curve)& Pcurv);
|
||||
|
||||
Standard_EXPORT Standard_Integer ChFiKPart_IndexCurveInDS(const Handle(Geom_Curve)& C,
|
||||
TopOpeBRepDS_DataStructure& DStr);
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer ChFiKPart_IndexSurfaceInDS(const Handle(Geom_Surface)& S,
|
||||
TopOpeBRepDS_DataStructure& DStr);
|
||||
|
||||
|
||||
#endif
|
263
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCon.cxx
Executable file
263
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCon.cxx
Executable file
@@ -0,0 +1,263 @@
|
||||
// File: ChFiKPart_CompData_PlnCon.cxx
|
||||
// Created: Thu Feb 3 15:04:25 1994
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@zerox>
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeFillet
|
||||
//purpose : cas cone/plan ou plan/cone.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab)
|
||||
{
|
||||
//calcul du conge (tore ou sphere).
|
||||
Standard_Boolean c1sphere = Standard_False;
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpnat = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
gp_Dir Dp = Dpnat;
|
||||
gp_Dir Df = Dp;
|
||||
if (Or1 == TopAbs_REVERSED) { Dp.Reverse(); }
|
||||
if (Ofpl == TopAbs_REVERSED) { Df.Reverse(); }
|
||||
|
||||
gp_Pnt Or = Con.Location();
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(PosPl,Or,u,v);
|
||||
gp_Pnt2d c2dPln(u,v);
|
||||
ElSLib::PlaneD0(u,v,PosPl,Or);
|
||||
gp_Pnt cPln = Or;
|
||||
Or.SetCoord(Or.X()+Radius*Dp.X(),
|
||||
Or.Y()+Radius*Dp.Y(),
|
||||
Or.Z()+Radius*Dp.Z());
|
||||
|
||||
gp_Pnt PtSp;
|
||||
gp_Vec DSp;
|
||||
ElCLib::D1(First,Spine,PtSp,DSp);
|
||||
IntAna_QuadQuadGeo CInt (Pln,Con,Precision::Angular(),
|
||||
Precision::Confusion());
|
||||
gp_Pnt Pv;
|
||||
if (CInt.IsDone()) {
|
||||
//On met l origine du conge au point de depart fourni sur la
|
||||
//ligne guide.
|
||||
Pv = ElCLib::Value(ElCLib::Parameter(CInt.Circle(1),PtSp),
|
||||
CInt.Circle(1));
|
||||
}
|
||||
else { return Standard_False; }
|
||||
gp_Dir Dx(gp_Vec(cPln,Pv));
|
||||
gp_Dir Dy(DSp);
|
||||
ElSLib::Parameters(Con,Pv,u,v);
|
||||
gp_Pnt PtCon;
|
||||
gp_Vec Vu,Vv;
|
||||
ElSLib::D1(u,v,Con,PtCon,Vu,Vv);
|
||||
gp_Dir Dc(Vu.Crossed(Vv));
|
||||
if (Or2 == TopAbs_REVERSED) { Dc.Reverse(); }
|
||||
gp_Dir Dz = Dp;
|
||||
|
||||
gp_Pnt pp(Pv.X()+Dc.X(),Pv.Y()+Dc.Y(),Pv.Z()+Dc.Z());
|
||||
ElSLib::PlaneParameters(PosPl,pp,u,v);
|
||||
ElSLib::PlaneD0(u,v,PosPl,pp);
|
||||
gp_Dir ddp(gp_Vec(Pv,pp));
|
||||
ElSLib::Parameters(Con,Pv,u,v);
|
||||
gp_Vec dcu,dcv;
|
||||
ElSLib::D1(u,v,Con,pp,dcu,dcv);
|
||||
gp_Dir ddc(dcv);
|
||||
if(ddc.Dot(Dp) < 0.) ddc.Reverse();
|
||||
Standard_Real Ang = ddp.Angle(ddc);
|
||||
Standard_Real Rabio = Radius/Tan(Ang/2);
|
||||
Standard_Real Maxrad = cPln.Distance(Pv);
|
||||
Standard_Real Rad;
|
||||
Standard_Boolean dedans = Dx.Dot(Dc) <= 0. ;
|
||||
if( dedans ){
|
||||
if (!plandab){ Dz.Reverse(); }
|
||||
Rad = Maxrad - Rabio;
|
||||
if(Abs(Rad) <= Precision::Confusion()){ c1sphere = Standard_True; }
|
||||
else if(Rad < 0){
|
||||
cout<<"le conge ne passe pas"<<endl;
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (plandab){ Dz.Reverse(); }
|
||||
Rad = Maxrad + Rabio;
|
||||
}
|
||||
gp_Ax3 FilAx3(Or,Dz,Dx);
|
||||
if (FilAx3.YDirection().Dot(Dy) <= 0.){ FilAx3.YReverse(); }
|
||||
|
||||
if(c1sphere) {
|
||||
Handle(Geom_SphericalSurface)
|
||||
gsph = new Geom_SphericalSurface(FilAx3,Radius);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gsph,DStr));
|
||||
}
|
||||
else{
|
||||
Handle(Geom_ToroidalSurface)
|
||||
gtor = new Geom_ToroidalSurface(FilAx3,Rad,Radius);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gtor,DStr));
|
||||
}
|
||||
|
||||
// On regarde si l orientation du conge est la meme que celle
|
||||
// des faces.
|
||||
gp_Pnt P,PP;
|
||||
gp_Vec deru,derv;
|
||||
P.SetCoord(cPln.X()+Rad*Dx.X(),
|
||||
cPln.Y()+Rad*Dx.Y(),
|
||||
cPln.Z()+Rad*Dx.Z());
|
||||
if(c1sphere){
|
||||
ElSLib::SphereParameters(FilAx3,Rad,P,u,v);
|
||||
ElSLib::SphereD1(u,v,FilAx3,Rad,PP,deru,derv);
|
||||
}
|
||||
else{
|
||||
ElSLib::TorusParameters(FilAx3,Rad,Radius,P,u,v);
|
||||
ElSLib::TorusD1(u,v,FilAx3,Rad,Radius,PP,deru,derv);
|
||||
if(!plandab && Ang < PI/2 && dedans) v = v + 2*PI;
|
||||
}
|
||||
gp_Pnt2d p2dFil(0.,v);
|
||||
gp_Dir norFil(deru.Crossed(derv));
|
||||
Standard_Boolean toreverse = ( norFil.Dot(Df) <= 0. );
|
||||
if (toreverse) { Data->ChangeOrientation() = TopAbs_REVERSED; }
|
||||
else { Data->ChangeOrientation() = TopAbs_FORWARD; }
|
||||
|
||||
// On charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
// La face plane.
|
||||
// --------------
|
||||
|
||||
Handle(Geom2d_Circle) GCirc2dPln;
|
||||
Handle(Geom_Circle) GCircPln;
|
||||
gp_Ax2 circAx2 = FilAx3.Ax2();
|
||||
if(!c1sphere){
|
||||
ElSLib::PlaneParameters(PosPl,P,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d d2d(DSp.Dot(PosPl.XDirection()),DSp.Dot(PosPl.YDirection()));
|
||||
gp_Ax22d ax2dPln(c2dPln,gp_Dir2d(gp_Vec2d(c2dPln,p2dPln)),d2d);
|
||||
gp_Circ2d circ2dPln(ax2dPln,Rad);
|
||||
GCirc2dPln = new Geom2d_Circle(circ2dPln);
|
||||
circAx2.SetLocation(cPln);
|
||||
gp_Circ circPln(circAx2,Rad);
|
||||
GCircPln = new Geom_Circle(circPln);
|
||||
}
|
||||
gp_Lin2d lin2dFil(p2dFil,gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dFil1 = new Geom2d_Line(lin2dFil);
|
||||
toreverse = ( norFil.Dot(Dpnat) <= 0. );
|
||||
TopAbs_Orientation trans;
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ){
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircPln,DStr),
|
||||
trans,GCirc2dPln,GLin2dFil1);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircPln,DStr),
|
||||
trans,GCirc2dPln,GLin2dFil1);
|
||||
}
|
||||
|
||||
// La face conique.
|
||||
// ----------------
|
||||
|
||||
P.SetCoord(Pv.X()+Rabio*ddc.X(),
|
||||
Pv.Y()+Rabio*ddc.Y(),
|
||||
Pv.Z()+Rabio*ddc.Z());
|
||||
if(c1sphere){
|
||||
ElSLib::SphereParameters(FilAx3,Radius,P,u,v);
|
||||
ElSLib::SphereD1(u,v,FilAx3,Radius,PP,deru,derv);
|
||||
}
|
||||
else{
|
||||
ElSLib::TorusParameters(FilAx3,Rad,Radius,P,u,v);
|
||||
ElSLib::TorusD1(u,v,FilAx3,Rad,Radius,PP,deru,derv);
|
||||
if(plandab && Ang < PI/2 && dedans) v = v + 2*PI;
|
||||
}
|
||||
norFil = deru.Crossed(derv);
|
||||
p2dFil.SetCoord(0.,v);
|
||||
lin2dFil.SetLocation(p2dFil);
|
||||
Handle(Geom2d_Line) GLin2dFil2 = new Geom2d_Line(lin2dFil);
|
||||
ElSLib::Parameters(Con,P,u,v);
|
||||
Standard_Real tol = Precision::PConfusion();
|
||||
Standard_Boolean careaboutsens = 0;
|
||||
if(Abs(lu - fu - 2*PI) < tol) careaboutsens = 1;
|
||||
if(u >= fu - tol && u < fu) u = fu;
|
||||
if(u <= lu + tol && u > lu) u = lu;
|
||||
if(u < fu || u > lu) u = ElCLib::InPeriod(u,fu,fu + 2*PI);
|
||||
ElSLib::D1(u,v,Con,PP,deru,derv);
|
||||
gp_Dir norCon = deru.Crossed(derv);
|
||||
gp_Dir2d d2dCon = gp::DX2d();
|
||||
if( deru.Dot(Dy) < 0. ){
|
||||
d2dCon.Reverse();
|
||||
if(careaboutsens && Abs(fu-u)<tol) u = lu;
|
||||
}
|
||||
else if(careaboutsens && Abs(lu-u)<tol) u = fu;
|
||||
gp_Pnt2d p2dCon(u,v);
|
||||
gp_Lin2d lin2dCon(p2dCon,d2dCon);
|
||||
Handle(Geom2d_Line) GLin2dCon = new Geom2d_Line(lin2dCon);
|
||||
Standard_Real scal = gp_Vec(Dp).Dot(gp_Vec(Pv,P));
|
||||
PP.SetCoord(cPln.X()+scal*Dp.X(),
|
||||
cPln.Y()+scal*Dp.Y(),
|
||||
cPln.Z()+scal*Dp.Z());
|
||||
circAx2.SetLocation(PP);
|
||||
gp_Circ circCon(circAx2,P.Distance(PP));
|
||||
Handle(Geom_Circle) GCircCon = new Geom_Circle(circCon);
|
||||
toreverse = ( norFil.Dot(norCon) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ){
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircCon,DStr),
|
||||
trans,GLin2dCon,GLin2dFil2);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircCon,DStr),
|
||||
trans,GLin2dCon,GLin2dFil2);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
26
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCon.hxx
Executable file
26
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCon.hxx
Executable file
@@ -0,0 +1,26 @@
|
||||
// File: ChFiKPart_ComputeData_PlnCon.hxx
|
||||
// Created: Tue Apr 12 10:44:18 1994
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@phylox>
|
||||
|
||||
|
||||
#ifndef ChFiKPart_ComputeData_PlnCon_HeaderFile
|
||||
#define ChFiKPart_ComputeData_PlnCon_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab);
|
||||
|
||||
|
||||
|
||||
#endif
|
449
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCyl.cxx
Executable file
449
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCyl.cxx
Executable file
@@ -0,0 +1,449 @@
|
||||
// File: ChFiKPart_CompData_PlnCyl.gxx
|
||||
// Created: Thu Feb 3 15:03:17 1994
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@zerox>
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeFillet
|
||||
//purpose : cas cylindre/plan ou plan/cylindre.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab)
|
||||
{
|
||||
//calcul du conge cylindre.
|
||||
|
||||
//plan deporte de radius
|
||||
gp_Ax3 AxPln = Pln.Position();
|
||||
gp_Dir NorPln = AxPln.XDirection().Crossed(AxPln.YDirection());
|
||||
gp_Dir NorF(NorPln);
|
||||
gp_Ax3 AxCyl = Cyl.Position();
|
||||
|
||||
if (Or1 == TopAbs_REVERSED) { NorF.Reverse(); }
|
||||
gp_Pln PlanOffset = Pln.Translated(Radius*gp_Vec(NorF));
|
||||
|
||||
// Cylindre parallele
|
||||
Standard_Real ROff = Cyl.Radius();
|
||||
Standard_Boolean dedans = Standard_False;
|
||||
|
||||
if ((Or2 == TopAbs_FORWARD && Cyl.Direct()) ||
|
||||
(Or2 == TopAbs_REVERSED && !Cyl.Direct()))
|
||||
ROff+=Radius;
|
||||
else if (Radius < ROff) {
|
||||
ROff-=Radius;dedans = Standard_True;
|
||||
}
|
||||
else {
|
||||
#ifdef DEB
|
||||
cout<<"le conge ne passe pas"<<endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
// intersection du plan parallele et du cylindre parallele.
|
||||
gp_Cylinder CylOffset(Cyl.Position(),ROff);
|
||||
IntAna_QuadQuadGeo LInt(PlanOffset,CylOffset,
|
||||
Precision::Angular(),Precision::Confusion());
|
||||
gp_Pnt OrSpine = ElCLib::Value(First,Spine);
|
||||
gp_Pnt OrFillet;
|
||||
gp_Dir DirFillet;
|
||||
if (LInt.IsDone()) {
|
||||
DirFillet = LInt.Line(1).Direction();
|
||||
gp_Pnt P1 = ElCLib::Value(ElCLib::Parameter
|
||||
(LInt.Line(1),OrSpine),LInt.Line(1));
|
||||
if(LInt.NbSolutions() == 2){
|
||||
gp_Pnt P2 = ElCLib::Value(ElCLib::Parameter
|
||||
(LInt.Line(2),OrSpine),LInt.Line(2));
|
||||
if (P1.SquareDistance(OrSpine) < P2.SquareDistance(OrSpine)) {
|
||||
OrFillet = P1;
|
||||
}
|
||||
else { OrFillet = P2;}
|
||||
}
|
||||
else { OrFillet = P1;}
|
||||
}
|
||||
else {return Standard_False;}
|
||||
|
||||
// Construction conge
|
||||
if (DirFillet.Dot(Spine.Direction()) < 0.) {DirFillet.Reverse();}
|
||||
|
||||
Standard_Real UOnCyl,VOnCyl,UOnPln,VOnPln;
|
||||
ElSLib::Parameters(Cyl,OrFillet,UOnCyl,VOnCyl);
|
||||
Standard_Real tesp = Precision::Confusion();
|
||||
if(UOnCyl < fu - tesp || UOnCyl > lu + tesp)
|
||||
UOnCyl = ElCLib::InPeriod(UOnCyl,fu,fu+2*PI);
|
||||
ElSLib::Parameters(Pln,OrFillet,UOnPln,VOnPln);
|
||||
|
||||
gp_Vec XDir,OtherDir;
|
||||
XDir = NorF.Reversed();
|
||||
OtherDir = gp_Dir(gp_Vec(OrFillet,ElSLib::Value(UOnCyl,VOnCyl,Cyl)));
|
||||
|
||||
if (!plandab) {
|
||||
gp_Vec tmp = XDir;
|
||||
XDir = OtherDir;
|
||||
OtherDir = tmp;
|
||||
}
|
||||
gp_Ax3 AxFil (OrFillet,DirFillet,XDir);
|
||||
// construction YDir pour aller de face1 vers face2.
|
||||
if ((XDir^OtherDir).Dot(DirFillet) < 0.)
|
||||
AxFil.YReverse();
|
||||
|
||||
Handle(Geom_CylindricalSurface)
|
||||
Fillet = new Geom_CylindricalSurface(AxFil,Radius);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(Fillet,DStr));
|
||||
|
||||
// On charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
// edge plan-Fillet
|
||||
gp_Pnt2d PPln2d(UOnPln,VOnPln);
|
||||
gp_Dir2d VPln2d(DirFillet.Dot(AxPln.XDirection()),
|
||||
DirFillet.Dot(AxPln.YDirection()));
|
||||
gp_Lin2d Lin2dPln(PPln2d,VPln2d);
|
||||
gp_Pnt POnPln = ElSLib::Value(UOnPln,VOnPln,Pln);
|
||||
gp_Lin C3d(POnPln,DirFillet);
|
||||
Standard_Real UOnFillet,V;
|
||||
ElSLib::CylinderParameters(AxFil,Radius,POnPln,UOnFillet,V);
|
||||
if(UOnFillet > PI) UOnFillet = 0.;
|
||||
gp_Lin2d LOnFillet(gp_Pnt2d(UOnFillet,V),gp::DY2d());
|
||||
Handle(Geom_Line) L3d = new Geom_Line (C3d);
|
||||
Handle(Geom2d_Line) LFac = new Geom2d_Line(Lin2dPln);
|
||||
Handle(Geom2d_Line) LFil = new Geom2d_Line(LOnFillet);
|
||||
gp_Pnt P;
|
||||
gp_Vec deru,derv;
|
||||
ElSLib::CylinderD1(UOnFillet,V,AxFil,Radius,P,deru,derv);
|
||||
gp_Dir NorFil(deru.Crossed(derv));
|
||||
Standard_Boolean toreverse = ( NorFil.Dot(NorPln) <= 0. );
|
||||
// On regarde si l orientation du cylindre est la meme que celle
|
||||
// du plan.
|
||||
if (toreverse) {Data->ChangeOrientation() = TopAbs::Reverse(Ofpl);}
|
||||
else {Data->ChangeOrientation() = Ofpl;}
|
||||
|
||||
TopAbs_Orientation trans;
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ){
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
if (plandab)
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),
|
||||
trans,LFac,LFil);
|
||||
else
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),
|
||||
trans,LFac,LFil);
|
||||
|
||||
// edge cylindre-Fillet.
|
||||
gp_Pnt2d PCyl2d(UOnCyl,VOnCyl);
|
||||
gp_Dir2d DPC = gp::DY2d();
|
||||
if (DirFillet.Dot(AxCyl.Direction()) < 0.) DPC.Reverse();
|
||||
gp_Lin2d Lin2dCyl(PCyl2d,DPC);
|
||||
gp_Pnt POnCyl = ElSLib::Value(UOnCyl,VOnCyl,Cyl);
|
||||
C3d = gp_Lin(POnCyl,DirFillet);
|
||||
ElSLib::CylinderParameters(AxFil,Radius,POnCyl,UOnFillet,V);
|
||||
if(UOnFillet > PI) UOnFillet = 0.;
|
||||
LOnFillet = gp_Lin2d(gp_Pnt2d(UOnFillet,V),gp::DY2d());
|
||||
L3d = new Geom_Line (C3d);
|
||||
LFac = new Geom2d_Line(Lin2dCyl);
|
||||
LFil = new Geom2d_Line(LOnFillet);
|
||||
|
||||
ElSLib::CylinderD1(UOnFillet,V,AxFil,Radius,P,deru,derv);
|
||||
NorFil= gp_Dir(deru.Crossed(derv));
|
||||
ElSLib::CylinderD1(UOnCyl,VOnCyl,AxCyl,Cyl.Radius(),P,deru,derv);
|
||||
gp_Dir NorCyl(deru.Crossed(derv));
|
||||
|
||||
toreverse = ( NorFil.Dot(NorCyl) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ){
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
if (plandab)
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),
|
||||
trans,LFac,LFil);
|
||||
else
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(L3d,DStr),
|
||||
trans,LFac,LFil);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeFillet
|
||||
//purpose : cas cylindre/plan ou plan/cylindre.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab)
|
||||
{
|
||||
|
||||
//calcul du conge (tore ou sphere).
|
||||
Standard_Boolean c1sphere = Standard_False;
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpnat = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
gp_Dir Dp = Dpnat;
|
||||
gp_Dir Df = Dp;
|
||||
if (Or1 == TopAbs_REVERSED) { Dp.Reverse(); }
|
||||
if (Ofpl == TopAbs_REVERSED) { Df.Reverse(); }
|
||||
|
||||
gp_Pnt Or = Cyl.Location();
|
||||
Standard_Real u,v;
|
||||
ElSLib::PlaneParameters(PosPl,Or,u,v);
|
||||
gp_Pnt2d c2dPln(u,v);
|
||||
ElSLib::PlaneD0(u,v,PosPl,Or);
|
||||
gp_Pnt cPln = Or;
|
||||
Or.SetCoord(Or.X()+Radius*Dp.X(),
|
||||
Or.Y()+Radius*Dp.Y(),
|
||||
Or.Z()+Radius*Dp.Z());
|
||||
gp_Pnt PtSp;
|
||||
gp_Vec DSp;
|
||||
// Modification pour les PtSp trouves du mauvais cote de l'arete de couture.
|
||||
gp_Pnt PtSp2;
|
||||
gp_Vec DSp2;
|
||||
Standard_Real acote = 1e-7;
|
||||
ElCLib::D1(First,Spine,PtSp,DSp);
|
||||
ElSLib::Parameters(Cyl,PtSp,u,v);
|
||||
if ((Abs(u)<acote) || (Abs(u-(2*PI))<acote)){
|
||||
ElCLib::D1(First+0.2,Spine,PtSp2,DSp2);
|
||||
Standard_Real u2,v2;
|
||||
ElSLib::Parameters(Cyl,PtSp2,u2,v2);
|
||||
if (Abs(u2-u)>PI){
|
||||
u = (2*PI)-u;
|
||||
PtSp = ElSLib::Value(u,v,Cyl);
|
||||
Standard_Real PR;
|
||||
PR = ElCLib::Parameter(Spine,PtSp);
|
||||
ElCLib::D1(PR,Spine,PtSp2,DSp);
|
||||
}
|
||||
}
|
||||
// fin de modif
|
||||
gp_Dir Dx(gp_Vec(Or,PtSp));
|
||||
Dx = Dp.Crossed(Dx.Crossed(Dp));
|
||||
gp_Dir Dy(DSp);
|
||||
gp_Pnt PtCyl;
|
||||
gp_Vec Vu,Vv;
|
||||
ElSLib::D1(u,v,Cyl,PtCyl,Vu,Vv);
|
||||
gp_Dir Dc(Vu.Crossed(Vv));
|
||||
if (Or2 == TopAbs_REVERSED) { Dc.Reverse(); }
|
||||
gp_Dir Dz = Dp;
|
||||
Standard_Real Rad,cylrad = Cyl.Radius();
|
||||
Standard_Boolean dedans = (Dx.Dot(Dc) <= 0.);
|
||||
if(dedans){
|
||||
if (!plandab){ Dz.Reverse(); }
|
||||
Rad = cylrad - Radius;
|
||||
if(Abs(Rad) <= Precision::Confusion()){ c1sphere = Standard_True; }
|
||||
else if(Rad < 0){
|
||||
#ifdef DEB
|
||||
cout<<"le conge ne passe pas"<<endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (plandab){ Dz.Reverse(); }
|
||||
Rad = cylrad + Radius;
|
||||
}
|
||||
gp_Ax3 FilAx3(Or,Dz,Dx);
|
||||
if (FilAx3.YDirection().Dot(Dy) <= 0.){ FilAx3.YReverse(); }
|
||||
|
||||
if(c1sphere) {
|
||||
Handle(Geom_SphericalSurface)
|
||||
gsph = new Geom_SphericalSurface(FilAx3,Radius);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gsph,DStr));
|
||||
}
|
||||
else{
|
||||
Handle(Geom_ToroidalSurface)
|
||||
gtor = new Geom_ToroidalSurface(FilAx3,Rad,Radius);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gtor,DStr));
|
||||
}
|
||||
|
||||
// On regarde si l orientation du conge est la meme que celle
|
||||
// des faces.
|
||||
gp_Pnt P,PP;
|
||||
gp_Vec deru,derv;
|
||||
P.SetCoord(cPln.X()+Rad*Dx.X(),
|
||||
cPln.Y()+Rad*Dx.Y(),
|
||||
cPln.Z()+Rad*Dx.Z());
|
||||
u = 0.;
|
||||
if ((dedans && plandab) || (!dedans && !plandab)){
|
||||
if (c1sphere) { v = - PI / 2; }
|
||||
else { v = 3 * PI / 2; }
|
||||
}
|
||||
else { v = PI / 2; }
|
||||
gp_Dir norFil;
|
||||
if(c1sphere){
|
||||
ElSLib::SphereD1(u,v,FilAx3,cylrad,PP,deru,derv);
|
||||
norFil = FilAx3.XDirection().Crossed(FilAx3.YDirection());
|
||||
if(v < 0.) norFil.Reverse();
|
||||
}
|
||||
else{
|
||||
ElSLib::TorusD1(u,v,FilAx3,Rad,Radius,PP,deru,derv);
|
||||
norFil = gp_Dir(deru.Crossed(derv));
|
||||
}
|
||||
gp_Pnt2d p2dFil(0.,v);
|
||||
Standard_Boolean toreverse = ( norFil.Dot(Df) <= 0. );
|
||||
if (toreverse) { Data->ChangeOrientation() = TopAbs_REVERSED; }
|
||||
else { Data->ChangeOrientation() = TopAbs_FORWARD; }
|
||||
|
||||
// On charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
|
||||
// La face plane.
|
||||
Handle(Geom2d_Circle) GCirc2dPln;
|
||||
Handle(Geom_Circle) GCircPln;
|
||||
gp_Ax2 circAx2 = FilAx3.Ax2();
|
||||
if(!c1sphere){
|
||||
ElSLib::PlaneParameters(PosPl,P,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d d2d(DSp.Dot(PosPl.XDirection()),DSp.Dot(PosPl.YDirection()));
|
||||
gp_Ax22d ax2dPln(c2dPln,gp_Dir2d(gp_Vec2d(c2dPln,p2dPln)),d2d);
|
||||
gp_Circ2d circ2dPln(ax2dPln,Rad);
|
||||
GCirc2dPln = new Geom2d_Circle(circ2dPln);
|
||||
circAx2.SetLocation(cPln);
|
||||
gp_Circ circPln(circAx2,Rad);
|
||||
GCircPln = new Geom_Circle(circPln);
|
||||
}
|
||||
else {
|
||||
ElSLib::PlaneParameters(PosPl,P,u,v);
|
||||
gp_Pnt2d p2dPln(u,v),pbid;
|
||||
if(plandab){
|
||||
Data->Set2dPoints(p2dPln,p2dPln,pbid,pbid);
|
||||
}
|
||||
else {
|
||||
Data->Set2dPoints(pbid,pbid,p2dPln,p2dPln);
|
||||
}
|
||||
}
|
||||
gp_Lin2d lin2dFil(p2dFil,gp::DX2d());
|
||||
Handle(Geom2d_Line) GLin2dFil1 = new Geom2d_Line(lin2dFil);
|
||||
toreverse = ( norFil.Dot(Dpnat) <= 0. );
|
||||
TopAbs_Orientation trans;
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ){
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircPln,DStr),
|
||||
trans,GCirc2dPln,GLin2dFil1);
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircPln,DStr),
|
||||
trans,GCirc2dPln,GLin2dFil1);
|
||||
}
|
||||
|
||||
// La face cylindrique.
|
||||
P.SetCoord(Or.X()+cylrad*Dx.X(),
|
||||
Or.Y()+cylrad*Dx.Y(),
|
||||
Or.Z()+cylrad*Dx.Z());
|
||||
u = 0.;
|
||||
if (dedans) {
|
||||
if (plandab && !c1sphere) { v = 2 * PI; }
|
||||
else { v = 0. ; }
|
||||
}
|
||||
else { v = PI; }
|
||||
p2dFil.SetCoord(u,v);
|
||||
if(c1sphere){
|
||||
ElSLib::SphereD1(u,v,FilAx3,cylrad,PP,deru,derv);
|
||||
}
|
||||
else{
|
||||
ElSLib::TorusD1(u,v,FilAx3,Rad,Radius,PP,deru,derv);
|
||||
}
|
||||
norFil = deru.Crossed(derv);
|
||||
lin2dFil.SetLocation(p2dFil);
|
||||
Handle(Geom2d_Line) GLin2dFil2 = new Geom2d_Line(lin2dFil);
|
||||
ElSLib::Parameters(Cyl,P,u,v);
|
||||
Standard_Real tol = Precision::PConfusion();
|
||||
Standard_Boolean careaboutsens = 0;
|
||||
if(Abs(lu - fu - 2*PI) < tol) careaboutsens = 1;
|
||||
if(u >= fu - tol && u < fu) u = fu;
|
||||
if(u <= lu + tol && u > lu) u = lu;
|
||||
if(u < fu || u > lu) u = ChFiKPart_InPeriod(u,fu,fu + 2*PI,tol);
|
||||
ElSLib::D1(u,v,Cyl,PP,deru,derv);
|
||||
gp_Dir norcyl = deru.Crossed(derv);
|
||||
gp_Dir2d d2dCyl = gp::DX2d();
|
||||
if( deru.Dot(Dy) < 0. ){
|
||||
d2dCyl.Reverse();
|
||||
if(careaboutsens && Abs(fu-u)<tol) u = lu;
|
||||
}
|
||||
else if(careaboutsens && Abs(lu-u)<tol) u = fu;
|
||||
gp_Pnt2d p2dCyl(u,v);
|
||||
gp_Lin2d lin2dCyl(p2dCyl,d2dCyl);
|
||||
Handle(Geom2d_Line) GLin2dCyl = new Geom2d_Line(lin2dCyl);
|
||||
circAx2.SetLocation(Or);
|
||||
gp_Circ circCyl(circAx2,cylrad);
|
||||
Handle(Geom_Circle) GCircCyl = new Geom_Circle(circCyl);
|
||||
toreverse = ( norFil.Dot(norcyl) <= 0. );
|
||||
if ((toreverse && plandab) || (!toreverse && !plandab) ){
|
||||
trans = TopAbs_REVERSED;
|
||||
}
|
||||
else {
|
||||
trans = TopAbs_FORWARD;
|
||||
}
|
||||
if(plandab){
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircCyl,DStr),
|
||||
trans,GLin2dCyl,GLin2dFil2);
|
||||
|
||||
}
|
||||
else{
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GCircCyl,DStr),
|
||||
trans,GLin2dCyl,GLin2dFil2);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
38
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCyl.hxx
Executable file
38
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnCyl.hxx
Executable file
@@ -0,0 +1,38 @@
|
||||
// File: ChFiKPart_ComputeData_PlnCyl.hxx
|
||||
// Created: Tue Apr 12 10:48:01 1994
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@phylox>
|
||||
|
||||
|
||||
#ifndef ChFiKPart_ComputeData_PlnCyl_HeaderFile
|
||||
#define ChFiKPart_ComputeData_PlnCyl_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab);
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
const Standard_Boolean plandab);
|
||||
|
||||
#endif
|
140
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnPln.cxx
Executable file
140
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnPln.cxx
Executable file
@@ -0,0 +1,140 @@
|
||||
// File: ChFiKPart_CompData_PlnPln.cxx
|
||||
// Created: Thu Feb 3 15:01:51 1994
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@zerox>
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeFillet
|
||||
//Purpose : cas plan/plan.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Of1)
|
||||
{
|
||||
|
||||
//calcul du cylindre
|
||||
gp_Ax3 Pos1 = Pl1.Position();
|
||||
gp_Dir D1 = Pos1.XDirection().Crossed(Pos1.YDirection());
|
||||
if (Or1 == TopAbs_REVERSED) { D1.Reverse(); }
|
||||
gp_Ax3 Pos2 = Pl2.Position();
|
||||
gp_Dir D2 = Pos2.XDirection().Crossed(Pos2.YDirection());
|
||||
if (Or2 == TopAbs_REVERSED) { D2.Reverse(); }
|
||||
IntAna_QuadQuadGeo LInt (Pl1,Pl2,Precision::Angular(),
|
||||
Precision::Confusion());
|
||||
gp_Pnt Pv;
|
||||
if (LInt.IsDone()) {
|
||||
//On met l origine du cylindre au point de depart fourni sur la
|
||||
//ligne guide.
|
||||
Pv = ElCLib::Value(ElCLib::Parameter(LInt.Line(1),
|
||||
ElCLib::Value(First,Spine)),
|
||||
LInt.Line(1));
|
||||
}
|
||||
else { return Standard_False; }
|
||||
gp_Dir AxisCylinder = Spine.Direction();
|
||||
Standard_Real Ang = D1.Angle(D2);
|
||||
gp_Vec V = gp_Vec(D1)+gp_Vec(D2);
|
||||
gp_Dir S(V);
|
||||
gp_Pnt C;
|
||||
Standard_Real Fac = Radius/Cos(Ang/2.);
|
||||
C.SetCoord(Pv.X()+Fac*S.X(),Pv.Y()+Fac*S.Y(),Pv.Z()+Fac*S.Z());
|
||||
gp_Dir xdir = D1.Reversed();
|
||||
gp_Ax3 CylAx3(C,AxisCylinder,xdir);
|
||||
if (CylAx3.YDirection().Dot(D2) >= 0.){ CylAx3.YReverse(); }
|
||||
Handle(Geom_CylindricalSurface)
|
||||
gcyl = new Geom_CylindricalSurface(CylAx3,Radius);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gcyl,DStr));
|
||||
|
||||
// On regarde si l orientation du cylindre est la meme que celle
|
||||
// des faces.
|
||||
gp_Pnt P;
|
||||
gp_Vec deru,derv;
|
||||
ElSLib::CylinderD1(0.,0.,CylAx3,Radius,P,deru,derv);
|
||||
gp_Dir norcyl(deru.Crossed(derv));
|
||||
gp_Dir norpl = Pos1.XDirection().Crossed(Pos1.YDirection());
|
||||
gp_Dir norface = norpl;
|
||||
if (Of1 == TopAbs_REVERSED ) { norface.Reverse(); }
|
||||
Standard_Boolean toreverse = ( norcyl.Dot(norface) <= 0. );
|
||||
if (toreverse) { Data->ChangeOrientation() = TopAbs_REVERSED; }
|
||||
else { Data->ChangeOrientation() = TopAbs_FORWARD; }
|
||||
|
||||
// On charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
|
||||
Standard_Real u,v;
|
||||
// La face 1.
|
||||
ElSLib::PlaneParameters(Pos1,P,u,v);
|
||||
gp_Pnt2d p2dPln(u,v);
|
||||
gp_Dir2d dir2dPln(AxisCylinder.Dot(Pos1.XDirection()),
|
||||
AxisCylinder.Dot(Pos1.YDirection()));
|
||||
gp_Lin2d lin2dPln(p2dPln,dir2dPln);
|
||||
Handle(Geom2d_Line) GLin2dPln1 = new Geom2d_Line(lin2dPln);
|
||||
gp_Lin linPln(P,AxisCylinder);
|
||||
Handle(Geom_Line) GLinPln1 = new Geom_Line(linPln);
|
||||
gp_Lin2d lin2dCyl(gp_Pnt2d(0.,0.),gp::DY2d());
|
||||
Handle(Geom2d_Line) GLin2dCyl1 = new Geom2d_Line(lin2dCyl);
|
||||
TopAbs_Orientation trans;
|
||||
toreverse = ( norcyl.Dot(norpl) <= 0. );
|
||||
if (toreverse){ trans = TopAbs_REVERSED; }
|
||||
else { trans = TopAbs_FORWARD; }
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln1,DStr),
|
||||
trans,GLin2dPln1,GLin2dCyl1);
|
||||
|
||||
// La face 2.
|
||||
ElSLib::CylinderD1(Ang,0.,CylAx3,Radius,P,deru,derv);
|
||||
norcyl = deru.Crossed(derv);
|
||||
norpl = Pos2.XDirection().Crossed(Pos2.YDirection());
|
||||
toreverse = ( norcyl.Dot(norpl) <= 0. );
|
||||
ElSLib::PlaneParameters(Pos2,P,u,v);
|
||||
p2dPln.SetCoord(u,v);
|
||||
dir2dPln.SetCoord(AxisCylinder.Dot(Pos2.XDirection()),
|
||||
AxisCylinder.Dot(Pos2.YDirection()));
|
||||
lin2dPln.SetLocation(p2dPln);
|
||||
lin2dPln.SetDirection(dir2dPln);
|
||||
Handle(Geom2d_Line) GLin2dPln2 = new Geom2d_Line(lin2dPln);
|
||||
linPln.SetLocation(P);
|
||||
linPln.SetDirection(AxisCylinder);
|
||||
Handle(Geom_Line) GLinPln2 = new Geom_Line(linPln);
|
||||
lin2dCyl.SetLocation(gp_Pnt2d(Ang,0.));
|
||||
Handle(Geom2d_Line) GLin2dCyl2 = new Geom2d_Line(lin2dCyl);
|
||||
if (toreverse){ trans = TopAbs_FORWARD; }
|
||||
else { trans = TopAbs_REVERSED; }
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln2,DStr),
|
||||
trans,GLin2dPln2,GLin2dCyl2);
|
||||
return Standard_True;
|
||||
}
|
||||
|
22
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnPln.hxx
Executable file
22
src/ChFiKPart/ChFiKPart_ComputeData_FilPlnPln.hxx
Executable file
@@ -0,0 +1,22 @@
|
||||
// File: ChFiKPart_ComputeData_PlnPln.hxx
|
||||
// Created: Tue Apr 12 10:49:37 1994
|
||||
// Author: Isabelle GRIGNON
|
||||
// <isg@phylox>
|
||||
|
||||
|
||||
#ifndef ChFiKPart_ComputeData_PlnPln_HeaderFile
|
||||
#define ChFiKPart_ComputeData_PlnPln_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Radius,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Of1);
|
||||
|
||||
|
||||
#endif
|
143
src/ChFiKPart/ChFiKPart_ComputeData_Rotule.cxx
Executable file
143
src/ChFiKPart/ChFiKPart_ComputeData_Rotule.cxx
Executable file
@@ -0,0 +1,143 @@
|
||||
// File: ChFiKPart_ComputeData_Rotule.cxx
|
||||
// Created: Mon Jun 27 15:22:06 1994
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeRotule
|
||||
//Purpose : cas plan/plan.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeRotule(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& pl,
|
||||
const gp_Pln& pl1,
|
||||
const gp_Pln& pl2,
|
||||
const TopAbs_Orientation opl,
|
||||
const TopAbs_Orientation opl1,
|
||||
const TopAbs_Orientation opl2,
|
||||
const Standard_Real r,
|
||||
const TopAbs_Orientation ofpl)
|
||||
{
|
||||
|
||||
//calcul du tore.
|
||||
//---------------
|
||||
gp_Ax3 pos = pl.Position();
|
||||
gp_Dir dpl = pos.XDirection().Crossed(pos.YDirection());
|
||||
gp_Dir dfpl = dpl;
|
||||
gp_Dir dplnat = dpl;
|
||||
if (opl == TopAbs_REVERSED) { dpl.Reverse(); }
|
||||
if (ofpl == TopAbs_REVERSED) { dfpl.Reverse(); }
|
||||
pos = pl1.Position();
|
||||
gp_Dir dpl1 = pos.XDirection().Crossed(pos.YDirection());
|
||||
if (opl1 == TopAbs_REVERSED) { dpl1.Reverse(); }
|
||||
pos = pl2.Position();
|
||||
gp_Dir dpl2 = pos.XDirection().Crossed(pos.YDirection());
|
||||
if (opl2 == TopAbs_REVERSED) { dpl2.Reverse(); }
|
||||
|
||||
Standard_Real alpha = dpl1.Angle(dpl2);
|
||||
|
||||
IntAna_QuadQuadGeo LInt (pl1,pl2,Precision::Angular(),
|
||||
Precision::Confusion());
|
||||
gp_Pnt ptor,pcirc;
|
||||
if (LInt.IsDone()) {
|
||||
|
||||
pcirc = ElCLib::Value(ElCLib::Parameter(LInt.Line(1),pl.Location()),
|
||||
LInt.Line(1));
|
||||
ptor.SetCoord(pcirc.X()+r*dpl.X(),
|
||||
pcirc.Y()+r*dpl.Y(),
|
||||
pcirc.Z()+r*dpl.Z());
|
||||
}
|
||||
else { return Standard_False; }
|
||||
|
||||
gp_Ax3 ppos(ptor,dpl.Reversed(),dpl1);
|
||||
if(ppos.YDirection().Dot(dpl2) < 0.) ppos.YReverse();
|
||||
Handle(Geom_ToroidalSurface)
|
||||
gtor = new Geom_ToroidalSurface(ppos,r,r);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gtor,DStr));
|
||||
|
||||
//on compare l orientation du tore a celle de la face en bout.
|
||||
//------------------------------------------------------------
|
||||
gp_Pnt pp;
|
||||
gp_Vec du,dv;
|
||||
ElSLib::TorusD1(0.,PI/2,ppos,r,r,pp,du,dv);
|
||||
gp_Dir drot(du.Crossed(dv));
|
||||
Standard_Boolean reversecur = ( drot.Dot(dplnat) <= 0. );
|
||||
Standard_Boolean reversefil = ( drot.Dot(dfpl) <= 0. );
|
||||
if (reversefil) { Data->ChangeOrientation() = TopAbs_REVERSED; }
|
||||
else { Data->ChangeOrientation() = TopAbs_FORWARD; }
|
||||
|
||||
//on charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
//du cote du plan
|
||||
//---------------
|
||||
gp_Ax2 circAx2 = ppos.Ax2();
|
||||
circAx2.SetLocation(pcirc);
|
||||
Handle(Geom_Circle) GC = new Geom_Circle(circAx2,r);
|
||||
Standard_Real u,v;
|
||||
ElSLib::Parameters(pl,pcirc,u,v);
|
||||
gp_Pnt2d p2dcirc(u,v);
|
||||
gp_Dir2d dx2d(dpl1.Dot(pl.Position().XDirection()),
|
||||
dpl1.Dot(pl.Position().YDirection()));
|
||||
gp_Dir2d dy2d(ppos.YDirection().Dot(pl.Position().XDirection()),
|
||||
ppos.YDirection().Dot(pl.Position().YDirection()));
|
||||
gp_Ax22d circ2dax(p2dcirc,dx2d,dy2d);
|
||||
Handle(Geom2d_Circle) GC2d = new Geom2d_Circle(circ2dax,r);
|
||||
gp_Pnt2d p2dlin(0.,PI/2);
|
||||
Handle(Geom2d_Line) GL2d = new Geom2d_Line(p2dlin,gp::DX2d());
|
||||
TopAbs_Orientation trans = TopAbs_REVERSED;
|
||||
if (reversecur) trans = TopAbs_FORWARD;
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(GC,DStr),trans,GC2d,GL2d);
|
||||
|
||||
//du cote pointu
|
||||
//--------------
|
||||
Handle(Geom_Curve) bid;
|
||||
Handle(Geom2d_Curve) bid2d;
|
||||
p2dlin.SetCoord(0.,PI);
|
||||
Handle(Geom2d_Line) GL2dcoin = new Geom2d_Line(p2dlin,gp::DX2d());
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(bid,DStr),trans,bid2d,GL2dcoin);
|
||||
|
||||
//et les points
|
||||
//-------------
|
||||
Data->ChangeVertexFirstOnS1().SetPoint(pp);
|
||||
ElSLib::TorusD0(alpha,PI/2,ppos,r,r,pp);
|
||||
Data->ChangeVertexLastOnS1().SetPoint(pp);
|
||||
Data->ChangeInterferenceOnS1().SetFirstParameter(0.);
|
||||
Data->ChangeInterferenceOnS1().SetLastParameter(alpha);
|
||||
Data->ChangeInterferenceOnS2().SetFirstParameter(0.);
|
||||
Data->ChangeInterferenceOnS2().SetLastParameter(alpha);
|
||||
|
||||
return Standard_True;
|
||||
}
|
22
src/ChFiKPart/ChFiKPart_ComputeData_Rotule.hxx
Executable file
22
src/ChFiKPart/ChFiKPart_ComputeData_Rotule.hxx
Executable file
@@ -0,0 +1,22 @@
|
||||
// File: ChFiKPart_ComputeData_Rotule.hxx
|
||||
// Created: Tue Jun 28 10:03:31 1994
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#ifndef ChFiKPart_ComputeData_Rotule_HeaderFile
|
||||
#define ChFiKPart_ComputeData_Rotule_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeRotule(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const gp_Pln& pl,
|
||||
const gp_Pln& pl1,
|
||||
const gp_Pln& pl2,
|
||||
const TopAbs_Orientation opl,
|
||||
const TopAbs_Orientation opl1,
|
||||
const TopAbs_Orientation opl2,
|
||||
const Standard_Real r,
|
||||
const TopAbs_Orientation ofpl);
|
||||
|
||||
|
||||
#endif
|
172
src/ChFiKPart/ChFiKPart_ComputeData_Sphere.cxx
Executable file
172
src/ChFiKPart/ChFiKPart_ComputeData_Sphere.cxx
Executable file
@@ -0,0 +1,172 @@
|
||||
// File: ChFiKPart_ComputeData_Sphere.cxx
|
||||
// Created: Tue Nov 22 14:41:44 1994
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#include <ChFiKPart_ComputeData.jxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gce_MakeCirc.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <ChFiKPart_ComputeData_Fcts.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ChFiKPart_Sphere
|
||||
//purpose : Construction d un conge spherique dont les contours ne sont
|
||||
// pas tous des isos, a partir de ses trois sommets.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_Sphere(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const TopAbs_Orientation OrFace1,
|
||||
const TopAbs_Orientation OrFace2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation,
|
||||
const Standard_Real Rad,
|
||||
const gp_Pnt2d& PS1,
|
||||
const gp_Pnt2d& P1S2,
|
||||
const gp_Pnt2d& P2S2)
|
||||
{
|
||||
// Construction de la sphere :
|
||||
// - pole sud sur PS1
|
||||
// - origine des u donnee par P1S2
|
||||
// - u+ vers P2S2
|
||||
|
||||
Standard_Real ptol = Precision::Confusion();
|
||||
gp_Pnt p1,p2,p3;
|
||||
gp_Vec v1,v2;
|
||||
S1->D1(PS1.X(),PS1.Y(),p1,v1,v2);
|
||||
gp_Dir ds1(v1.Crossed(v2));
|
||||
gp_Dir df1 = ds1;
|
||||
gp_Dir dnat1 = ds1;
|
||||
if(Or1 == TopAbs_REVERSED) ds1.Reverse();
|
||||
if(OrFace1 == TopAbs_REVERSED) df1.Reverse();
|
||||
S2->D0(P1S2.X(),P1S2.Y(),p2);
|
||||
S2->D0(P2S2.X(),P2S2.Y(),p3);
|
||||
gp_Circ ci = gce_MakeCirc(p1,p2,p3);
|
||||
gp_Dir di = ci.Axis().Direction();
|
||||
gp_Pnt pp = ci.Location();
|
||||
Standard_Real rr = ci.Radius();
|
||||
Standard_Real delta = sqrt(Rad*Rad-rr*rr);
|
||||
gp_Pnt cen(pp.X()+delta*di.X(),
|
||||
pp.Y()+delta*di.Y(),
|
||||
pp.Z()+delta*di.Z());
|
||||
gp_Dir dz(gp_Vec(p1,cen));
|
||||
if(Abs(ds1.Dot(dz)-1.)>ptol){
|
||||
cen.SetCoord(pp.X()-delta*di.X(),
|
||||
pp.Y()-delta*di.Y(),
|
||||
pp.Z()-delta*di.Z());
|
||||
dz = gp_Dir(gp_Vec(p1,cen));
|
||||
if(Abs(ds1.Dot(dz)-1.)>ptol){
|
||||
#ifdef DEB
|
||||
cout<<"centre du coin spherique non trouve"<<endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
gp_Dir ddx(gp_Vec(cen,p2));
|
||||
gp_Dir dddx = ddx;
|
||||
gp_Dir ddy(gp_Vec(cen,p3));
|
||||
gp_Dir dx = dz.Crossed(ddx.Crossed(dz));
|
||||
gp_Dir ddz = dz.Reversed();
|
||||
gp_Ax3 FilAx3(cen,dz,dx);
|
||||
if (FilAx3.YDirection().Dot(ddy) <= 0.){
|
||||
FilAx3.YReverse();
|
||||
ddz.Reverse();
|
||||
dddx.Reverse();
|
||||
}
|
||||
Handle(Geom_SphericalSurface)
|
||||
gsph = new Geom_SphericalSurface(FilAx3,Rad);
|
||||
Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gsph,DStr));
|
||||
|
||||
// on compare la normale de la sphere a celle de la face
|
||||
// orientee pour determiner l orientation finale du conge.
|
||||
Standard_Boolean toreverse = ( ddz.Dot(df1) <= 0. );
|
||||
if (toreverse) { Data->ChangeOrientation() = TopAbs_REVERSED; }
|
||||
else { Data->ChangeOrientation() = TopAbs_FORWARD; }
|
||||
|
||||
// On calcule les parametres de p2 et p3 sur la Sphere pour avoir
|
||||
// les ranges des courbes.
|
||||
Standard_Real uu1,vv1,uu2,vv2;
|
||||
ElSLib::SphereParameters(FilAx3,Rad,p2,uu1,vv1);
|
||||
uu1 = 0.;
|
||||
ElSLib::SphereParameters(FilAx3,Rad,p3,uu2,vv2);
|
||||
|
||||
// On charge les FaceInterferences avec les pcurves et courbes 3d.
|
||||
|
||||
// Le cote pointu.
|
||||
|
||||
Handle(Geom_Curve) C;
|
||||
Handle(Geom2d_Curve) C2d;
|
||||
gp_Pnt2d p2dFil(0.,-PI/2.);
|
||||
gp_Lin2d lin2dFil(p2dFil,gp::DX2d());
|
||||
Handle(Geom2d_Curve) C2dFil = new Geom2d_Line(lin2dFil);
|
||||
toreverse = ( ddz.Dot(dnat1) <= 0. );
|
||||
TopAbs_Orientation trans = TopAbs_REVERSED;
|
||||
if (toreverse) trans = TopAbs_FORWARD;
|
||||
Data->ChangeInterferenceOnS1().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(C,DStr),
|
||||
trans,C2d,C2dFil);
|
||||
|
||||
// L autre cote.
|
||||
|
||||
Standard_Real ang = ddx.Angle(ddy);
|
||||
gp_Dir dci = ddx.Crossed(ddy);
|
||||
gp_Ax2 axci(cen,dci,ddx);
|
||||
gp_Circ ci2(axci,Rad);
|
||||
C = new Geom_Circle(ci2);
|
||||
GeomAdaptor_Surface AS(gsph);
|
||||
GeomAdaptor_Curve AC(C,0.,ang);
|
||||
ChFiKPart_ProjPC(AC,AS,C2dFil);
|
||||
gp_Pnt2d p2dbid = C2dFil->Value(0.);
|
||||
gp_Pnt2d pp2dbid(uu1,vv1);
|
||||
if(!pp2dbid.IsEqual(p2dbid,ptol)){
|
||||
gp_Vec2d v2dbid(p2dbid,pp2dbid);
|
||||
C2dFil->Translate(v2dbid);
|
||||
}
|
||||
gp_Vec2d v2d(P1S2,P2S2);
|
||||
gp_Dir2d d2d(v2d);
|
||||
if(Abs(v2d.Magnitude()-ang) <= ptol){
|
||||
gp_Lin2d l2d(P1S2,d2d);
|
||||
C2d = new Geom2d_Line(l2d);
|
||||
}
|
||||
else C2d = ChFiKPart_PCurve(P1S2,P2S2,0.,ang);
|
||||
gp_Pnt pp1;
|
||||
S2->D1(P1S2.X(),P1S2.Y(),pp1,v1,v2);
|
||||
gp_Dir ds2(v1.Crossed(v2));
|
||||
toreverse = (ds2.Dot(dddx) <= 0.);
|
||||
trans = TopAbs_REVERSED;
|
||||
if (!toreverse) trans = TopAbs_FORWARD;
|
||||
Data->ChangeInterferenceOnS2().
|
||||
SetInterference(ChFiKPart_IndexCurveInDS(C,DStr),
|
||||
trans,C2d,C2dFil);
|
||||
|
||||
Data->ChangeVertexFirstOnS1().SetPoint(p1);
|
||||
Data->ChangeVertexLastOnS1().SetPoint(p1);
|
||||
Data->ChangeVertexFirstOnS2().SetPoint(p2);
|
||||
Data->ChangeVertexLastOnS2().SetPoint(p3);
|
||||
Data->ChangeInterferenceOnS1().SetFirstParameter(0.);
|
||||
Data->ChangeInterferenceOnS1().SetLastParameter(uu2);
|
||||
Data->ChangeInterferenceOnS2().SetFirstParameter(0.);
|
||||
Data->ChangeInterferenceOnS2().SetLastParameter(ang);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
25
src/ChFiKPart/ChFiKPart_ComputeData_Sphere.hxx
Executable file
25
src/ChFiKPart/ChFiKPart_ComputeData_Sphere.hxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: ChFiKPart_ComputeData_Sphere.hxx
|
||||
// Created: Tue Nov 22 15:11:10 1994
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@phylox>
|
||||
|
||||
|
||||
#ifndef _ChFiKPart_ComputeData_Sphere_HeaderFile
|
||||
#define _ChFiKPart_ComputeData_Sphere_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_Sphere
|
||||
(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const TopAbs_Orientation OrFace1,
|
||||
const TopAbs_Orientation OrFace2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Rad,
|
||||
const gp_Pnt2d& PS1,
|
||||
const gp_Pnt2d& P1S2,
|
||||
const gp_Pnt2d& P2S2);
|
||||
|
||||
|
||||
#endif
|
26
src/ChFiKPart/FILES
Executable file
26
src/ChFiKPart/FILES
Executable file
@@ -0,0 +1,26 @@
|
||||
ChFiKPart_ComputeData_Fcts.hxx
|
||||
ChFiKPart_ComputeData_Fcts.cxx
|
||||
ChFiKPart_ComputeData_CS.hxx
|
||||
ChFiKPart_ComputeData_CS.cxx
|
||||
ChFiKPart_ComputeData_FilPlnCon.hxx
|
||||
ChFiKPart_ComputeData_FilPlnCon.cxx
|
||||
ChFiKPart_ComputeData_FilPlnCyl.hxx
|
||||
ChFiKPart_ComputeData_FilPlnCyl.cxx
|
||||
ChFiKPart_ComputeData_FilPlnPln.hxx
|
||||
ChFiKPart_ComputeData_FilPlnPln.cxx
|
||||
ChFiKPart_ComputeData_Rotule.hxx
|
||||
ChFiKPart_ComputeData_Rotule.cxx
|
||||
ChFiKPart_ComputeData_Sphere.hxx
|
||||
ChFiKPart_ComputeData_Sphere.cxx
|
||||
ChFiKPart_ComputeData_ChPlnPln.hxx
|
||||
ChFiKPart_ComputeData_ChPlnPln.cxx
|
||||
ChFiKPart_ComputeData_ChPlnCyl.hxx
|
||||
ChFiKPart_ComputeData_ChPlnCyl.cxx
|
||||
ChFiKPart_ComputeData_ChPlnCon.hxx
|
||||
ChFiKPart_ComputeData_ChPlnCon.cxx
|
||||
ChFiKPart_ComputeData_ChAsymPlnPln.hxx
|
||||
ChFiKPart_ComputeData_ChAsymPlnPln.cxx
|
||||
ChFiKPart_ComputeData_ChAsymPlnCyl.hxx
|
||||
ChFiKPart_ComputeData_ChAsymPlnCyl.cxx
|
||||
ChFiKPart_ComputeData_ChAsymPlnCon.hxx
|
||||
ChFiKPart_ComputeData_ChAsymPlnCon.cxx
|
Reference in New Issue
Block a user