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_Pln& Pl)
35 ThePlane = new Geom_Plane(Pl);
38 GC_MakePlane::GC_MakePlane(const gp_Pnt& P,
42 ThePlane = new Geom_Plane(P,V);
45 GC_MakePlane::GC_MakePlane(const Standard_Real A,
46 const Standard_Real B,
47 const Standard_Real C,
48 const Standard_Real D)
50 if (Sqrt(A*A + B*B +C*C) <= gp::Resolution()) {
51 TheError = gce_BadEquation;
55 ThePlane = new Geom_Plane(gp_Pln(A,B,C,D));
59 //=========================================================================
60 // Creation d un Geom_Plane passant par trois points. +
61 //=========================================================================
63 GC_MakePlane::GC_MakePlane(const gp_Pnt& P1 ,
66 gce_MakePln Pl(P1,P2,P3);
67 TheError = Pl.Status();
68 if (TheError == gce_Done) {
69 ThePlane = new Geom_Plane(Pl.Value());
73 //=========================================================================
74 // Creation d un Geom_Plane parallele a un pln a une distance donnee. +
75 //=========================================================================
77 GC_MakePlane::GC_MakePlane(const gp_Pln& Pl ,
78 const Standard_Real Dist ) {
79 gp_Pln Pln = gce_MakePln(Pl,Dist);
81 ThePlane = new Geom_Plane(Pln);
84 //=========================================================================
85 // Creation d un Geom_Plane parallele a un pln passant par un point +
87 //=========================================================================
89 GC_MakePlane::GC_MakePlane(const gp_Pln& Pl ,
90 const gp_Pnt& Point ) {
91 gp_Pln Pln= gce_MakePln(Pl,Point);
93 ThePlane = new Geom_Plane(Pln);
96 //=========================================================================
97 // Creation d un Geom_Plane a partir d un Ax1 (Point + Normale). +
98 //=========================================================================
100 GC_MakePlane::GC_MakePlane(const gp_Ax1& Axis ) {
101 gp_Pln Pln = gce_MakePln(Axis);
103 ThePlane = new Geom_Plane(Pln);
106 //=========================================================================
107 // Creation d un Geom_Plane par un tableau de points. +
108 //=========================================================================
110 /*GC_MakePlane::GC_MakePlane(const TColgp_Array1OfPnt& Pts ,
111 Standard_Real ErrMax ,
112 Standard_Real ErrMean ) {
113 GC_MakePln Pln(Pts,ErrMax,ErrMean);
114 TheError = Pln.Status();
115 if (TheError == GC_Done) {
116 ThePlane = new Geom_Plane(Pln.Value());
121 const Handle(Geom_Plane)& GC_MakePlane::Value() const
123 StdFail_NotDone_Raise_if (TheError != gce_Done,
124 "GC_MakePlane::Value() - no result");