1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <IntSurf.hxx>
17 #include <Adaptor3d_HSurface.hxx>
18 #include <IntSurf_Transition.hxx>
19 #include <Precision.hxx>
22 //--------------------------------------------------------------
23 //-- IntSurf::MakeTransition(Vtgint,Vtgrst,Normale,Transline,Transarc);
25 //-- tgFirst = Tangente Ligne Intersection
26 //-- tgSecond = Tangenet Restriction
27 //-- Normale = Normale a la surface
28 void IntSurf::MakeTransition (const gp_Vec& TgFirst,
29 const gp_Vec& TgSecond,
30 const gp_Dir& Normale,
31 IntSurf_Transition& TFirst,
32 IntSurf_Transition& TSecond)
37 // Effectuer le produit mixte normale, tangente 1, tangente 2
38 // pour avoir le type de la transition.
40 gp_Vec pvect(TgSecond.Crossed(TgFirst));
42 Standard_Real NTgSecond = TgSecond.Magnitude();
43 Standard_Real NTgFirst = TgFirst.Magnitude();
44 Standard_Real NTgSecondNTgFirstAngular = NTgSecond*NTgFirst*Precision::Angular();
46 if(NTgFirst <= Precision::Confusion()) {
47 TFirst.SetValue(Standard_True,IntSurf_Undecided);
48 TSecond.SetValue(Standard_True,IntSurf_Undecided);
50 else if ( (NTgSecond <= Precision::Confusion())
51 || (pvect.Magnitude()<= NTgSecondNTgFirstAngular)) {
52 TFirst.SetValue(Standard_True,IntSurf_Unknown,TgFirst.Dot(TgSecond)<0.0);
53 TSecond.SetValue(Standard_True,IntSurf_Unknown,TgFirst.Dot(TgSecond)<0.0);
56 Standard_Real yu = pvect.Dot(Normale);
57 yu/=NTgSecond*NTgFirst;
59 TFirst.SetValue(Standard_False,IntSurf_In);
60 TSecond.SetValue(Standard_False,IntSurf_Out);
63 TFirst.SetValue(Standard_False,IntSurf_Out);
64 TSecond.SetValue(Standard_False,IntSurf_In);
69 gp_Vec V1(TgSecond.X() / NTgSecond,TgSecond.Y() / NTgSecond, TgSecond.Z() / NTgSecond);
70 gp_Vec V2(TgFirst.X() / NTgFirst,TgFirst.Y() / NTgFirst, TgFirst.Z() / NTgFirst);
72 pvect = V1.Crossed(V2);
73 yu = pvect.Dot(Normale);
76 TFirst.SetValue(Standard_False,IntSurf_In);
77 TSecond.SetValue(Standard_False,IntSurf_Out);
79 else if(yu<-0.0000001) {
80 TFirst.SetValue(Standard_False,IntSurf_Out);
81 TSecond.SetValue(Standard_False,IntSurf_In);
84 TFirst.SetValue(Standard_True,IntSurf_Undecided);
85 TSecond.SetValue(Standard_True,IntSurf_Undecided);
89 TFirst.SetValue(Standard_True,IntSurf_Undecided);
90 TSecond.SetValue(Standard_True,IntSurf_Undecided);
100 //=======================================================================
101 //function : SetPeriod
103 //=======================================================================
104 void IntSurf::SetPeriod(const Handle(Adaptor3d_HSurface)& theFirstSurf,
105 const Handle(Adaptor3d_HSurface)& theSecondSurf,
106 Standard_Real theArrOfPeriod[4])
108 theArrOfPeriod[0] = theFirstSurf->IsUPeriodic()? theFirstSurf->UPeriod() : 0.0;
109 theArrOfPeriod[1] = theFirstSurf->IsVPeriodic()? theFirstSurf->VPeriod() : 0.0;
110 theArrOfPeriod[2] = theSecondSurf->IsUPeriodic()? theSecondSurf->UPeriod() : 0.0;
111 theArrOfPeriod[3] = theSecondSurf->IsVPeriodic()? theSecondSurf->VPeriod() : 0.0;