0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / Blend / Blend_Walking.gxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #include <math_FunctionSetRoot.hxx>
16 #include <math_Gauss.hxx>
17 #include <TColgp_Array1OfPnt.hxx>
18 #include <TColgp_Array2OfVec.hxx>
19
20 #include <IntSurf.hxx>
21 #include <Adaptor2d_HCurve2d.hxx>
22 #include <CSLib.hxx>
23 #include <CSLib_NormalStatus.hxx>
24 #include <Precision.hxx>
25
26 #ifdef OCCT_DEBUG
27 #include <TColStd_Array1OfInteger.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <TColgp_Array1OfPnt2d.hxx>
30 #include <Geom_BSplineCurve.hxx>
31 #ifdef DRAW
32 #include <Draw.hxx>
33 #include <DrawTrSurf_BSplineCurve.hxx>
34 #endif
35 //POP pour NT
36 #include <stdio.h>
37
38 static Standard_Boolean sectioncalculee;
39 static Standard_Integer IndexOfSection = 0;
40 static Standard_Integer IndexOfRejection = 0;
41 static Standard_Integer nbcomputedsection;
42 extern Standard_Boolean Blend_GettraceDRAWSECT();
43 extern Standard_Boolean Blend_GetcontextNOTESTDEFL();
44
45 // Pour debug : visualisation de la section
46 static void Drawsect(const TheSurface& surf1,
47                      const TheSurface& surf2,
48                      const math_Vector& sol,
49                      const Standard_Real param,
50                      Blend_Function& Func,
51                      const Blend_Status State)
52 {
53 //  if(!sectioncalculee) return;
54   Blend_Point BP(TheSurfaceTool::Value(surf1,sol(1),sol(2)),
55                  TheSurfaceTool::Value(surf2,sol(3),sol(4)),
56                  param,sol(1),sol(2),sol(3),sol(4));
57   Standard_Integer hp,hk,hd,hp2d;
58   Func.GetShape(hp,hk,hd,hp2d);
59   TColStd_Array1OfReal TK(1,hk);
60   Func.Knots(TK);
61   TColStd_Array1OfInteger TMul(1,hk);
62   Func.Mults(TMul);
63   TColgp_Array1OfPnt TP(1,hp);
64   TColgp_Array1OfPnt2d TP2d(1,hp2d);
65   TColStd_Array1OfReal TW(1,hp);
66   Func.Section(BP,TP,TP2d,TW);
67   Handle(Geom_BSplineCurve) sect = new Geom_BSplineCurve
68     (TP,TW,TK,TMul,hd);
69  
70   //POP pour NT
71   //char name[100];
72   char* name = new char[100];
73   if ((State==Blend_StepTooLarge) ||(State==Blend_SamePoints)) {
74     IndexOfRejection ++;
75     sprintf(name,"%s_%d","Rejection",IndexOfRejection);
76   }
77   else {
78     IndexOfSection++;
79     sprintf(name,"%s_%d","Section",IndexOfSection);
80   }
81 #ifdef DRAW
82   Handle(DrawTrSurf_BSplineCurve) BS 
83     = new (DrawTrSurf_BSplineCurve)(sect);
84   BS->ClearPoles();
85   BS->ClearKnots();
86   if (State==Blend_StepTooLarge) BS->SetColor(Draw_violet);
87   if (State==Blend_SamePoints) BS->SetColor(Draw_rose);
88   Draw::Set(name,BS);
89 #endif
90 }
91
92 static void Drawsect(const TheSurface& surf1,
93                      const TheSurface& surf2,
94                      const math_Vector& sol,
95                      const Standard_Real param,
96                      Blend_Function& Func)
97 {
98   Drawsect(surf1, surf2, sol, param, Func, Blend_OK);
99 }
100 #endif
101
102 #include <Blend_Walking_1.gxx>
103 #include <Blend_Walking_2.gxx>
104 #include <Blend_Walking_3.gxx>
105 #include <Blend_Walking_4.gxx>
106
107
108