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 <GC_MakePlane.hxx>
19 #include <gce_MakePln.hxx>
20 #include <Geom_Plane.hxx>
28 #include <Standard_NotImplemented.hxx>
29 #include <StdFail_NotDone.hxx>
30 #include <TColgp_Array1OfPnt.hxx>
32 GC_MakePlane::GC_MakePlane(const gp_Ax2& ) //A2)
34 Standard_NotImplemented::Raise("GC_MakePlane");
37 GC_MakePlane::GC_MakePlane(const gp_Pln& Pl)
40 ThePlane = new Geom_Plane(Pl);
43 GC_MakePlane::GC_MakePlane(const gp_Pnt& P,
47 ThePlane = new Geom_Plane(P,V);
50 GC_MakePlane::GC_MakePlane(const Standard_Real A,
51 const Standard_Real B,
52 const Standard_Real C,
53 const Standard_Real D)
55 if (Sqrt(A*A + B*B +C*C) <= gp::Resolution()) {
56 TheError = gce_BadEquation;
60 ThePlane = new Geom_Plane(gp_Pln(A,B,C,D));
64 //=========================================================================
65 // Creation d un Geom_Plane passant par trois points. +
66 //=========================================================================
68 GC_MakePlane::GC_MakePlane(const gp_Pnt& P1 ,
71 gce_MakePln Pl(P1,P2,P3);
72 TheError = Pl.Status();
73 if (TheError == gce_Done) {
74 ThePlane = new Geom_Plane(Pl.Value());
78 //=========================================================================
79 // Creation d un Geom_Plane parallele a un pln a une distance donnee. +
80 //=========================================================================
82 GC_MakePlane::GC_MakePlane(const gp_Pln& Pl ,
83 const Standard_Real Dist ) {
84 gp_Pln Pln = gce_MakePln(Pl,Dist);
86 ThePlane = new Geom_Plane(Pln);
89 //=========================================================================
90 // Creation d un Geom_Plane parallele a un pln passant par un point +
92 //=========================================================================
94 GC_MakePlane::GC_MakePlane(const gp_Pln& Pl ,
95 const gp_Pnt& Point ) {
96 gp_Pln Pln= gce_MakePln(Pl,Point);
98 ThePlane = new Geom_Plane(Pln);
101 //=========================================================================
102 // Creation d un Geom_Plane a partir d un Ax1 (Point + Normale). +
103 //=========================================================================
105 GC_MakePlane::GC_MakePlane(const gp_Ax1& Axis ) {
106 gp_Pln Pln = gce_MakePln(Axis);
108 ThePlane = new Geom_Plane(Pln);
111 //=========================================================================
112 // Creation d un Geom_Plane par un tableau de points. +
113 //=========================================================================
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());
126 const Handle(Geom_Plane)& GC_MakePlane::Value() const
128 StdFail_NotDone_Raise_if(TheError != gce_Done,"");