1 // Created on: 1992-09-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 <gce_MakePln.hxx>
26 #include <StdFail_NotDone.hxx>
28 gce_MakePln::gce_MakePln(const gp_Ax2& A2)
30 ThePln = gp_Pln(gp_Ax3(A2));
34 gce_MakePln::gce_MakePln(const gp_Pnt& P,
41 gce_MakePln::gce_MakePln(const gp_Pnt& P1,
44 if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
46 gp_Dir dir(P2.XYZ()-P1.XYZ());
47 ThePln = gp_Pln(P1,dir);
52 gce_MakePln::gce_MakePln(const Standard_Real A,
53 const Standard_Real B,
54 const Standard_Real C,
55 const Standard_Real D)
57 if (A*A + B*B + C*C <= gp::Resolution()) {
58 TheError = gce_BadEquation;
61 ThePln = gp_Pln(A,B,C,D);
66 //=========================================================================
67 // Creation d un gp_pln passant par trois points. +
68 //=========================================================================
70 gce_MakePln::gce_MakePln(const gp_Pnt& P1 ,
74 gp_XYZ V1(P2.XYZ()-P1.XYZ());
75 gp_XYZ V2(P3.XYZ()-P1.XYZ());
76 gp_XYZ Norm(V1.Crossed(V2));
77 if (Norm.Modulus() < gp::Resolution()) { TheError = gce_ColinearPoints; }
81 ThePln = gp_Pln(gp_Ax3(P1,DNorm,Dx));
86 //=========================================================================
87 // Creation d un gp_pln parallele a un autre pln a une distance donnee. +
88 //=========================================================================
90 gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
91 const Standard_Real Dist )
93 gp_Pnt Center(Pl.Location().XYZ()+Dist*gp_XYZ(Pl.Axis().Direction().XYZ()));
94 ThePln=gp_Pln(gp_Ax3(Center,Pl.Axis().Direction(),Pl.XAxis().Direction()));
98 //=========================================================================
99 // Creation d un gp_pln parallele a un autre pln passant par un point +
101 //=========================================================================
103 gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
104 const gp_Pnt& Point )
106 ThePln = gp_Pln(gp_Ax3(Point,Pl.Axis().Direction(),Pl.XAxis().Direction()));
110 //=========================================================================
111 // Creation d un gp_pln a partir d un Ax1 (Point + Normale). +
112 //=========================================================================
114 gce_MakePln::gce_MakePln(const gp_Ax1& Axis )
116 ThePln = gp_Pln(Axis.Location(),Axis.Direction());
120 //=========================================================================
121 // Creation d un gp_pln par un tableau de points. +
122 //=========================================================================
124 /*gce_MakePln::gce_MakePln(const gp_Array1OfPnt& Pts ,
125 Standard_Real ErrMax ,
126 Standard_Real ErrMean )
128 TheError = gce_ConfusedPoints;
131 const gp_Pln& gce_MakePln::Value () const
133 StdFail_NotDone_Raise_if (TheError != gce_Done,
134 "gce_MakePln::Value() - no result");
138 const gp_Pln& gce_MakePln::Operator() const
143 gce_MakePln::operator gp_Pln() const