0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / gp / gp_Sphere.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.
7fd59977 14
d5477f8c 15#include <gp_Sphere.hxx>
42cf5bc1 16
17#include <gp_Ax1.hxx>
18#include <gp_Ax2.hxx>
19#include <gp_Ax3.hxx>
20#include <gp_Pnt.hxx>
42cf5bc1 21#include <gp_Trsf.hxx>
7fd59977 22
23void gp_Sphere::Coefficients
24(Standard_Real& A1, Standard_Real& A2, Standard_Real& A3,
25 Standard_Real& B1, Standard_Real& B2, Standard_Real& B3,
26 Standard_Real& C1, Standard_Real& C2, Standard_Real& C3,
27 Standard_Real& D) const
28{
29 // Dans le repere local de la sphere :
30 // X*X + Y*Y + Z*Z - radius * radius = 0
31 gp_Trsf T;
32 T.SetTransformation (pos);
33 Standard_Real T11 = T.Value (1, 1);
34 Standard_Real T12 = T.Value (1, 2);
35 Standard_Real T13 = T.Value (1, 3);
36 Standard_Real T14 = T.Value (1, 4);
37 Standard_Real T21 = T.Value (2, 1);
38 Standard_Real T22 = T.Value (2, 2);
39 Standard_Real T23 = T.Value (2, 3);
40 Standard_Real T24 = T.Value (2, 4);
41 Standard_Real T31 = T.Value (3, 1);
42 Standard_Real T32 = T.Value (3, 2);
43 Standard_Real T33 = T.Value (3, 3);
44 Standard_Real T34 = T.Value (3, 4);
45 A1 = T11 * T11 + T21 * T21 + T31 * T31;
46 A2 = T12 * T12 + T22 * T22 + T32 * T32;
47 A3 = T13 * T13 + T23 * T23 + T33 * T33;
48 B1 = T11 * T12 + T21 * T22 + T31 * T32;
49 B2 = T11 * T13 + T21 * T23 + T31 * T33;
50 B3 = T12 * T13 + T22 * T23 + T32 * T33;
51 C1 = T11 * T14 + T21 * T24 + T31 * T34;
52 C2 = T12 * T14 + T22 * T24 + T32 * T34;
53 C3 = T13 * T14 + T23 * T24 + T33 * T34;
54 D = T14 * T14 + T24 * T24 + T34 * T34 - radius * radius;
55}
56
57void gp_Sphere::Mirror (const gp_Pnt& P)
58{ pos.Mirror (P); }
59
60gp_Sphere gp_Sphere::Mirrored (const gp_Pnt& P) const
61{
62 gp_Sphere C = *this;
63 C.pos.Mirror (P);
64 return C;
65}
66
67void gp_Sphere::Mirror (const gp_Ax1& A1)
68{ pos.Mirror (A1); }
69
70gp_Sphere gp_Sphere::Mirrored (const gp_Ax1& A1) const
71{
72 gp_Sphere C = *this;
73 C.pos.Mirror (A1);
74 return C;
75}
76
77void gp_Sphere::Mirror (const gp_Ax2& A2)
78{ pos.Mirror (A2); }
79
80gp_Sphere gp_Sphere::Mirrored (const gp_Ax2& A2) const
81{
82 gp_Sphere C = *this;
83 C.pos.Mirror (A2);
84 return C;
85}
86