Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:32

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_MakeDir2d_HeaderFile
0018 #define _gce_MakeDir2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Dir2d.hxx>
0025 #include <gce_Root.hxx>
0026 class gp_Vec2d;
0027 class gp_XY;
0028 class gp_Pnt2d;
0029 
0030 
0031 //! This class implements the following algorithms used
0032 //! to create a Dir2d from gp.
0033 //! * Create a Dir2d with 2 points.
0034 //! * Create a Dir2d with a Vec2d.
0035 //! * Create a Dir2d with a XY from gp.
0036 //! * Create a Dir2d with a 2 Reals (Coordinates).
0037 class gce_MakeDir2d  : public gce_Root
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! Normalizes the vector V and creates a direction.
0045   //! Status is "NullVector" if V.Magnitude() <= Resolution.
0046   Standard_EXPORT gce_MakeDir2d(const gp_Vec2d& V);
0047   
0048   //! Creates a direction from a triplet of coordinates.
0049   //! Status is "NullVector" if Coord.Modulus() <=
0050   //! Resolution from gp.
0051   Standard_EXPORT gce_MakeDir2d(const gp_XY& Coord);
0052   
0053   //! Creates a direction with its 3 cartesian coordinates.
0054   //! Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv )
0055   //! <= Resolution
0056   Standard_EXPORT gce_MakeDir2d(const Standard_Real Xv, const Standard_Real Yv);
0057   
0058   //! Make a Dir2d 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).
0070   Standard_EXPORT gce_MakeDir2d(const gp_Pnt2d& P1, const gp_Pnt2d& P2);
0071   
0072   //! Returns the constructed unit vector.
0073   //! Exceptions StdFail_NotDone if no unit vector is constructed.
0074   Standard_EXPORT const gp_Dir2d& Value() const;
0075   
0076   Standard_EXPORT const gp_Dir2d& Operator() const;
0077 Standard_EXPORT operator gp_Dir2d() const;
0078 
0079 
0080 
0081 
0082 protected:
0083 
0084 
0085 
0086 
0087 
0088 private:
0089 
0090 
0091 
0092   gp_Dir2d TheDir2d;
0093 
0094 
0095 };
0096 
0097 
0098 
0099 
0100 
0101 
0102 
0103 #endif // _gce_MakeDir2d_HeaderFile