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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _gce_MakeDir2d_HeaderFile
18 #define _gce_MakeDir2d_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <gp_Dir2d.hxx>
25 #include <gce_Root.hxx>
26 #include <Standard_Real.hxx>
27 class StdFail_NotDone;
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
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);
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);
56 //! Creates a direction with its 3 cartesian coordinates.
57 //! Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv )
59 Standard_EXPORT gce_MakeDir2d(const Standard_Real Xv, const Standard_Real Yv);
61 //! Make a Dir2d from gp <TheDir> passing through 2
63 //! Status is "ConfusedPoints" if <P1> and <P2> are confused.
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);
75 //! Returns the constructed unit vector.
76 //! Exceptions StdFail_NotDone if no unit vector is constructed.
77 Standard_EXPORT const gp_Dir2d& Value() const;
79 Standard_EXPORT const gp_Dir2d& Operator() const;
80 Standard_EXPORT operator gp_Dir2d() const;
106 #endif // _gce_MakeDir2d_HeaderFile