b311480e |
1 | // Created on: 1997-12-10 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <GeomFill_Fixed.hxx> |
19 | #include <GeomFill_TrihedronLaw.hxx> |
20 | #include <gp_Vec.hxx> |
7fd59977 |
21 | #include <Precision.hxx> |
42cf5bc1 |
22 | #include <Standard_ConstructionError.hxx> |
23 | #include <Standard_OutOfRange.hxx> |
24 | #include <Standard_Type.hxx> |
7fd59977 |
25 | |
92efcf78 |
26 | IMPLEMENT_STANDARD_RTTIEXT(GeomFill_Fixed,GeomFill_TrihedronLaw) |
27 | |
7fd59977 |
28 | GeomFill_Fixed::GeomFill_Fixed(const gp_Vec& Tangent, |
29 | const gp_Vec& Normal) |
30 | { |
31 | if (Tangent.IsParallel(Normal, 0.01) ) |
9775fa61 |
32 | throw Standard_ConstructionError( |
7fd59977 |
33 | "GeomFill_Fixed : Two parallel vectors !"); |
34 | T = Tangent; |
35 | T.Normalize(); |
36 | N = Normal; |
37 | N.Normalize(); |
38 | B = T ^ N; |
39 | B.Normalize(); |
40 | } |
41 | |
42 | Handle(GeomFill_TrihedronLaw) GeomFill_Fixed::Copy() const |
43 | { |
44 | Handle(GeomFill_Fixed) copy = new (GeomFill_Fixed)(T, N); |
45 | copy->SetCurve(myCurve); |
46 | return copy; |
47 | } |
48 | |
49 | Standard_Boolean GeomFill_Fixed::D0(const Standard_Real, |
50 | gp_Vec& Tangent, |
51 | gp_Vec& Normal, |
52 | gp_Vec& BiNormal) |
53 | { |
54 | Tangent = T; |
55 | Normal = N; |
56 | BiNormal = B; |
57 | |
58 | return Standard_True; |
59 | } |
60 | |
61 | Standard_Boolean GeomFill_Fixed::D1(const Standard_Real, |
62 | gp_Vec& Tangent, |
63 | gp_Vec& DTangent, |
64 | gp_Vec& Normal, |
65 | gp_Vec& DNormal, |
66 | gp_Vec& BiNormal, |
67 | gp_Vec& DBiNormal) |
68 | { |
69 | Tangent = T; |
70 | Normal = N; |
71 | BiNormal = B; |
72 | |
73 | gp_Vec V0(0,0,0); |
74 | DTangent = DNormal = DBiNormal = V0; |
75 | |
76 | return Standard_True; |
77 | } |
78 | |
79 | Standard_Boolean GeomFill_Fixed::D2(const Standard_Real, |
80 | gp_Vec& Tangent, |
81 | gp_Vec& DTangent, |
82 | gp_Vec& D2Tangent, |
83 | gp_Vec& Normal, |
84 | gp_Vec& DNormal, |
85 | gp_Vec& D2Normal, |
86 | gp_Vec& BiNormal, |
87 | gp_Vec& DBiNormal, |
88 | gp_Vec& D2BiNormal) |
89 | { |
90 | Tangent = T; |
91 | Normal = N; |
92 | BiNormal = B; |
93 | |
94 | gp_Vec V0(0,0,0); |
95 | DTangent = D2Tangent = V0; |
96 | DNormal = D2Normal = V0; |
97 | DBiNormal = D2BiNormal = V0; |
98 | |
99 | return Standard_True; |
100 | } |
101 | |
102 | Standard_Integer GeomFill_Fixed::NbIntervals(const GeomAbs_Shape) const |
103 | { |
104 | return 1; |
105 | } |
106 | |
75259fc5 |
107 | void GeomFill_Fixed::Intervals(TColStd_Array1OfReal& theT, |
7fd59977 |
108 | const GeomAbs_Shape) const |
109 | { |
75259fc5 |
110 | theT(theT.Lower()) = - Precision::Infinite(); |
111 | theT(theT.Upper()) = Precision::Infinite(); |
7fd59977 |
112 | } |
113 | |
114 | void GeomFill_Fixed::GetAverageLaw(gp_Vec& ATangent, |
115 | gp_Vec& ANormal, |
116 | gp_Vec& ABiNormal) |
117 | { |
118 | ATangent = T; |
119 | ANormal = N; |
120 | ABiNormal = B; |
121 | } |
122 | |
123 | Standard_Boolean GeomFill_Fixed::IsConstant() const |
124 | { |
125 | return Standard_True; |
126 | } |