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_MakeDir_HeaderFile
18 #define _gce_MakeDir_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.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 Dir from gp.
36 //! * Create a Dir parallel to another and passing
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
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);
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);
57 //! Creates a direction with its 3 cartesian coordinates.
58 //! Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv + Zv*Zv)
60 Standard_EXPORT gce_MakeDir(const Standard_Real Xv, const Standard_Real Yv, const Standard_Real Zv);
62 //! Make a Dir from gp <TheDir> passing through 2
64 //! Status is "ConfusedPoints" if <p1> and <P2> are confused.
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);
76 //! Returns the constructed unit vector.
77 //! Exceptions StdFail_NotDone if no unit vector is constructed.
78 Standard_EXPORT const gp_Dir& Value() const;
80 Standard_EXPORT const gp_Dir& Operator() const;
81 Standard_EXPORT operator gp_Dir() const;
107 #endif // _gce_MakeDir_HeaderFile