0023024: Update headers of OCCT files
[occt.git] / src / gp / gp_Elips2d.cxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 //
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
8 //
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 //
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
18
19 //Modif JCV 10/01/91
20
21 #include <gp_Elips2d.ixx>
22
23 void gp_Elips2d::Coefficients (Standard_Real& A, 
24                                Standard_Real& B, 
25                                Standard_Real& C, 
26                                Standard_Real& D, 
27                                Standard_Real& E, 
28                                Standard_Real& F) const 
29 {
30   Standard_Real DMin = minorRadius * minorRadius;
31   Standard_Real DMaj = majorRadius * majorRadius;
32   if (DMin <= gp::Resolution() && DMaj <= gp::Resolution()) {
33     A = B = C = D = E = F = 0.0;
34   }
35   else {
36     gp_Trsf2d T;
37     T.SetTransformation (pos.XAxis());
38     Standard_Real T11 = T.Value (1, 1);
39     Standard_Real T12 = T.Value (1, 2);
40     Standard_Real T13 = T.Value (1, 3);
41     if (DMin <= gp::Resolution()) {
42       A = T11 * T11;    B = T12 * T12;   C = T11 * T12;
43       D = T11 * T13;    E = T12 * T13;   F = T13 * T13 - DMaj;
44     }
45     else {
46       Standard_Real T21 = T.Value (2, 1);
47       Standard_Real T22 = T.Value (2, 2);
48       Standard_Real T23 = T.Value (2, 3);
49       A = (T11 * T11 / DMaj) + (T21 * T21 / DMin);
50       B = (T12 * T12 / DMaj) + (T22 * T22 / DMin);
51       C = (T11 * T12 / DMaj) + (T21 * T22 / DMin);
52       D = (T11 * T13 / DMaj) + (T21 * T23 / DMin);
53       E = (T12 * T13 / DMaj) + (T22 * T23 / DMin);
54       F = (T13 * T13 / DMaj) + (T23 * T23 / DMin) - 1.0;
55     }
56   }
57 }
58
59 void gp_Elips2d::Mirror (const gp_Pnt2d& P)
60 { pos.Mirror(P); }
61
62 gp_Elips2d gp_Elips2d::Mirrored (const gp_Pnt2d& P) const  
63 {
64   gp_Elips2d E = *this;
65   E.pos.Mirror (P);
66   return E; 
67 }
68
69 void gp_Elips2d::Mirror (const gp_Ax2d& A)
70 { pos.Mirror(A); }
71
72 gp_Elips2d gp_Elips2d::Mirrored (const gp_Ax2d& A) const  
73 {
74   gp_Elips2d E = *this;
75   E.pos.Mirror (A);
76   return E; 
77 }
78