0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / gp / gp_Cone.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// LPA, JCV 07/92 passage sur C1.
16// JCV 07/92 Introduction de la method Dump
17
42cf5bc1 18#include <gp_Ax1.hxx>
19#include <gp_Ax2.hxx>
20#include <gp_Ax3.hxx>
21#include <gp_Cone.hxx>
22#include <gp_Pnt.hxx>
23#include <gp_Trsf.hxx>
24#include <gp_Vec.hxx>
25#include <Standard_ConstructionError.hxx>
7fd59977 26
27void gp_Cone::Coefficients
28(Standard_Real& A1, Standard_Real& A2, Standard_Real& A3,
29 Standard_Real& B1, Standard_Real& B2, Standard_Real& B3,
30 Standard_Real& C1, Standard_Real& C2, Standard_Real& C3,
31 Standard_Real& D) const
32{
33 // Dans le repere du cone :
34 // X**2 + Y**2 - (radius + Z * Tan(semiAngle))**2 = 0.0
35 gp_Trsf T;
36 T.SetTransformation (pos);
37 Standard_Real KAng = Tan (semiAngle);
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 Standard_Real T14 = T.Value (1, 4);
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 Standard_Real T24 = T.Value (2, 4);
46 Standard_Real T31 = T.Value (3, 1) * KAng;
47 Standard_Real T32 = T.Value (3, 2) * KAng;
48 Standard_Real T33 = T.Value (3, 3) * KAng;
49 Standard_Real T34 = T.Value (3, 4) * KAng;
50 A1 = T11 * T11 + T21 * T21 - T31 * T31;
51 A2 = T12 * T12 + T22 * T22 - T32 * T32;
52 A3 = T13 * T13 + T23 * T23 - T33 * T33;
53 B1 = T11 * T12 + T21 * T22 - T31 * T32;
54 B2 = T11 * T13 + T21 * T23 - T31 * T33;
55 B3 = T12 * T13 + T22 * T23 - T32 * T33;
56 C1 = T11 * T14 + T21 * T24 - T31 * (radius + T34);
57 C2 = T12 * T14 + T22 * T24 - T32 * (radius + T34);
58 C3 = T13 * T14 + T23 * T24 - T33 * (radius + T34);
59 D = T14*T14 + T24*T24 - radius*radius - T34*T34 - 2.0*radius*T34;
60}
61
62void gp_Cone::Mirror (const gp_Pnt& P)
63{ pos.Mirror (P); }
64
65gp_Cone gp_Cone::Mirrored (const gp_Pnt& P) const
66{
67 gp_Cone C = *this;
68 C.pos.Mirror (P);
69 return C;
70}
71
72void gp_Cone::Mirror (const gp_Ax1& A1)
73{ pos.Mirror (A1); }
74
75gp_Cone gp_Cone::Mirrored (const gp_Ax1& A1) const
76{
77 gp_Cone C = *this;
78 C.pos.Mirror (A1);
79 return C;
80}
81
82void gp_Cone::Mirror (const gp_Ax2& A2)
83{ pos.Mirror (A2); }
84
85gp_Cone gp_Cone::Mirrored (const gp_Ax2& A2) const
86{
87 gp_Cone C = *this;
88 C.pos.Mirror (A2);
89 return C;
90}
91