b311480e |
1 | // Created on: 1995-07-20 |
2 | // Created by: Modelistation |
3 | // Copyright (c) 1995-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 | // |
973c2be1 |
8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public 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. |
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 | #include <gp_Pnt2d.hxx> |
18 | |
19 | //======================================================================= |
20 | //function : BRepApprox_ApproxLineGen |
21 | //purpose : |
22 | //======================================================================= |
23 | |
24 | BRepApprox_ApproxLineGen::BRepApprox_ApproxLineGen |
25 | (const TheCurve& CurveXYZ, |
26 | const TheCurve2d& CurveUV1, |
27 | const TheCurve2d& CurveUV2) |
28 | { |
29 | curvxyz = CurveXYZ; |
30 | curvuv1 = CurveUV1; |
31 | curvuv2 = CurveUV2; |
32 | } |
33 | |
34 | |
35 | //======================================================================= |
36 | //function : BRepApprox_ApproxLineGen |
37 | //purpose : |
38 | //======================================================================= |
39 | |
40 | BRepApprox_ApproxLineGen::BRepApprox_ApproxLineGen |
41 | (const Handle(IntSurf_LineOn2S)& lin, |
42 | const Standard_Boolean ) |
43 | :linon2s(lin) |
44 | { |
45 | } |
46 | |
47 | //======================================================================= |
48 | //function : NbPnts |
49 | //purpose : |
50 | //======================================================================= |
51 | |
52 | Standard_Integer BRepApprox_ApproxLineGen::NbPnts() const |
53 | { |
54 | if(!curvxyz.IsNull()) |
55 | return(curvxyz->NbPoles()); |
56 | if(!curvuv1.IsNull()) |
57 | return(curvuv1->NbPoles()); |
58 | if(!curvuv2.IsNull()) |
59 | return(curvuv2->NbPoles()); |
60 | return(linon2s->NbPoints()); |
61 | } |
62 | |
63 | //======================================================================= |
64 | //function : Point |
65 | //purpose : |
66 | //======================================================================= |
67 | |
68 | IntSurf_PntOn2S BRepApprox_ApproxLineGen::Point |
69 | (const Standard_Integer Index) |
70 | { |
71 | if(!linon2s.IsNull()) { |
72 | if(linon2s->NbPoints()) { |
73 | return(linon2s->Value(Index)); |
74 | } |
75 | } |
76 | gp_Pnt2d P1,P2; |
77 | gp_Pnt P; |
78 | if(!curvxyz.IsNull()) |
79 | P = curvxyz->Pole(Index); |
80 | if(!curvuv1.IsNull()) |
81 | P1 = curvuv1->Pole(Index); |
82 | if(!curvuv2.IsNull()) |
83 | P2 = curvuv2->Pole(Index); |
84 | |
85 | pnton2s.SetValue(P, |
86 | P1.X(), |
87 | P1.Y(), |
88 | P2.X(), |
89 | P2.Y()); |
90 | return(pnton2s); |
91 | } |