0024893: CLang warnings -Wlogical-not-parentheses for gce_Done comparisons
[occt.git] / src / GC / GC_MakeTrimmedCylinder.cxx
1 // Created on: 1992-10-02
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <GC_MakeTrimmedCylinder.ixx>
18 #include <GC_MakeCylindricalSurface.hxx>
19 #include <StdFail_NotDone.hxx>
20 #include <Standard_NotImplemented.hxx>
21
22 //=========================================================================
23 //   Creation of a cylinder limited by three points <P1>, <P2> and <P3>.         +
24 //   the height og the resulting cylinder is the distance from <P1> to <P2>.     +
25 //   The radius is the distance from <P3> to axis <P1P2>.                 +
26 //=========================================================================
27
28 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Pnt& P1 ,
29                                                  const gp_Pnt& P2 ,
30                                                  const gp_Pnt& P3 ) 
31 {
32   GC_MakeCylindricalSurface Cyl(P1,P2,P3);
33   TheError = Cyl.Status();
34   if (TheError == gce_Done) {
35     TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
36                                   P2.Distance(P1),Standard_True,Standard_True);
37   }
38 }
39
40 //=========================================================================
41 //   Creation of a cylinder limited by a circle and height.          +
42 //=========================================================================
43
44 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Circ&      Circ   ,
45                                                  const Standard_Real Height ) {
46   GC_MakeCylindricalSurface Cyl(Circ);
47   TheError = Cyl.Status();
48   if (TheError == gce_Done) {
49     TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
50                                            Height,Standard_True,Standard_True);
51   }
52 }
53      
54 //=========================================================================
55 //=========================================================================
56
57 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Ax1&       A1     ,
58                                                  const Standard_Real Radius ,
59                                                  const Standard_Real Height ) {
60   GC_MakeCylindricalSurface Cyl(A1,Radius);
61   TheError = Cyl.Status();
62   if (TheError == gce_Done) {
63     TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
64                                         Height,Standard_True,Standard_True);
65   }
66 }
67
68 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl,
69                                                  const gp_Pnt&      , // P,
70                                                  const Standard_Real )//Height)
71 {
72   Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder");
73 }
74
75 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl,
76                                                  const gp_Pnt&      , // P1,
77                                                  const gp_Pnt&      ) // P2)
78 {
79   Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder");
80 }
81
82 const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCylinder::
83        Value() const
84
85   StdFail_NotDone_Raise_if(TheError != gce_Done,"");
86   return TheCyl;
87 }
88
89 const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCylinder::
90        Operator() const 
91 {
92   return Value();
93 }
94
95 GC_MakeTrimmedCylinder::
96   operator Handle(Geom_RectangularTrimmedSurface) () const
97 {
98   return Value();
99 }
100