Test for 0022778: Bug in BRepMesh
[occt.git] / src / gp / gp_Cylinder.cxx
CommitLineData
b311480e 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
7fd59977 19// LPA, JCV 07/92 passage sur C1.
20// JCV 07/92 Introduction de la method Dump
21// LBO 08/93 passage aux Ax3
22
23#include <gp_Cylinder.ixx>
24#include <Standard_ConstructionError.hxx>
25
26void gp_Cylinder::Coefficients
27(Standard_Real& A1, Standard_Real& A2, Standard_Real& A3,
28 Standard_Real& B1, Standard_Real& B2, Standard_Real& B3,
29 Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const
30{
31 // Dans le repere local du cylindre :
32 // X**2 + Y**2 - radius = 0.0
33 gp_Trsf T;
34 T.SetTransformation (pos);
35 Standard_Real T11 = T.Value (1, 1);
36 Standard_Real T12 = T.Value (1, 2);
37 Standard_Real T13 = T.Value (1, 3);
38 Standard_Real T14 = T.Value (1, 4);
39 Standard_Real T21 = T.Value (2, 1);
40 Standard_Real T22 = T.Value (2, 2);
41 Standard_Real T23 = T.Value (2, 3);
42 Standard_Real T24 = T.Value (2, 4);
43
44 A1 = T11 * T11 + T21 * T21;
45 A2 = T12 * T12 + T22 * T22;
46 A3 = T13 * T13 + T23 * T23;
47 B1 = T11 * T12 + T21 * T22;
48 B2 = T11 * T13 + T21 * T23;
49 B3 = T12 * T13 + T22 * T23;
50 C1 = T11 * T14 + T21 * T24;
51 C2 = T12 * T14 + T22 * T24;
52 C3 = T13 * T14 + T23 * T24;
53 D = T14 * T14 + T24 * T24 - radius * radius;
54}
55
56void gp_Cylinder::Mirror (const gp_Pnt& P)
57{ pos.Mirror (P); }
58
59gp_Cylinder gp_Cylinder::Mirrored (const gp_Pnt& P) const
60{
61 gp_Cylinder C = *this;
62 C.pos.Mirror (P);
63 return C;
64}
65
66void gp_Cylinder::Mirror (const gp_Ax1& A1)
67{ pos.Mirror (A1); }
68
69gp_Cylinder gp_Cylinder::Mirrored (const gp_Ax1& A1) const
70{
71 gp_Cylinder C = *this;
72 C.pos.Mirror (A1);
73 return C;
74}
75
76void gp_Cylinder::Mirror (const gp_Ax2& A2)
77{ pos.Mirror (A2); }
78
79gp_Cylinder gp_Cylinder::Mirrored (const gp_Ax2& A2) const
80{
81 gp_Cylinder C = *this;
82 C.pos.Mirror (A2);
83 return C;
84}
85