0024927: Getting rid of "Persistent" functionality -- Storable
[occt.git] / src / gp / gp_Elips2d.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15//Modif JCV 10/01/91
16
17#include <gp_Elips2d.ixx>
18
19void gp_Elips2d::Coefficients (Standard_Real& A,
20 Standard_Real& B,
21 Standard_Real& C,
22 Standard_Real& D,
23 Standard_Real& E,
24 Standard_Real& F) const
25{
26 Standard_Real DMin = minorRadius * minorRadius;
27 Standard_Real DMaj = majorRadius * majorRadius;
28 if (DMin <= gp::Resolution() && DMaj <= gp::Resolution()) {
29 A = B = C = D = E = F = 0.0;
30 }
31 else {
32 gp_Trsf2d T;
33 T.SetTransformation (pos.XAxis());
34 Standard_Real T11 = T.Value (1, 1);
35 Standard_Real T12 = T.Value (1, 2);
36 Standard_Real T13 = T.Value (1, 3);
37 if (DMin <= gp::Resolution()) {
38 A = T11 * T11; B = T12 * T12; C = T11 * T12;
39 D = T11 * T13; E = T12 * T13; F = T13 * T13 - DMaj;
40 }
41 else {
42 Standard_Real T21 = T.Value (2, 1);
43 Standard_Real T22 = T.Value (2, 2);
44 Standard_Real T23 = T.Value (2, 3);
45 A = (T11 * T11 / DMaj) + (T21 * T21 / DMin);
46 B = (T12 * T12 / DMaj) + (T22 * T22 / DMin);
47 C = (T11 * T12 / DMaj) + (T21 * T22 / DMin);
48 D = (T11 * T13 / DMaj) + (T21 * T23 / DMin);
49 E = (T12 * T13 / DMaj) + (T22 * T23 / DMin);
50 F = (T13 * T13 / DMaj) + (T23 * T23 / DMin) - 1.0;
51 }
52 }
53}
54
55void gp_Elips2d::Mirror (const gp_Pnt2d& P)
56{ pos.Mirror(P); }
57
58gp_Elips2d gp_Elips2d::Mirrored (const gp_Pnt2d& P) const
59{
60 gp_Elips2d E = *this;
61 E.pos.Mirror (P);
62 return E;
63}
64
65void gp_Elips2d::Mirror (const gp_Ax2d& A)
66{ pos.Mirror(A); }
67
68gp_Elips2d gp_Elips2d::Mirrored (const gp_Ax2d& A) const
69{
70 gp_Elips2d E = *this;
71 E.pos.Mirror (A);
72 return E;
73}
74