Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1992-10-02 |
2 | // Created by: Remi GILET | |
3 | // Copyright (c) 1992-1999 Matra Datavision | |
973c2be1 | 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | // |
973c2be1 | 6 | // This file is part of Open CASCADE Technology software library. |
b311480e | 7 | // |
d5f74e42 | 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 | |
973c2be1 | 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. | |
b311480e | 13 | // |
973c2be1 | 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. | |
7fd59977 | 16 | |
17 | #include <GC_MakeTrimmedCylinder.ixx> | |
18 | #include <GC_MakeCylindricalSurface.hxx> | |
19 | #include <StdFail_NotDone.hxx> | |
20 | #include <Standard_NotImplemented.hxx> | |
83eaf3e8 | 21 | #include <Geom_CylindricalSurface.hxx> |
7fd59977 | 22 | |
23 | //========================================================================= | |
0d969553 Y |
24 | // Creation of a cylinder limited by three points <P1>, <P2> and <P3>. + |
25 | // the height og the resulting cylinder is the distance from <P1> to <P2>. + | |
26 | // The radius is the distance from <P3> to axis <P1P2>. + | |
7fd59977 | 27 | //========================================================================= |
28 | ||
29 | GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Pnt& P1 , | |
30 | const gp_Pnt& P2 , | |
31 | const gp_Pnt& P3 ) | |
32 | { | |
33 | GC_MakeCylindricalSurface Cyl(P1,P2,P3); | |
34 | TheError = Cyl.Status(); | |
35 | if (TheError == gce_Done) { | |
c6541a0c | 36 | TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0., |
7fd59977 | 37 | P2.Distance(P1),Standard_True,Standard_True); |
38 | } | |
39 | } | |
40 | ||
41 | //========================================================================= | |
0d969553 | 42 | // Creation of a cylinder limited by a circle and height. + |
7fd59977 | 43 | //========================================================================= |
44 | ||
45 | GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Circ& Circ , | |
46 | const Standard_Real Height ) { | |
47 | GC_MakeCylindricalSurface Cyl(Circ); | |
48 | TheError = Cyl.Status(); | |
49 | if (TheError == gce_Done) { | |
c6541a0c | 50 | TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0., |
7fd59977 | 51 | Height,Standard_True,Standard_True); |
52 | } | |
53 | } | |
54 | ||
55 | //========================================================================= | |
56 | //========================================================================= | |
57 | ||
58 | GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Ax1& A1 , | |
59 | const Standard_Real Radius , | |
60 | const Standard_Real Height ) { | |
61 | GC_MakeCylindricalSurface Cyl(A1,Radius); | |
62 | TheError = Cyl.Status(); | |
63 | if (TheError == gce_Done) { | |
c6541a0c | 64 | TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0., |
7fd59977 | 65 | Height,Standard_True,Standard_True); |
66 | } | |
67 | } | |
68 | ||
69 | GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl, | |
70 | const gp_Pnt& , // P, | |
71 | const Standard_Real )//Height) | |
72 | { | |
73 | Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder"); | |
74 | } | |
75 | ||
76 | GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl, | |
77 | const gp_Pnt& , // P1, | |
78 | const gp_Pnt& ) // P2) | |
79 | { | |
80 | Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder"); | |
81 | } | |
82 | ||
83 | const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCylinder:: | |
84 | Value() const | |
85 | { | |
82fc327c | 86 | StdFail_NotDone_Raise_if(TheError != gce_Done,""); |
7fd59977 | 87 | return TheCyl; |
88 | } |