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.
18 #include <GC_MakeCylindricalSurface.hxx>
19 #include <GC_MakeTrimmedCylinder.hxx>
20 #include <Geom_CylindricalSurface.hxx>
21 #include <Geom_RectangularTrimmedSurface.hxx>
23 #include <gp_Circ.hxx>
24 #include <gp_Cylinder.hxx>
26 #include <Standard_NotImplemented.hxx>
27 #include <StdFail_NotDone.hxx>
29 //=========================================================================
30 // Creation of a cylinder limited by three points <P1>, <P2> and <P3>. +
31 // the height og the resulting cylinder is the distance from <P1> to <P2>. +
32 // The radius is the distance from <P3> to axis <P1P2>. +
33 //=========================================================================
34 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Pnt& P1 ,
38 GC_MakeCylindricalSurface Cyl(P1,P2,P3);
39 TheError = Cyl.Status();
40 if (TheError == gce_Done) {
41 TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
42 P2.Distance(P1),Standard_True,Standard_True);
46 //=========================================================================
47 // Creation of a cylinder limited by a circle and height. +
48 //=========================================================================
50 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Circ& Circ ,
51 const Standard_Real Height ) {
52 GC_MakeCylindricalSurface Cyl(Circ);
53 TheError = Cyl.Status();
54 if (TheError == gce_Done) {
55 TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
56 Height,Standard_True,Standard_True);
60 //=========================================================================
61 //=========================================================================
63 GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Ax1& A1 ,
64 const Standard_Real Radius ,
65 const Standard_Real Height ) {
66 GC_MakeCylindricalSurface Cyl(A1,Radius);
67 TheError = Cyl.Status();
68 if (TheError == gce_Done) {
69 TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
70 Height,Standard_True,Standard_True);
74 const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCylinder::
77 StdFail_NotDone_Raise_if (TheError != gce_Done,
78 "GC_MakeTrimmedCylinder::Value() - no result");