Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-03-24
0002 // Created by: JCV
0003 // Copyright (c) 1993-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 _Geom2d_Direction_HeaderFile
0018 #define _Geom2d_Direction_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Geom2d_Vector.hxx>
0023 #include <Standard_Real.hxx>
0024 class gp_Dir2d;
0025 class gp_Trsf2d;
0026 class Geom2d_Geometry;
0027 
0028 
0029 class Geom2d_Direction;
0030 DEFINE_STANDARD_HANDLE(Geom2d_Direction, Geom2d_Vector)
0031 
0032 
0033 //! The class Direction specifies a vector that is never null.
0034 //! It is a unit vector.
0035 class Geom2d_Direction : public Geom2d_Vector
0036 {
0037 
0038 public:
0039 
0040   
0041   //! Creates a unit vector with it 2 cartesian coordinates.
0042   //!
0043   //! Raised if Sqrt( X*X + Y*Y) <= Resolution from gp.
0044   Standard_EXPORT Geom2d_Direction(const Standard_Real X, const Standard_Real Y);
0045   
0046   //! Creates a persistent copy of <me>.
0047   Standard_EXPORT Geom2d_Direction(const gp_Dir2d& V);
0048   
0049   //! Assigns the coordinates X and Y to this unit vector,
0050   //! then normalizes it.
0051   //! Exceptions
0052   //! Standard_ConstructionError if Sqrt(X*X +
0053   //! Y*Y) is less than or equal to gp::Resolution().
0054   Standard_EXPORT void SetCoord (const Standard_Real X, const Standard_Real Y);
0055   
0056   //! Converts the gp_Dir2d unit vector V into this unit vector.
0057   Standard_EXPORT void SetDir2d (const gp_Dir2d& V);
0058   
0059 
0060   //! Assigns a value to the X coordinate of this unit vector, then normalizes it.
0061   //! Exceptions
0062   //! Standard_ConstructionError if the value assigned
0063   //! causes the magnitude of the vector to become less
0064   //! than or equal to gp::Resolution().
0065   Standard_EXPORT void SetX (const Standard_Real X);
0066   
0067   //! Assigns a value to the Y coordinate of this unit vector, then normalizes it.
0068   //! Exceptions
0069   //! Standard_ConstructionError if the value assigned
0070   //! causes the magnitude of the vector to become less
0071   //! than or equal to gp::Resolution().
0072   Standard_EXPORT void SetY (const Standard_Real Y);
0073   
0074   //! Converts this unit vector into a gp_Dir2d unit vector.
0075   Standard_EXPORT gp_Dir2d Dir2d() const;
0076   
0077   //! returns 1.0
0078   Standard_EXPORT Standard_Real Magnitude() const Standard_OVERRIDE;
0079   
0080   //! returns 1.0
0081   Standard_EXPORT Standard_Real SquareMagnitude() const Standard_OVERRIDE;
0082   
0083   //! Computes the cross product between <me> and <Other>.
0084   Standard_EXPORT Standard_Real Crossed (const Handle(Geom2d_Vector)& Other) const Standard_OVERRIDE;
0085 Standard_Real operator ^ (const Handle(Geom2d_Vector)& Other) const
0086 {
0087   return Crossed(Other);
0088 }
0089   
0090   //! Applies the transformation T to this unit vector, then normalizes it.
0091   Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE;
0092   
0093   //! Creates a new object which is a copy of this unit vector.
0094   Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
0095 
0096 
0097 
0098 
0099   DEFINE_STANDARD_RTTIEXT(Geom2d_Direction,Geom2d_Vector)
0100 
0101 protected:
0102 
0103 
0104 
0105 
0106 private:
0107 
0108 
0109 
0110 
0111 };
0112 
0113 
0114 
0115 
0116 
0117 
0118 
0119 #endif // _Geom2d_Direction_HeaderFile