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 <Extrema_ExtPElC.hxx>
19 #include <GC_MakeConicalSurface.hxx>
20 #include <GC_MakeTrimmedCone.hxx>
21 #include <Geom_ConicalSurface.hxx>
22 #include <Geom_RectangularTrimmedSurface.hxx>
26 #include <StdFail_NotDone.hxx>
28 //=========================================================================
29 // Creation of a cone by four points. +
30 // First two give the axis. +
31 // The third gives the base radius. +
32 // the third and the fourth demi-angle. +
33 //=========================================================================
34 GC_MakeTrimmedCone::GC_MakeTrimmedCone(const gp_Pnt& P1 ,
39 GC_MakeConicalSurface Cone(P1,P2,P3,P4);
40 TheError = Cone.Status();
41 if (TheError == gce_Done) {
42 gp_Dir D1(P2.XYZ()-P1.XYZ());
44 Extrema_ExtPElC ext1(P3,L1,1.0e-7,-2.0e+100,+2.0e+100);
45 Extrema_ExtPElC ext2(P4,L1,1.0e-7,-2.0e+100,+2.0e+100);
46 gp_Pnt P5 = ext1.Point(1).Value();
47 gp_Pnt P6 = ext2.Point(1).Value();
48 Standard_Real D = P6.Distance(P5)/cos((Cone.Value())->SemiAngle());
49 TheCone=new Geom_RectangularTrimmedSurface(Cone.Value(),0.,2.*M_PI,0.,D,Standard_True,Standard_True);
53 //=========================================================================
54 //=========================================================================
56 GC_MakeTrimmedCone::GC_MakeTrimmedCone(const gp_Pnt& P1 ,
58 const Standard_Real R1 ,
59 const Standard_Real R2 )
61 GC_MakeConicalSurface Cone(P1,P2,R1,R2);
62 TheError = Cone.Status();
63 if (TheError == gce_Done) {
64 Standard_Real D = (P2.Distance(P1))/cos((Cone.Value())->SemiAngle());
65 TheCone=new Geom_RectangularTrimmedSurface(Cone.Value(),0.,2.*M_PI,0.,D,Standard_True,Standard_True);
69 //=======================================================================
72 //=======================================================================
74 const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCone::
77 StdFail_NotDone_Raise_if(TheError != gce_Done,"");