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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <GC_MakeTrimmedCylinder.ixx>
18 #include <GC_MakeCylindricalSurface.hxx>
19 #include <StdFail_NotDone.hxx>
20 #include <Standard_NotImplemented.hxx>
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 //=========================================================================
28 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Pnt& P1 ,
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);
40 //=========================================================================
41 // Creation of a cylinder limited by a circle and height. +
42 //=========================================================================
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);
54 //=========================================================================
55 //=========================================================================
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);
68 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl,
70 const Standard_Real )//Height)
72 Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder");
75 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl,
76 const gp_Pnt& , // P1,
77 const gp_Pnt& ) // P2)
79 Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder");
82 const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCylinder::
85 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
89 const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCylinder::
95 GC_MakeTrimmedCylinder::
96 operator Handle(Geom_RectangularTrimmedSurface) () const