1 // Created on: 1993-03-10
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom_Direction_HeaderFile
18 #define _Geom_Direction_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Geom_Vector.hxx>
24 #include <Standard_Real.hxx>
25 class Standard_ConstructionError;
33 DEFINE_STANDARD_HANDLE(Geom_Direction, Geom_Vector)
36 //! The class Direction specifies a vector that is never null.
37 //! It is a unit vector.
38 class Geom_Direction : public Geom_Vector
44 //! Creates a unit vector with it 3 cartesian coordinates.
46 //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
47 Standard_EXPORT Geom_Direction(const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
49 //! Creates a transient copy of <me>.
50 Standard_EXPORT Geom_Direction(const gp_Dir& V);
52 //! Sets <me> to X,Y,Z coordinates.
54 //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
55 Standard_EXPORT void SetCoord (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
57 //! Converts the gp_Dir unit vector V into this unit vector.
58 Standard_EXPORT void SetDir (const gp_Dir& V);
60 //! Changes the X coordinate of <me>.
62 //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
63 Standard_EXPORT void SetX (const Standard_Real X);
65 //! Changes the Y coordinate of <me>.
67 //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
68 Standard_EXPORT void SetY (const Standard_Real Y);
70 //! Changes the Z coordinate of <me>.
72 //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
73 Standard_EXPORT void SetZ (const Standard_Real Z);
76 //! Returns the non transient direction with the same
77 //! coordinates as <me>.
78 Standard_EXPORT gp_Dir Dir() const;
80 //! returns 1.0 which is the magnitude of any unit vector.
81 Standard_EXPORT Standard_Real Magnitude() const Standard_OVERRIDE;
83 //! returns 1.0 which is the square magnitude of any unit vector.
84 Standard_EXPORT Standard_Real SquareMagnitude() const Standard_OVERRIDE;
87 //! Computes the cross product between <me> and <Other>.
89 //! Raised if the two vectors are parallel because it is
90 //! not possible to have a direction with null length.
91 Standard_EXPORT void Cross (const Handle(Geom_Vector)& Other) Standard_OVERRIDE;
94 //! Computes the triple vector product <me> ^(V1 ^ V2).
96 //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
98 Standard_EXPORT void CrossCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) Standard_OVERRIDE;
101 //! Computes the cross product between <me> and <Other>.
102 //! A new direction is returned.
104 //! Raised if the two vectors are parallel because it is
105 //! not possible to have a direction with null length.
106 Standard_EXPORT Handle(Geom_Vector) Crossed (const Handle(Geom_Vector)& Other) const Standard_OVERRIDE;
109 //! Computes the triple vector product <me> ^(V1 ^ V2).
111 //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
113 Standard_EXPORT Handle(Geom_Vector) CrossCrossed (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const Standard_OVERRIDE;
115 //! Applies the transformation T to this unit vector, then normalizes it.
116 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
118 //! Creates a new object which is a copy of this unit vector.
119 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
124 DEFINE_STANDARD_RTTI(Geom_Direction,Geom_Vector)
144 #endif // _Geom_Direction_HeaderFile