summaryrefslogtreecommitdiff
path: root/src/gp/gp_Sphere.cxx
blob: d8babc874166c44921925e7d64c9b42b06bdcd0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

//File gp_Sphere.cxx JCV 09/03/91

#include <gp_Sphere.ixx>
#include <Standard_ConstructionError.hxx>

void gp_Sphere::Coefficients
(Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, 
 Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, 
 Standard_Real& C1, Standard_Real& C2, Standard_Real& C3,
 Standard_Real& D) const
{
  // Dans le repere local de la sphere :
  // X*X + Y*Y + Z*Z - radius * radius = 0
  gp_Trsf T;
  T.SetTransformation (pos);
  Standard_Real T11 = T.Value (1, 1);
  Standard_Real T12 = T.Value (1, 2);
  Standard_Real T13 = T.Value (1, 3);
  Standard_Real T14 = T.Value (1, 4);
  Standard_Real T21 = T.Value (2, 1);
  Standard_Real T22 = T.Value (2, 2);
  Standard_Real T23 = T.Value (2, 3);
  Standard_Real T24 = T.Value (2, 4);
  Standard_Real T31 = T.Value (3, 1);
  Standard_Real T32 = T.Value (3, 2);
  Standard_Real T33 = T.Value (3, 3);
  Standard_Real T34 = T.Value (3, 4);
  A1 = T11 * T11 + T21 * T21 + T31 * T31;
  A2 = T12 * T12 + T22 * T22 + T32 * T32;
  A3 = T13 * T13 + T23 * T23 + T33 * T33;
  B1 = T11 * T12 + T21 * T22 + T31 * T32;
  B2 = T11 * T13 + T21 * T23 + T31 * T33;
  B3 = T12 * T13 + T22 * T23 + T32 * T33;
  C1 = T11 * T14 + T21 * T24 + T31 * T34;
  C2 = T12 * T14 + T22 * T24 + T32 * T34;
  C3 = T13 * T14 + T23 * T24 + T33 * T34;
  D  = T14 * T14 + T24 * T24 + T34 * T34 - radius * radius;
}

void gp_Sphere::Mirror (const gp_Pnt& P)
{ pos.Mirror (P); }

gp_Sphere gp_Sphere::Mirrored (const gp_Pnt& P) const
{
  gp_Sphere C = *this;
  C.pos.Mirror (P);
  return C;
}

void gp_Sphere::Mirror (const gp_Ax1& A1)
{ pos.Mirror (A1); }

gp_Sphere gp_Sphere::Mirrored (const gp_Ax1& A1) const
{
  gp_Sphere C = *this;
  C.pos.Mirror (A1);
  return C;
}

void gp_Sphere::Mirror (const gp_Ax2& A2)
{ pos.Mirror (A2); }

gp_Sphere gp_Sphere::Mirrored (const gp_Ax2& A2) const
{
  gp_Sphere C = *this;
  C.pos.Mirror (A2);
  return C;
}