0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / gce / gce_MakePln.cxx
CommitLineData
b311480e 1// Created on: 1992-09-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 <gce_MakePln.hxx>
7fd59977 19#include <gp.hxx>
42cf5bc1 20#include <gp_Ax1.hxx>
21#include <gp_Ax2.hxx>
7fd59977 22#include <gp_Ax3.hxx>
42cf5bc1 23#include <gp_Dir.hxx>
24#include <gp_Pln.hxx>
25#include <gp_Pnt.hxx>
26#include <StdFail_NotDone.hxx>
7fd59977 27
28gce_MakePln::gce_MakePln(const gp_Ax2& A2)
29{
30 ThePln = gp_Pln(gp_Ax3(A2));
31 TheError = gce_Done;
32}
33
34gce_MakePln::gce_MakePln(const gp_Pnt& P,
35 const gp_Dir& V)
36{
37 ThePln = gp_Pln(P,V);
38 TheError = gce_Done;
39}
40
41gce_MakePln::gce_MakePln(const gp_Pnt& P1,
42 const gp_Pnt& P2)
43{
44 if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
45 else {
46 gp_Dir dir(P2.XYZ()-P1.XYZ());
47 ThePln = gp_Pln(P1,dir);
48 TheError = gce_Done;
49 }
50}
51
52gce_MakePln::gce_MakePln(const Standard_Real A,
53 const Standard_Real B,
54 const Standard_Real C,
55 const Standard_Real D)
56{
57 if (A*A + B*B + C*C <= gp::Resolution()) {
58 TheError = gce_BadEquation;
59 }
60 else {
61 ThePln = gp_Pln(A,B,C,D);
62 TheError = gce_Done;
63 }
64}
65
66//=========================================================================
67// Creation d un gp_pln passant par trois points. +
68//=========================================================================
69
70gce_MakePln::gce_MakePln(const gp_Pnt& P1 ,
71 const gp_Pnt& P2 ,
72 const gp_Pnt& P3 )
73{
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; }
78 else {
79 gp_Dir DNorm(Norm);
80 gp_Dir Dx(V1);
81 ThePln = gp_Pln(gp_Ax3(P1,DNorm,Dx));
82 TheError = gce_Done;
83 }
84}
85
86//=========================================================================
87// Creation d un gp_pln parallele a un autre pln a une distance donnee. +
88//=========================================================================
89
90gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
91 const Standard_Real Dist )
92{
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()));
95 TheError = gce_Done;
96}
97
98//=========================================================================
99// Creation d un gp_pln parallele a un autre pln passant par un point +
100// <Point1>. +
101//=========================================================================
102
103gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
104 const gp_Pnt& Point )
105{
106 ThePln = gp_Pln(gp_Ax3(Point,Pl.Axis().Direction(),Pl.XAxis().Direction()));
107 TheError = gce_Done;
108}
109
110//=========================================================================
111// Creation d un gp_pln a partir d un Ax1 (Point + Normale). +
112//=========================================================================
113
114gce_MakePln::gce_MakePln(const gp_Ax1& Axis )
115{
116 ThePln = gp_Pln(Axis.Location(),Axis.Direction());
117 TheError = gce_Done;
118}
119
120//=========================================================================
121// Creation d un gp_pln par un tableau de points. +
122//=========================================================================
123
124/*gce_MakePln::gce_MakePln(const gp_Array1OfPnt& Pts ,
125 Standard_Real ErrMax ,
126 Standard_Real ErrMean )
127{
128 TheError = gce_ConfusedPoints;
129}
130*/
131const gp_Pln& gce_MakePln::Value () const
132{
82fc327c 133 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
7fd59977 134 return ThePln;
135}
136
137const gp_Pln& gce_MakePln::Operator() const
138{
139 return Value();
140}
141
142gce_MakePln::operator gp_Pln() const
143{
144 return Value();
145}
146
147
148
149
150