1 // Created on: 1992-10-13
2 // Created by: Laurent BUCHARD
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.
23 #include <IntCurve_ProjectOnPConicTool.ixx>
25 Standard_Real IntCurve_ProjectOnPConicTool::FindParameter
26 (const IntCurve_PConic& ThePConic,
28 const Standard_Real LowParameter,
29 const Standard_Real HighParameter,
30 const Standard_Real) {
33 Standard_Real ParamSup,ParamInf,Param=0;
34 if(LowParameter>HighParameter) {
35 ParamSup=LowParameter;
36 ParamInf=HighParameter;
39 ParamInf=LowParameter;
40 ParamSup=HighParameter;
43 switch(ThePConic.TypeCurve()) {
46 Param=ElCLib::LineParameter(ThePConic.Axis2().XAxis(),P);
50 Param=ElCLib::CircleParameter(ThePConic.Axis2(),P);
51 if(Param<0.0) { Param+=M_PI+M_PI; }
54 case GeomAbs_Ellipse: {
55 Param=ElCLib::EllipseParameter(ThePConic.Axis2()
59 if (Param < 0.0) { Param+=M_PI+M_PI; }
63 case GeomAbs_Parabola: {
64 Param=ElCLib::ParabolaParameter(ThePConic.Axis2(),P);
67 case GeomAbs_Hyperbola: {
68 Param=ElCLib::HyperbolaParameter(ThePConic.Axis2()
70 ,ThePConic.Param2(),P);
76 if(ParamInf!=ParamSup) {
77 if(Param<ParamInf) return(ParamInf);
78 if(Param>ParamSup) return(ParamSup);
84 Standard_Real IntCurve_ProjectOnPConicTool::FindParameter
85 (const IntCurve_PConic& ThePConic,
87 const Standard_Real) {
89 //cout<<"\n\n---- Dans ProjectOnPConicTool::FindParameter Point : "<<P.X()<<","<<P.Y();
91 Standard_Real Param=0;
93 switch(ThePConic.TypeCurve()) {
96 Param=ElCLib::LineParameter(ThePConic.Axis2().XAxis(),P);
100 Param=ElCLib::CircleParameter(ThePConic.Axis2(),P);
101 if(Param<0.0) { Param+=M_PI+M_PI; }
104 case GeomAbs_Ellipse: {
105 Param=ElCLib::EllipseParameter(ThePConic.Axis2()
109 if (Param < 0.0) { Param+=M_PI+M_PI; }
113 case GeomAbs_Parabola: {
114 Param=ElCLib::ParabolaParameter(ThePConic.Axis2(),P);
117 case GeomAbs_Hyperbola: {
118 Param=ElCLib::HyperbolaParameter(ThePConic.Axis2()
120 ,ThePConic.Param2(),P);