0024816: Tool for upgrading OCCT and dependent code
[occt.git] / src / GC / GC_MakeTrimmedCylinder.cxx
CommitLineData
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
42cf5bc1 17
7fd59977 18#include <GC_MakeCylindricalSurface.hxx>
42cf5bc1 19#include <GC_MakeTrimmedCylinder.hxx>
83eaf3e8 20#include <Geom_CylindricalSurface.hxx>
42cf5bc1 21#include <Geom_RectangularTrimmedSurface.hxx>
22#include <gp_Ax1.hxx>
23#include <gp_Circ.hxx>
24#include <gp_Cylinder.hxx>
25#include <gp_Pnt.hxx>
26#include <Standard_NotImplemented.hxx>
27#include <StdFail_NotDone.hxx>
7fd59977 28
29//=========================================================================
0d969553
Y
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>. +
7fd59977 33//=========================================================================
7fd59977 34GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Pnt& P1 ,
35 const gp_Pnt& P2 ,
36 const gp_Pnt& P3 )
37{
38 GC_MakeCylindricalSurface Cyl(P1,P2,P3);
39 TheError = Cyl.Status();
40 if (TheError == gce_Done) {
c6541a0c 41 TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
7fd59977 42 P2.Distance(P1),Standard_True,Standard_True);
43 }
44}
45
46//=========================================================================
0d969553 47// Creation of a cylinder limited by a circle and height. +
7fd59977 48//=========================================================================
49
50GC_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) {
c6541a0c 55 TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
7fd59977 56 Height,Standard_True,Standard_True);
57 }
58}
59
60//=========================================================================
61//=========================================================================
62
63GC_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) {
c6541a0c 69 TheCyl = new Geom_RectangularTrimmedSurface(Cyl.Value(),0.,2.*M_PI,0.,
7fd59977 70 Height,Standard_True,Standard_True);
71 }
72}
73
74GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl,
75 const gp_Pnt& , // P,
76 const Standard_Real )//Height)
77{
78 Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder");
79}
80
81GC_MakeTrimmedCylinder::GC_MakeTrimmedCylinder(const gp_Cylinder& , // Cyl,
82 const gp_Pnt& , // P1,
83 const gp_Pnt& ) // P2)
84{
85 Standard_NotImplemented::Raise("GC_MakeTrimmedCylinder");
86}
87
88const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCylinder::
89 Value() const
90{
82fc327c 91 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
7fd59977 92 return TheCyl;
93}