1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
19 // JCV 30/08/90 Modif passage version C++ 2.0 sur Sun
20 // JCV 1/10/90 Changement de nom du package vgeom -> gp
21 // JCV 12/12/90 Modif suite a la premiere revue de projet
22 // LPA, JCV 07/92 passage sur C1.
23 // JCV 07/92 Introduction de la method Dump
24 // LBO 08/93 Passage aux Ax3
29 gp_Pln::gp_Pln (const gp_Pnt& P,
32 Standard_Real A = V.X();
33 Standard_Real B = V.Y();
34 Standard_Real C = V.Z();
35 Standard_Real Aabs = A;
36 if (Aabs < 0) Aabs = - Aabs;
37 Standard_Real Babs = B;
38 if (Babs < 0) Babs = - Babs;
39 Standard_Real Cabs = C;
40 if (Cabs < 0) Cabs = - Cabs;
42 // pour determiner l'axe X :
43 // on dit que le produit scalaire Vx.V = 0.
44 // et on recherche le max(A,B,C) pour faire la division.
45 // l'une des coordonnees du vecteur est nulle.
47 if( Babs <= Aabs && Babs <= Cabs) {
48 if (Aabs > Cabs) pos = gp_Ax3 (P, V, gp_Dir (-C,0., A));
49 else pos = gp_Ax3 (P, V, gp_Dir ( C,0.,-A));
51 else if( Aabs <= Babs && Aabs <= Cabs) {
52 if (Babs > Cabs) pos = gp_Ax3 (P, V, gp_Dir (0.,-C, B));
53 else pos = gp_Ax3 (P, V, gp_Dir (0., C,-B));
56 if (Aabs > Babs) pos = gp_Ax3 (P, V, gp_Dir (-B, A,0.));
57 else pos = gp_Ax3 (P, V, gp_Dir ( B,-A,0.));
61 gp_Pln::gp_Pln (const Standard_Real A,
62 const Standard_Real B,
63 const Standard_Real C,
64 const Standard_Real D)
66 Standard_Real Aabs = A;
67 if (Aabs < 0) Aabs = - Aabs;
68 Standard_Real Babs = B;
69 if (Babs < 0) Babs = - Babs;
70 Standard_Real Cabs = C;
71 if (Cabs < 0) Cabs = - Cabs;
72 if (Babs <= Aabs && Babs <= Cabs) {
73 if (Aabs > Cabs) pos = gp_Ax3(gp_Pnt(-D/A, 0., 0.),
76 else pos = gp_Ax3(gp_Pnt( 0., 0.,-D/C),
80 else if (Aabs <= Babs && Aabs <= Cabs) {
81 if (Babs > Cabs) pos = gp_Ax3(gp_Pnt( 0.,-D/B, 0.),
84 else pos = gp_Ax3(gp_Pnt( 0., 0.,-D/C),
89 if (Aabs > Babs) pos = gp_Ax3(gp_Pnt(-D/A, 0., 0.),
92 else pos = gp_Ax3(gp_Pnt( 0.,-D/B, 0.),
98 void gp_Pln::Mirror (const gp_Pnt& P)
101 gp_Pln gp_Pln::Mirrored (const gp_Pnt& P) const
108 void gp_Pln::Mirror (const gp_Ax1& A1)
111 gp_Pln gp_Pln::Mirrored (const gp_Ax1& A1) const
118 void gp_Pln::Mirror (const gp_Ax2& A2)
121 gp_Pln gp_Pln::Mirrored (const gp_Ax2& A2) const