42cf5bc1 |
1 | // Created on: 1992-08-26 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1992-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _gce_MakeDir_HeaderFile |
18 | #define _gce_MakeDir_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <gp_Dir.hxx> |
25 | #include <gce_Root.hxx> |
26 | #include <Standard_Real.hxx> |
27 | class StdFail_NotDone; |
28 | class gp_Vec; |
29 | class gp_XYZ; |
30 | class gp_Pnt; |
31 | class gp_Dir; |
32 | |
33 | |
34 | //! This class implements the following algorithms used |
35 | //! to create a Dir from gp. |
36 | //! * Create a Dir parallel to another and passing |
37 | //! through a point. |
38 | //! * Create a Dir passing through 2 points. |
39 | //! * Create a Dir from its axis (Ax1 from gp). |
40 | //! * Create a Dir from a point and a direction. |
41 | class gce_MakeDir : public gce_Root |
42 | { |
43 | public: |
44 | |
45 | DEFINE_STANDARD_ALLOC |
46 | |
47 | |
48 | //! Normalizes the vector V and creates a direction. |
49 | //! Status is "NullVector" if V.Magnitude() <= Resolution. |
50 | Standard_EXPORT gce_MakeDir(const gp_Vec& V); |
51 | |
52 | //! Creates a direction from a triplet of coordinates. |
53 | //! Status is "NullVector" if Coord.Modulus() <= |
54 | //! Resolution from gp. |
55 | Standard_EXPORT gce_MakeDir(const gp_XYZ& Coord); |
56 | |
57 | //! Creates a direction with its 3 cartesian coordinates. |
58 | //! Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv + Zv*Zv) |
59 | //! <= Resolution |
60 | Standard_EXPORT gce_MakeDir(const Standard_Real Xv, const Standard_Real Yv, const Standard_Real Zv); |
61 | |
62 | //! Make a Dir from gp <TheDir> passing through 2 |
63 | //! Pnt <P1>,<P2>. |
64 | //! Status is "ConfusedPoints" if <p1> and <P2> are confused. |
65 | //! Warning |
66 | //! If an error occurs (that is, when IsDone returns |
67 | //! false), the Status function returns: |
68 | //! - gce_ConfusedPoints if points P1 and P2 are coincident, or |
69 | //! - gce_NullVector if one of the following is less |
70 | //! than or equal to gp::Resolution(): |
71 | //! - the magnitude of vector V, |
72 | //! - the modulus of Coord, |
73 | //! - Sqrt(Xv*Xv + Yv*Yv + Zv*Zv). |
74 | Standard_EXPORT gce_MakeDir(const gp_Pnt& P1, const gp_Pnt& P2); |
75 | |
76 | //! Returns the constructed unit vector. |
77 | //! Exceptions StdFail_NotDone if no unit vector is constructed. |
78 | Standard_EXPORT const gp_Dir& Value() const; |
79 | |
80 | Standard_EXPORT const gp_Dir& Operator() const; |
81 | Standard_EXPORT operator gp_Dir() const; |
82 | |
83 | |
84 | |
85 | |
86 | protected: |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | private: |
93 | |
94 | |
95 | |
96 | gp_Dir TheDir; |
97 | |
98 | |
99 | }; |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | #endif // _gce_MakeDir_HeaderFile |