b311480e |
1 | // Created on: 1994-04-13 |
2 | // Created by: Isabelle GRIGNON |
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 | |
17 | #include <ChFiKPart_ComputeData_CS.hxx> |
18 | #include <gp_Ax3.hxx> |
19 | #include <gp_Vec.hxx> |
20 | #include <gp_Pnt.hxx> |
21 | #include <gp_Dir.hxx> |
22 | #include <ElCLib.hxx> |
23 | |
24 | |
c22b52d6 |
25 | void ChFiKPart_CornerSpine(const Handle(Adaptor3d_Surface)& S1, |
26 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
27 | const gp_Pnt2d& P1S1, |
35e08fe8 |
28 | const gp_Pnt2d& /*P2S1*/, |
7fd59977 |
29 | const gp_Pnt2d& P1S2, |
30 | const gp_Pnt2d& P2S2, |
31 | const Standard_Real R, |
32 | gp_Cylinder& cyl, |
33 | gp_Circ& circ, |
34 | Standard_Real& First, |
35 | Standard_Real& Last) |
36 | |
37 | { |
38 | gp_Ax3 ax = S1->Plane().Position(); |
39 | gp_Vec V1(ax.XDirection()); |
40 | gp_Vec V2(ax.YDirection()); |
41 | gp_Pnt P; |
42 | gp_Vec du,dv; |
43 | S2->D1(P1S2.X(),P1S2.Y(),P,du,dv); |
44 | gp_Vec V(P,S1->Value(P1S1.X(),P1S1.Y())); |
45 | V = V.Dot(V1)*V1+V.Dot(V2)*V2; |
46 | V.Normalize(); |
47 | gp_Pnt P2 = S2->Value(P2S2.X(),P2S2.Y()); |
48 | gp_Vec Vorien(P,P2); |
49 | gp_Pnt cent; |
50 | gp_Dir dx(V); |
51 | if(V.Dot(Vorien) >= 0.){ |
52 | cent.SetCoord(P.X()+R*V.X(),P.Y()+R*V.Y(),P.Z()+R*V.Z()); |
53 | dx.Reverse(); |
54 | } |
55 | else { |
56 | cent.SetCoord(P.X()-R*V.X(),P.Y()-R*V.Y(),P.Z()-R*V.Z()); |
57 | } |
58 | gp_Dir dy(gp_Vec(cent,P2)); |
59 | dy = (dx^dy)^dx; |
60 | gp_Ax2 circax2(cent,dx^dy,dx); |
61 | gp_Ax3 cylax3(circax2); |
62 | if((du^dv).Dot(dx) < 0.) cylax3.ZReverse(); |
63 | First = 0.; |
64 | Last = ElCLib::CircleParameter(circax2,P2); |
65 | circ.SetPosition(circax2); |
66 | circ.SetRadius(R); |
67 | cyl.SetPosition(cylax3); |
68 | cyl.SetRadius(R); |
69 | } |