b311480e |
1 | // Created on: 1993-11-08 |
2 | // Created by: lbr |
3 | // Copyright (c) 1993-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 | |
17 | ApproxInt_WLine::ApproxInt_WLine(const TheCurve& CurveXYZ, |
18 | const TheCurve2d& CurveUV1, |
19 | const TheCurve2d& CurveUV2) { |
20 | curvxyz = CurveXYZ; |
21 | curvuv1 = CurveUV1; |
22 | curvuv2 = CurveUV2; |
23 | } |
24 | |
25 | |
26 | ApproxInt_WLine::ApproxInt_WLine(const Handle(IntSurf_LineOn2S)& lin, |
27 | const Standard_Boolean ) |
28 | :linon2s(lin) |
29 | { |
30 | } |
31 | |
32 | Standard_Integer ApproxInt_WLine::NbPnts() const { |
33 | if(!curvxyz.IsNull()) |
34 | return(curvxyz->NbPoles()); |
35 | if(!curvuv1.IsNull()) |
36 | return(curvuv1->NbPoles()); |
37 | if(!curvuv2.IsNull()) |
38 | return(curvuv2->NbPoles()); |
39 | return(linon2s->NbPoints()); |
40 | } |
41 | |
42 | IntSurf_PntOn2S ApproxInt_WLine::Point(const Standard_Integer Index) { |
43 | if(!linon2s.IsNull()) { |
44 | if(linon2s->NbPoints()) { |
45 | return(linon2s->Value(Index)); |
46 | } |
47 | } |
48 | gp_Pnt2d P1,P2; |
49 | gp_Pnt P; |
50 | if(!curvxyz.IsNull()) |
51 | P = curvxyz->Pole(Index); |
52 | if(!curvuv1.IsNull()) |
53 | P1 = curvuv1->Pole(Index); |
54 | if(!curvuv2.IsNull()) |
55 | P2 = curvuv2->Pole(Index); |
56 | |
57 | pnton2s.SetValue(P, |
58 | P1.X(), |
59 | P1.Y(), |
60 | P2.X(), |
61 | P2.Y()); |
62 | return(pnton2s); |
63 | } |
64 | |