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.
17 #include <gce_MakePln.ixx>
18 #include <StdFail_NotDone.hxx>
22 gce_MakePln::gce_MakePln(const gp_Ax2& A2)
24 ThePln = gp_Pln(gp_Ax3(A2));
28 gce_MakePln::gce_MakePln(const gp_Pnt& P,
35 gce_MakePln::gce_MakePln(const gp_Pnt& P1,
38 if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
40 gp_Dir dir(P2.XYZ()-P1.XYZ());
41 ThePln = gp_Pln(P1,dir);
46 gce_MakePln::gce_MakePln(const Standard_Real A,
47 const Standard_Real B,
48 const Standard_Real C,
49 const Standard_Real D)
51 if (A*A + B*B + C*C <= gp::Resolution()) {
52 TheError = gce_BadEquation;
55 ThePln = gp_Pln(A,B,C,D);
60 //=========================================================================
61 // Creation d un gp_pln passant par trois points. +
62 //=========================================================================
64 gce_MakePln::gce_MakePln(const gp_Pnt& P1 ,
68 gp_XYZ V1(P2.XYZ()-P1.XYZ());
69 gp_XYZ V2(P3.XYZ()-P1.XYZ());
70 gp_XYZ Norm(V1.Crossed(V2));
71 if (Norm.Modulus() < gp::Resolution()) { TheError = gce_ColinearPoints; }
75 ThePln = gp_Pln(gp_Ax3(P1,DNorm,Dx));
80 //=========================================================================
81 // Creation d un gp_pln parallele a un autre pln a une distance donnee. +
82 //=========================================================================
84 gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
85 const Standard_Real Dist )
87 gp_Pnt Center(Pl.Location().XYZ()+Dist*gp_XYZ(Pl.Axis().Direction().XYZ()));
88 ThePln=gp_Pln(gp_Ax3(Center,Pl.Axis().Direction(),Pl.XAxis().Direction()));
92 //=========================================================================
93 // Creation d un gp_pln parallele a un autre pln passant par un point +
95 //=========================================================================
97 gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
100 ThePln = gp_Pln(gp_Ax3(Point,Pl.Axis().Direction(),Pl.XAxis().Direction()));
104 //=========================================================================
105 // Creation d un gp_pln a partir d un Ax1 (Point + Normale). +
106 //=========================================================================
108 gce_MakePln::gce_MakePln(const gp_Ax1& Axis )
110 ThePln = gp_Pln(Axis.Location(),Axis.Direction());
114 //=========================================================================
115 // Creation d un gp_pln par un tableau de points. +
116 //=========================================================================
118 /*gce_MakePln::gce_MakePln(const gp_Array1OfPnt& Pts ,
119 Standard_Real ErrMax ,
120 Standard_Real ErrMean )
122 TheError = gce_ConfusedPoints;
125 const gp_Pln& gce_MakePln::Value () const
127 StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
131 const gp_Pln& gce_MakePln::Operator() const
136 gce_MakePln::operator gp_Pln() const