1 // Created on: 1992-09-02
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
22 #include <gce_MakeHypr2d.ixx>
23 #include <gp_Lin2d.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 //=========================================================================
33 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Pnt2d& S1 ,
35 const gp_Pnt2d& Center )
37 gp_Dir2d XAxis(gp_XY(S1.XY()-Center.XY()));
38 gp_Dir2d YAxis(gp_XY(S2.XY()-Center.XY()));
39 gp_Ax22d Axis(Center,XAxis,YAxis);
40 gp_Lin2d L(Center,XAxis);
41 Standard_Real D1 = S1.Distance(Center);
42 Standard_Real D2 = L.Distance(S2);
44 TheHypr2d = gp_Hypr2d(Axis,D1,D2);
47 else { TheError = gce_InvertAxis; }
50 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax2d& MajorAxis ,
51 const Standard_Real MajorRadius ,
52 const Standard_Real MinorRadius ,
53 const Standard_Boolean Sense )
55 if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
57 TheHypr2d = gp_Hypr2d(MajorAxis,MajorRadius,MinorRadius,Sense);
62 gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax22d& A ,
63 const Standard_Real MajorRadius ,
64 const Standard_Real MinorRadius )
66 if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
68 TheHypr2d = gp_Hypr2d(A,MajorRadius,MinorRadius);
73 const gp_Hypr2d& gce_MakeHypr2d::Value() const
75 StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
79 const gp_Hypr2d& gce_MakeHypr2d::Operator() const
84 gce_MakeHypr2d::operator gp_Hypr2d() const