Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-03-10
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 _Geom_Direction_HeaderFile
0018 #define _Geom_Direction_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Geom_Vector.hxx>
0023 #include <Standard_Real.hxx>
0024 class gp_Dir;
0025 class gp_Trsf;
0026 class Geom_Geometry;
0027 
0028 
0029 class Geom_Direction;
0030 DEFINE_STANDARD_HANDLE(Geom_Direction, Geom_Vector)
0031 
0032 
0033 //! The class Direction specifies a vector that is never null.
0034 //! It is a unit vector.
0035 class Geom_Direction : public Geom_Vector
0036 {
0037 
0038 public:
0039 
0040   
0041   //! Creates a unit vector with it 3 cartesian coordinates.
0042   //!
0043   //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0044   Standard_EXPORT Geom_Direction(const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
0045   
0046   //! Creates a transient copy of <me>.
0047   Standard_EXPORT Geom_Direction(const gp_Dir& V);
0048   
0049   //! Sets <me> to X,Y,Z coordinates.
0050   //!
0051   //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0052   Standard_EXPORT void SetCoord (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
0053   
0054   //! Converts the gp_Dir unit vector V into this unit vector.
0055   Standard_EXPORT void SetDir (const gp_Dir& V);
0056   
0057   //! Changes the X coordinate of <me>.
0058   //!
0059   //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0060   Standard_EXPORT void SetX (const Standard_Real X);
0061   
0062   //! Changes the Y coordinate of <me>.
0063   //!
0064   //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0065   Standard_EXPORT void SetY (const Standard_Real Y);
0066   
0067   //! Changes the Z coordinate of <me>.
0068   //!
0069   //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0070   Standard_EXPORT void SetZ (const Standard_Real Z);
0071   
0072 
0073   //! Returns the non transient direction with the same
0074   //! coordinates as <me>.
0075   Standard_EXPORT gp_Dir Dir() const;
0076   
0077   //! returns 1.0 which is the magnitude of any unit vector.
0078   Standard_EXPORT Standard_Real Magnitude() const Standard_OVERRIDE;
0079   
0080   //! returns 1.0 which is the square magnitude of any unit vector.
0081   Standard_EXPORT Standard_Real SquareMagnitude() const Standard_OVERRIDE;
0082   
0083 
0084   //! Computes the cross product between <me> and <Other>.
0085   //!
0086   //! Raised if the two vectors are parallel because it is
0087   //! not possible to have a direction with null length.
0088   Standard_EXPORT void Cross (const Handle(Geom_Vector)& Other) Standard_OVERRIDE;
0089   
0090 
0091   //! Computes the triple vector product  <me> ^(V1 ^ V2).
0092   //!
0093   //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
0094   //! parallel
0095   Standard_EXPORT void CrossCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) Standard_OVERRIDE;
0096   
0097 
0098   //! Computes the cross product between <me> and <Other>.
0099   //! A new direction is returned.
0100   //!
0101   //! Raised if the two vectors are parallel because it is
0102   //! not possible to have a direction with null length.
0103   Standard_EXPORT Handle(Geom_Vector) Crossed (const Handle(Geom_Vector)& Other) const Standard_OVERRIDE;
0104   
0105 
0106   //! Computes the triple vector product <me> ^(V1 ^ V2).
0107   //!
0108   //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
0109   //! parallel
0110   Standard_EXPORT Handle(Geom_Vector) CrossCrossed (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const Standard_OVERRIDE;
0111   
0112   //! Applies the transformation T to this unit vector, then normalizes it.
0113   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
0114   
0115   //! Creates a new object which is a copy of this unit vector.
0116   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0117 
0118 
0119 
0120 
0121   DEFINE_STANDARD_RTTIEXT(Geom_Direction,Geom_Vector)
0122 
0123 protected:
0124 
0125 
0126 
0127 
0128 private:
0129 
0130 
0131 
0132 
0133 };
0134 
0135 
0136 
0137 
0138 
0139 
0140 
0141 #endif // _Geom_Direction_HeaderFile