1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 // JCV 30/08/90 Modif passage version C++ 2.0 sur Sun
16 // JCV 1/10/90 Changement de nom du package vgeom -> gp
17 // JCV 12/12/90 Modif suite a la premiere revue de projet
18 // LPA, JCV 07/92 passage sur C1.
19 // JCV 07/92 Introduction de la method Dump
20 // LBO 08/93 Passage aux Ax3
30 #include <gp_Trsf.hxx>
32 #include <Standard_ConstructionError.hxx>
33 #include <Standard_Dump.hxx>
35 gp_Pln::gp_Pln (const gp_Pnt& P,
38 Standard_Real A = V.X();
39 Standard_Real B = V.Y();
40 Standard_Real C = V.Z();
41 Standard_Real Aabs = A;
42 if (Aabs < 0) Aabs = - Aabs;
43 Standard_Real Babs = B;
44 if (Babs < 0) Babs = - Babs;
45 Standard_Real Cabs = C;
46 if (Cabs < 0) Cabs = - Cabs;
48 // pour determiner l'axe X :
49 // on dit que le produit scalaire Vx.V = 0.
50 // et on recherche le max(A,B,C) pour faire la division.
51 // l'une des coordonnees du vecteur est nulle.
53 if( Babs <= Aabs && Babs <= Cabs) {
54 if (Aabs > Cabs) pos = gp_Ax3 (P, V, gp_Dir (-C,0., A));
55 else pos = gp_Ax3 (P, V, gp_Dir ( C,0.,-A));
57 else if( Aabs <= Babs && Aabs <= Cabs) {
58 if (Babs > Cabs) pos = gp_Ax3 (P, V, gp_Dir (0.,-C, B));
59 else pos = gp_Ax3 (P, V, gp_Dir (0., C,-B));
62 if (Aabs > Babs) pos = gp_Ax3 (P, V, gp_Dir (-B, A,0.));
63 else pos = gp_Ax3 (P, V, gp_Dir ( B,-A,0.));
67 gp_Pln::gp_Pln (const Standard_Real A,
68 const Standard_Real B,
69 const Standard_Real C,
70 const Standard_Real D)
72 Standard_Real Aabs = A;
73 if (Aabs < 0) Aabs = - Aabs;
74 Standard_Real Babs = B;
75 if (Babs < 0) Babs = - Babs;
76 Standard_Real Cabs = C;
77 if (Cabs < 0) Cabs = - Cabs;
78 if (Babs <= Aabs && Babs <= Cabs) {
79 if (Aabs > Cabs) pos = gp_Ax3(gp_Pnt(-D/A, 0., 0.),
82 else pos = gp_Ax3(gp_Pnt( 0., 0.,-D/C),
86 else if (Aabs <= Babs && Aabs <= Cabs) {
87 if (Babs > Cabs) pos = gp_Ax3(gp_Pnt( 0.,-D/B, 0.),
90 else pos = gp_Ax3(gp_Pnt( 0., 0.,-D/C),
95 if (Aabs > Babs) pos = gp_Ax3(gp_Pnt(-D/A, 0., 0.),
98 else pos = gp_Ax3(gp_Pnt( 0.,-D/B, 0.),
104 void gp_Pln::Mirror (const gp_Pnt& P)
107 gp_Pln gp_Pln::Mirrored (const gp_Pnt& P) const
114 void gp_Pln::Mirror (const gp_Ax1& A1)
117 gp_Pln gp_Pln::Mirrored (const gp_Ax1& A1) const
124 void gp_Pln::Mirror (const gp_Ax2& A2)
127 gp_Pln gp_Pln::Mirrored (const gp_Ax2& A2) const
134 void gp_Pln::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
136 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &pos)