0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / gce / gce_MakeDir2d.hxx
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_MakeDir2d_HeaderFile
18 #define _gce_MakeDir2d_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <gp_Dir2d.hxx>
25 #include <gce_Root.hxx>
26 #include <Standard_Real.hxx>
27 class StdFail_NotDone;
28 class gp_Vec2d;
29 class gp_XY;
30 class gp_Pnt2d;
31 class gp_Dir2d;
32
33
34 //! This class implements the following algorithms used
35 //! to create a Dir2d from gp.
36 //! * Create a Dir2d with 2 points.
37 //! * Create a Dir2d with a Vec2d.
38 //! * Create a Dir2d with a XY from gp.
39 //! * Create a Dir2d with a 2 Reals (Coordinates).
40 class gce_MakeDir2d  : public gce_Root
41 {
42 public:
43
44   DEFINE_STANDARD_ALLOC
45
46   
47   //! Normalizes the vector V and creates a direction.
48   //! Status is "NullVector" if V.Magnitude() <= Resolution.
49   Standard_EXPORT gce_MakeDir2d(const gp_Vec2d& V);
50   
51   //! Creates a direction from a triplet of coordinates.
52   //! Status is "NullVector" if Coord.Modulus() <=
53   //! Resolution from gp.
54   Standard_EXPORT gce_MakeDir2d(const gp_XY& Coord);
55   
56   //! Creates a direction with its 3 cartesian coordinates.
57   //! Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv )
58   //! <= Resolution
59   Standard_EXPORT gce_MakeDir2d(const Standard_Real Xv, const Standard_Real Yv);
60   
61   //! Make a Dir2d from gp <TheDir> passing through 2
62   //! Pnt <P1>,<P2>.
63   //! Status is "ConfusedPoints" if <P1> and <P2> are confused.
64   //! Warning
65   //! If an error occurs (that is, when IsDone returns
66   //! false), the Status function returns:
67   //! -   gce_ConfusedPoints if points P1 and P2 are coincident, or
68   //! -   gce_NullVector if one of the following is less
69   //! than or equal to gp::Resolution():
70   //! -   the magnitude of vector V,
71   //! -   the modulus of Coord,
72   //! -   Sqrt(Xv*Xv + Yv*Yv).
73   Standard_EXPORT gce_MakeDir2d(const gp_Pnt2d& P1, const gp_Pnt2d& P2);
74   
75   //! Returns the constructed unit vector.
76   //! Exceptions StdFail_NotDone if no unit vector is constructed.
77   Standard_EXPORT const gp_Dir2d& Value() const;
78   
79   Standard_EXPORT const gp_Dir2d& Operator() const;
80 Standard_EXPORT operator gp_Dir2d() const;
81
82
83
84
85 protected:
86
87
88
89
90
91 private:
92
93
94
95   gp_Dir2d TheDir2d;
96
97
98 };
99
100
101
102
103
104
105
106 #endif // _gce_MakeDir2d_HeaderFile