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