1 // Created on: 1992-09-02
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <gce_MakeHypr2d.hxx>
19 #include <gp_Ax2d.hxx>
20 #include <gp_Ax22d.hxx>
21 #include <gp_Hypr2d.hxx>
22 #include <gp_Lin2d.hxx>
23 #include <gp_Pnt2d.hxx>
24 #include <StdFail_NotDone.hxx>
26 //=========================================================================
27 // Creation d une Hyperbola 2d de gp de centre <Center> et de sommets +
29 // <CenterS1> donne le grand axe . +
30 // <S1> donne le grand rayon et <S2> le petit rayon. +
31 //=========================================================================
32 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Pnt2d& S1 ,
34 const gp_Pnt2d& Center )
36 gp_Dir2d XAxis(gp_XY(S1.XY()-Center.XY()));
37 gp_Dir2d YAxis(gp_XY(S2.XY()-Center.XY()));
38 gp_Ax22d Axis(Center,XAxis,YAxis);
39 gp_Lin2d L(Center,XAxis);
40 Standard_Real D1 = S1.Distance(Center);
41 Standard_Real D2 = L.Distance(S2);
43 TheHypr2d = gp_Hypr2d(Axis,D1,D2);
46 else { TheError = gce_InvertAxis; }
49 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax2d& MajorAxis ,
50 const Standard_Real MajorRadius ,
51 const Standard_Real MinorRadius ,
52 const Standard_Boolean Sense )
54 if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
56 TheHypr2d = gp_Hypr2d(MajorAxis,MajorRadius,MinorRadius,Sense);
61 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax22d& A ,
62 const Standard_Real MajorRadius ,
63 const Standard_Real MinorRadius )
65 if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
67 TheHypr2d = gp_Hypr2d(A,MajorRadius,MinorRadius);
72 const gp_Hypr2d& gce_MakeHypr2d::Value() const
74 StdFail_NotDone_Raise_if (TheError != gce_Done,
75 "gce_MakeHypr2d::Value() - no result");
79 const gp_Hypr2d& gce_MakeHypr2d::Operator() const
84 gce_MakeHypr2d::operator gp_Hypr2d() const