b311480e |
1 | // Created on: 1994-02-25 |
2 | // Created by: Bruno DUMORTIER |
3 | // Copyright (c) 1994-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 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Geom_BSplineCurve.hxx> |
19 | #include <Geom_BSplineSurface.hxx> |
20 | #include <Geom_Surface.hxx> |
21 | #include <GeomFill_Generator.hxx> |
22 | #include <Standard_DomainError.hxx> |
23 | #include <StdFail_NotDone.hxx> |
7fd59977 |
24 | #include <TColgp_Array1OfPnt.hxx> |
25 | #include <TColgp_Array2OfPnt.hxx> |
42cf5bc1 |
26 | #include <TColStd_Array1OfInteger.hxx> |
7fd59977 |
27 | #include <TColStd_Array1OfReal.hxx> |
28 | #include <TColStd_Array2OfReal.hxx> |
7fd59977 |
29 | |
30 | //======================================================================= |
31 | //function : GeomFill_Generator |
32 | //purpose : |
33 | //======================================================================= |
7fd59977 |
34 | GeomFill_Generator::GeomFill_Generator() |
35 | { |
36 | } |
37 | |
38 | |
39 | //======================================================================= |
40 | //function : Perform |
41 | //purpose : |
42 | //======================================================================= |
43 | |
44 | void GeomFill_Generator::Perform(const Standard_Real PTol) |
45 | { |
46 | // Perform the profile of the sections. |
47 | GeomFill_Profiler::Perform( PTol); |
48 | |
49 | // Create the surface. |
50 | |
51 | Standard_Integer i,j; |
52 | Standard_Integer NbUPoles = NbPoles(); |
53 | Standard_Integer NbVPoles = mySequence.Length(); |
54 | Standard_Integer NbUKnots = NbKnots(); |
55 | Standard_Integer NbVKnots = NbVPoles; |
56 | Standard_Boolean isUPeriodic = IsPeriodic(); |
57 | Standard_Boolean isVPeriodic = Standard_False; |
58 | |
59 | TColgp_Array2OfPnt Poles ( 1, NbUPoles, 1, NbVPoles); |
60 | TColStd_Array2OfReal Weights( 1, NbUPoles, 1, NbVPoles); |
61 | TColStd_Array1OfReal UKnots ( 1, NbUKnots); |
62 | TColStd_Array1OfReal VKnots ( 1, NbVKnots); |
63 | TColStd_Array1OfInteger UMults ( 1, NbUKnots); |
64 | TColStd_Array1OfInteger VMults ( 1, NbVKnots); |
65 | VMults.Init(1); |
66 | |
67 | VMults(1) = VMults(NbVKnots) = 2; |
68 | |
69 | KnotsAndMults( UKnots, UMults); |
70 | |
71 | TColgp_Array1OfPnt Pole ( 1, NbUPoles); |
72 | TColStd_Array1OfReal Weight( 1, NbUPoles); |
73 | for ( j = 1; j <= NbVPoles; j++) { |
74 | Handle(Geom_BSplineCurve) Cj = |
75 | Handle(Geom_BSplineCurve)::DownCast(mySequence(j)); |
76 | Cj->Poles(Pole); |
77 | Cj->Weights(Weight); |
78 | VKnots(j) = (Standard_Real)(j-1); |
79 | for ( i = 1; i <= NbUPoles; i++) { |
80 | Poles(i,j) = Pole (i); |
81 | Weights(i,j) = Weight(i); |
82 | } |
83 | } |
84 | |
85 | mySurface = new Geom_BSplineSurface( Poles, Weights, UKnots, VKnots, |
86 | UMults, VMults, Degree(), 1, |
87 | isUPeriodic, isVPeriodic); |
88 | } |