b311480e |
1 | // Created on: 1994-04-13 |
2 | // Created by: Isabelle GRIGNON |
3 | // Copyright (c) 1994-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <ChFiKPart_ComputeData_CS.hxx> |
24 | #include <gp_Ax3.hxx> |
25 | #include <gp_Vec.hxx> |
26 | #include <gp_Pnt.hxx> |
27 | #include <gp_Dir.hxx> |
28 | #include <ElCLib.hxx> |
29 | |
30 | |
31 | void ChFiKPart_CornerSpine(const Handle(Adaptor3d_HSurface)& S1, |
32 | const Handle(Adaptor3d_HSurface)& S2, |
33 | const gp_Pnt2d& P1S1, |
35e08fe8 |
34 | const gp_Pnt2d& /*P2S1*/, |
7fd59977 |
35 | const gp_Pnt2d& P1S2, |
36 | const gp_Pnt2d& P2S2, |
37 | const Standard_Real R, |
38 | gp_Cylinder& cyl, |
39 | gp_Circ& circ, |
40 | Standard_Real& First, |
41 | Standard_Real& Last) |
42 | |
43 | { |
44 | gp_Ax3 ax = S1->Plane().Position(); |
45 | gp_Vec V1(ax.XDirection()); |
46 | gp_Vec V2(ax.YDirection()); |
47 | gp_Pnt P; |
48 | gp_Vec du,dv; |
49 | S2->D1(P1S2.X(),P1S2.Y(),P,du,dv); |
50 | gp_Vec V(P,S1->Value(P1S1.X(),P1S1.Y())); |
51 | V = V.Dot(V1)*V1+V.Dot(V2)*V2; |
52 | V.Normalize(); |
53 | gp_Pnt P2 = S2->Value(P2S2.X(),P2S2.Y()); |
54 | gp_Vec Vorien(P,P2); |
55 | gp_Pnt cent; |
56 | gp_Dir dx(V); |
57 | if(V.Dot(Vorien) >= 0.){ |
58 | cent.SetCoord(P.X()+R*V.X(),P.Y()+R*V.Y(),P.Z()+R*V.Z()); |
59 | dx.Reverse(); |
60 | } |
61 | else { |
62 | cent.SetCoord(P.X()-R*V.X(),P.Y()-R*V.Y(),P.Z()-R*V.Z()); |
63 | } |
64 | gp_Dir dy(gp_Vec(cent,P2)); |
65 | dy = (dx^dy)^dx; |
66 | gp_Ax2 circax2(cent,dx^dy,dx); |
67 | gp_Ax3 cylax3(circax2); |
68 | if((du^dv).Dot(dx) < 0.) cylax3.ZReverse(); |
69 | First = 0.; |
70 | Last = ElCLib::CircleParameter(circax2,P2); |
71 | circ.SetPosition(circax2); |
72 | circ.SetRadius(R); |
73 | cyl.SetPosition(cylax3); |
74 | cyl.SetRadius(R); |
75 | } |