0024023: Revamp the OCCT Handle -- downcast (automatic)
[occt.git] / src / GeomFill / GeomFill_Fixed.cxx
1 // Created on: 1997-12-10
2 // Created by: Philippe MANGIN
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <GeomFill_Fixed.ixx>
18 #include <Precision.hxx>
19
20 GeomFill_Fixed::GeomFill_Fixed(const gp_Vec& Tangent,
21                                const gp_Vec& Normal)
22 {
23   if (Tangent.IsParallel(Normal, 0.01) ) 
24     Standard_ConstructionError::Raise(
25       "GeomFill_Fixed : Two parallel vectors !");
26   T = Tangent;
27   T.Normalize();
28   N = Normal;
29   N.Normalize();
30   B = T ^ N;
31   B.Normalize();
32 }
33
34 Handle(GeomFill_TrihedronLaw) GeomFill_Fixed::Copy() const
35 {
36  Handle(GeomFill_Fixed) copy = new (GeomFill_Fixed)(T, N);
37  copy->SetCurve(myCurve);
38  return copy;
39
40
41  Standard_Boolean GeomFill_Fixed::D0(const Standard_Real, 
42                                                  gp_Vec& Tangent,
43                                                  gp_Vec& Normal,
44                                                  gp_Vec& BiNormal) 
45 {
46   Tangent = T;
47   Normal = N;
48   BiNormal = B;
49
50   return Standard_True; 
51 }
52
53  Standard_Boolean GeomFill_Fixed::D1(const Standard_Real,
54                                                  gp_Vec& Tangent,
55                                                  gp_Vec& DTangent,
56                                                  gp_Vec& Normal,
57                                                  gp_Vec& DNormal,
58                                                  gp_Vec& BiNormal,
59                                                  gp_Vec& DBiNormal) 
60 {
61   Tangent = T;
62   Normal = N;
63   BiNormal = B;
64
65   gp_Vec V0(0,0,0);
66   DTangent = DNormal = DBiNormal = V0;
67
68   return Standard_True; 
69 }
70
71  Standard_Boolean GeomFill_Fixed::D2(const Standard_Real,
72                                                  gp_Vec& Tangent,
73                                                  gp_Vec& DTangent,
74                                                  gp_Vec& D2Tangent,
75                                                  gp_Vec& Normal,
76                                                  gp_Vec& DNormal,
77                                                  gp_Vec& D2Normal,
78                                                  gp_Vec& BiNormal,
79                                                  gp_Vec& DBiNormal,
80                                                  gp_Vec& D2BiNormal) 
81 {
82   Tangent = T;
83   Normal = N;
84   BiNormal = B;
85
86   gp_Vec V0(0,0,0);
87   DTangent = D2Tangent = V0;
88   DNormal = D2Normal = V0;
89   DBiNormal = D2BiNormal = V0;
90
91   return Standard_True; 
92 }
93
94  Standard_Integer GeomFill_Fixed::NbIntervals(const GeomAbs_Shape) const
95 {
96   return 1;
97 }
98
99  void GeomFill_Fixed::Intervals(TColStd_Array1OfReal& theT,
100                                             const GeomAbs_Shape) const
101 {
102   theT(theT.Lower()) = - Precision::Infinite();
103   theT(theT.Upper()) =   Precision::Infinite();
104 }
105
106  void GeomFill_Fixed::GetAverageLaw(gp_Vec& ATangent,
107                                     gp_Vec& ANormal,
108                                     gp_Vec& ABiNormal) 
109 {
110    ATangent = T;
111    ANormal = N;
112    ABiNormal = B;
113 }
114
115  Standard_Boolean GeomFill_Fixed::IsConstant() const
116 {
117   return Standard_True;
118 }