Commit | Line | Data |
---|---|---|
7fd59977 | 1 | // File: GC_MakeTrimmedCone.cxx |
2 | // Created: Fri Oct 2 16:38:33 1992 | |
3 | // Author: Remi GILET | |
4 | // <reg@topsn3> | |
5 | ||
6 | #include <GC_MakeTrimmedCone.ixx> | |
7 | #include <GC_MakeConicalSurface.hxx> | |
8 | #include <StdFail_NotDone.hxx> | |
9 | #include <Geom_ConicalSurface.hxx> | |
10 | #include <gp_Dir.hxx> | |
11 | #include <gp_Lin.hxx> | |
12 | #include <gp_Pnt.hxx> | |
13 | #include <Extrema_ExtPElC.hxx> | |
14 | ||
15 | //========================================================================= | |
0d969553 Y |
16 | // Creation of a cone by four points. + |
17 | // First two give the axis. + | |
18 | // The third gives the base radius. + | |
19 | // the third and the fourth demi-angle. + | |
7fd59977 | 20 | //========================================================================= |
21 | ||
22 | GC_MakeTrimmedCone::GC_MakeTrimmedCone(const gp_Pnt& P1 , | |
23 | const gp_Pnt& P2 , | |
24 | const gp_Pnt& P3 , | |
25 | const gp_Pnt& P4 ) | |
26 | { | |
27 | GC_MakeConicalSurface Cone(P1,P2,P3,P4); | |
28 | TheError = Cone.Status(); | |
29 | if (TheError == gce_Done) { | |
30 | gp_Dir D1(P2.XYZ()-P1.XYZ()); | |
31 | gp_Lin L1(P1,D1); | |
32 | Extrema_ExtPElC ext1(P3,L1,1.0e-7,-2.0e+100,+2.0e+100); | |
33 | Extrema_ExtPElC ext2(P4,L1,1.0e-7,-2.0e+100,+2.0e+100); | |
34 | gp_Pnt P5 = ext1.Point(1).Value(); | |
35 | gp_Pnt P6 = ext2.Point(1).Value(); | |
36 | Standard_Real D = P6.Distance(P5)/cos((Cone.Value())->SemiAngle()); | |
c6541a0c | 37 | TheCone=new Geom_RectangularTrimmedSurface(Cone.Value(),0.,2.*M_PI,0.,D,Standard_True,Standard_True); |
7fd59977 | 38 | } |
39 | } | |
40 | ||
41 | //========================================================================= | |
42 | //========================================================================= | |
43 | ||
44 | GC_MakeTrimmedCone::GC_MakeTrimmedCone(const gp_Pnt& P1 , | |
45 | const gp_Pnt& P2 , | |
46 | const Standard_Real R1 , | |
47 | const Standard_Real R2 ) | |
48 | { | |
49 | GC_MakeConicalSurface Cone(P1,P2,R1,R2); | |
50 | TheError = Cone.Status(); | |
51 | if (TheError == gce_Done) { | |
52 | Standard_Real D = (P2.Distance(P1))/cos((Cone.Value())->SemiAngle()); | |
c6541a0c | 53 | TheCone=new Geom_RectangularTrimmedSurface(Cone.Value(),0.,2.*M_PI,0.,D,Standard_True,Standard_True); |
7fd59977 | 54 | } |
55 | } | |
56 | ||
57 | //======================================================================= | |
58 | //function : Value | |
59 | //purpose : | |
60 | //======================================================================= | |
61 | ||
62 | const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCone:: | |
63 | Value() const | |
64 | { | |
65 | StdFail_NotDone_Raise_if(!TheError == gce_Done,""); | |
66 | return TheCone; | |
67 | } | |
68 | ||
69 | const Handle(Geom_RectangularTrimmedSurface)& GC_MakeTrimmedCone:: | |
70 | Operator() const | |
71 | { | |
72 | return Value(); | |
73 | } | |
74 | ||
75 | GC_MakeTrimmedCone:: | |
76 | operator Handle(Geom_RectangularTrimmedSurface) () const | |
77 | { | |
78 | return Value(); | |
79 | } | |
80 |