Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-30 09:13:30

0001 // Created on: 1992-08-26
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _gce_MakeDir_HeaderFile
0018 #define _gce_MakeDir_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Dir.hxx>
0025 #include <gce_Root.hxx>
0026 class gp_Vec;
0027 class gp_XYZ;
0028 class gp_Pnt;
0029 
0030 //! This class implements the following algorithms used
0031 //! to create a Dir from gp.
0032 //! * Create a Dir parallel to another and passing
0033 //! through a point.
0034 //! * Create a Dir passing through 2 points.
0035 //! * Create a Dir from its axis (Ax1 from gp).
0036 //! * Create a Dir from a point and a direction.
0037 class gce_MakeDir : public gce_Root
0038 {
0039 public:
0040   DEFINE_STANDARD_ALLOC
0041 
0042   //! Normalizes the vector V and creates a direction.
0043   //! Status is "NullVector" if V.Magnitude() <= Resolution.
0044   Standard_EXPORT gce_MakeDir(const gp_Vec& V);
0045 
0046   //! Creates a direction from a triplet of coordinates.
0047   //! Status is "NullVector" if Coord.Modulus() <=
0048   //! Resolution from gp.
0049   Standard_EXPORT gce_MakeDir(const gp_XYZ& Coord);
0050 
0051   //! Creates a direction with its 3 cartesian coordinates.
0052   //! Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv + Zv*Zv)
0053   //! <= Resolution
0054   Standard_EXPORT gce_MakeDir(const Standard_Real Xv,
0055                               const Standard_Real Yv,
0056                               const Standard_Real Zv);
0057 
0058   //! Make a Dir from gp <TheDir> passing through 2
0059   //! Pnt <P1>,<P2>.
0060   //! Status is "ConfusedPoints" if <p1> and <P2> are confused.
0061   //! Warning
0062   //! If an error occurs (that is, when IsDone returns
0063   //! false), the Status function returns:
0064   //! -   gce_ConfusedPoints if points P1 and P2 are coincident, or
0065   //! -   gce_NullVector if one of the following is less
0066   //! than or equal to gp::Resolution():
0067   //! -   the magnitude of vector V,
0068   //! -   the modulus of Coord,
0069   //! -   Sqrt(Xv*Xv + Yv*Yv + Zv*Zv).
0070   Standard_EXPORT gce_MakeDir(const gp_Pnt& P1, const gp_Pnt& P2);
0071 
0072   //! Returns the constructed unit vector.
0073   //! Exceptions StdFail_NotDone if no unit vector is constructed.
0074   Standard_EXPORT const gp_Dir& Value() const;
0075 
0076   Standard_EXPORT const gp_Dir& Operator() const;
0077   Standard_EXPORT               operator gp_Dir() const;
0078 
0079 protected:
0080 private:
0081   gp_Dir TheDir;
0082 };
0083 
0084 #endif // _gce_MakeDir_HeaderFile