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 | |
18 | #include <GC_MakePlane.hxx> |
7fd59977 |
19 | #include <gce_MakePln.hxx> |
42cf5bc1 |
20 | #include <Geom_Plane.hxx> |
7fd59977 |
21 | #include <gp.hxx> |
42cf5bc1 |
22 | #include <gp_Ax1.hxx> |
23 | #include <gp_Ax2.hxx> |
7fd59977 |
24 | #include <gp_Ax3.hxx> |
42cf5bc1 |
25 | #include <gp_Dir.hxx> |
26 | #include <gp_Pln.hxx> |
27 | #include <gp_Pnt.hxx> |
7fd59977 |
28 | #include <Standard_NotImplemented.hxx> |
42cf5bc1 |
29 | #include <StdFail_NotDone.hxx> |
30 | #include <TColgp_Array1OfPnt.hxx> |
7fd59977 |
31 | |
32 | GC_MakePlane::GC_MakePlane(const gp_Ax2& ) //A2) |
33 | { |
34 | Standard_NotImplemented::Raise("GC_MakePlane"); |
35 | } |
36 | |
37 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl) |
38 | { |
39 | TheError = gce_Done; |
40 | ThePlane = new Geom_Plane(Pl); |
41 | } |
42 | |
43 | GC_MakePlane::GC_MakePlane(const gp_Pnt& P, |
44 | const gp_Dir& V) |
45 | { |
46 | TheError = gce_Done; |
47 | ThePlane = new Geom_Plane(P,V); |
48 | } |
49 | |
50 | GC_MakePlane::GC_MakePlane(const Standard_Real A, |
51 | const Standard_Real B, |
52 | const Standard_Real C, |
53 | const Standard_Real D) |
54 | { |
55 | if (Sqrt(A*A + B*B +C*C) <= gp::Resolution()) { |
56 | TheError = gce_BadEquation; |
57 | } |
58 | else { |
59 | TheError = gce_Done; |
60 | ThePlane = new Geom_Plane(gp_Pln(A,B,C,D)); |
61 | } |
62 | } |
63 | |
64 | //========================================================================= |
65 | // Creation d un Geom_Plane passant par trois points. + |
66 | //========================================================================= |
67 | |
68 | GC_MakePlane::GC_MakePlane(const gp_Pnt& P1 , |
69 | const gp_Pnt& P2 , |
70 | const gp_Pnt& P3 ) { |
71 | gce_MakePln Pl(P1,P2,P3); |
72 | TheError = Pl.Status(); |
73 | if (TheError == gce_Done) { |
74 | ThePlane = new Geom_Plane(Pl.Value()); |
75 | } |
76 | } |
77 | |
78 | //========================================================================= |
79 | // Creation d un Geom_Plane parallele a un pln a une distance donnee. + |
80 | //========================================================================= |
81 | |
82 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl , |
83 | const Standard_Real Dist ) { |
84 | gp_Pln Pln = gce_MakePln(Pl,Dist); |
85 | TheError = gce_Done; |
86 | ThePlane = new Geom_Plane(Pln); |
87 | } |
88 | |
89 | //========================================================================= |
90 | // Creation d un Geom_Plane parallele a un pln passant par un point + |
91 | // <Point1>. + |
92 | //========================================================================= |
93 | |
94 | GC_MakePlane::GC_MakePlane(const gp_Pln& Pl , |
95 | const gp_Pnt& Point ) { |
96 | gp_Pln Pln= gce_MakePln(Pl,Point); |
97 | TheError = gce_Done; |
98 | ThePlane = new Geom_Plane(Pln); |
99 | } |
100 | |
101 | //========================================================================= |
102 | // Creation d un Geom_Plane a partir d un Ax1 (Point + Normale). + |
103 | //========================================================================= |
104 | |
105 | GC_MakePlane::GC_MakePlane(const gp_Ax1& Axis ) { |
106 | gp_Pln Pln = gce_MakePln(Axis); |
107 | TheError = gce_Done; |
108 | ThePlane = new Geom_Plane(Pln); |
109 | } |
110 | |
111 | //========================================================================= |
112 | // Creation d un Geom_Plane par un tableau de points. + |
113 | //========================================================================= |
114 | |
115 | /*GC_MakePlane::GC_MakePlane(const TColgp_Array1OfPnt& Pts , |
116 | Standard_Real ErrMax , |
117 | Standard_Real ErrMean ) { |
118 | GC_MakePln Pln(Pts,ErrMax,ErrMean); |
119 | TheError = Pln.Status(); |
120 | if (TheError == GC_Done) { |
121 | ThePlane = new Geom_Plane(Pln.Value()); |
122 | } |
123 | } |
124 | */ |
125 | |
126 | const Handle(Geom_Plane)& GC_MakePlane::Value() const |
127 | { |
82fc327c |
128 | StdFail_NotDone_Raise_if(TheError != gce_Done,""); |
7fd59977 |
129 | return ThePlane; |
130 | } |