Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:15:58

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 //! The class Direction specifies a vector that is never null.
0029 //! It is a unit vector.
0030 class Geom_Direction : public Geom_Vector
0031 {
0032 
0033 public:
0034   //! Creates a unit vector with it 3 cartesian coordinates.
0035   //!
0036   //! Raised if std::sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0037   Standard_EXPORT Geom_Direction(const double X, const double Y, const double Z);
0038 
0039   //! Creates a transient copy of <me>.
0040   Standard_EXPORT Geom_Direction(const gp_Dir& V);
0041 
0042   //! Sets <me> to X,Y,Z coordinates.
0043   //!
0044   //! Raised if std::sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0045   Standard_EXPORT void SetCoord(const double X, const double Y, const double Z);
0046 
0047   //! Converts the gp_Dir unit vector V into this unit vector.
0048   Standard_EXPORT void SetDir(const gp_Dir& V);
0049 
0050   //! Changes the X coordinate of <me>.
0051   //!
0052   //! Raised if std::sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0053   Standard_EXPORT void SetX(const double X);
0054 
0055   //! Changes the Y coordinate of <me>.
0056   //!
0057   //! Raised if std::sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0058   Standard_EXPORT void SetY(const double Y);
0059 
0060   //! Changes the Z coordinate of <me>.
0061   //!
0062   //! Raised if std::sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
0063   Standard_EXPORT void SetZ(const double Z);
0064 
0065   //! Returns the non transient direction with the same
0066   //! coordinates as <me>.
0067   Standard_EXPORT gp_Dir Dir() const;
0068 
0069   //! returns 1.0 which is the magnitude of any unit vector.
0070   Standard_EXPORT double Magnitude() const override;
0071 
0072   //! returns 1.0 which is the square magnitude of any unit vector.
0073   Standard_EXPORT double SquareMagnitude() const override;
0074 
0075   //! Computes the cross product between <me> and <Other>.
0076   //!
0077   //! Raised if the two vectors are parallel because it is
0078   //! not possible to have a direction with null length.
0079   Standard_EXPORT void Cross(const occ::handle<Geom_Vector>& Other) override;
0080 
0081   //! Computes the triple vector product <me> ^(V1 ^ V2).
0082   //!
0083   //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
0084   //! parallel
0085   Standard_EXPORT void CrossCross(const occ::handle<Geom_Vector>& V1,
0086                                   const occ::handle<Geom_Vector>& V2) override;
0087 
0088   //! Computes the cross product between <me> and <Other>.
0089   //! A new direction is returned.
0090   //!
0091   //! Raised if the two vectors are parallel because it is
0092   //! not possible to have a direction with null length.
0093   Standard_EXPORT occ::handle<Geom_Vector> Crossed(
0094     const occ::handle<Geom_Vector>& Other) const override;
0095 
0096   //! Computes the triple vector product <me> ^(V1 ^ V2).
0097   //!
0098   //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
0099   //! parallel
0100   Standard_EXPORT occ::handle<Geom_Vector> CrossCrossed(
0101     const occ::handle<Geom_Vector>& V1,
0102     const occ::handle<Geom_Vector>& V2) const override;
0103 
0104   //! Applies the transformation T to this unit vector, then normalizes it.
0105   Standard_EXPORT void Transform(const gp_Trsf& T) override;
0106 
0107   //! Creates a new object which is a copy of this unit vector.
0108   Standard_EXPORT occ::handle<Geom_Geometry> Copy() const override;
0109 
0110   DEFINE_STANDARD_RTTIEXT(Geom_Direction, Geom_Vector)
0111 };
0112 
0113 #endif // _Geom_Direction_HeaderFile