42cf5bc1 |
1 | // Created on: 1993-03-10 |
2 | // Created by: JCV |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Geom_Direction_HeaderFile |
18 | #define _Geom_Direction_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Geom_Vector.hxx> |
24 | #include <Standard_Real.hxx> |
25 | class Standard_ConstructionError; |
26 | class gp_Dir; |
27 | class Geom_Vector; |
28 | class gp_Trsf; |
29 | class Geom_Geometry; |
30 | |
31 | |
32 | class Geom_Direction; |
33 | DEFINE_STANDARD_HANDLE(Geom_Direction, Geom_Vector) |
34 | |
35 | |
36 | //! The class Direction specifies a vector that is never null. |
37 | //! It is a unit vector. |
38 | class Geom_Direction : public Geom_Vector |
39 | { |
40 | |
41 | public: |
42 | |
43 | |
44 | //! Creates a unit vector with it 3 cartesian coordinates. |
45 | //! |
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); |
48 | |
49 | //! Creates a transient copy of <me>. |
50 | Standard_EXPORT Geom_Direction(const gp_Dir& V); |
51 | |
52 | //! Sets <me> to X,Y,Z coordinates. |
53 | //! |
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); |
56 | |
57 | //! Converts the gp_Dir unit vector V into this unit vector. |
58 | Standard_EXPORT void SetDir (const gp_Dir& V); |
59 | |
60 | //! Changes the X coordinate of <me>. |
61 | //! |
62 | //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
63 | Standard_EXPORT void SetX (const Standard_Real X); |
64 | |
65 | //! Changes the Y coordinate of <me>. |
66 | //! |
67 | //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
68 | Standard_EXPORT void SetY (const Standard_Real Y); |
69 | |
70 | //! Changes the Z coordinate of <me>. |
71 | //! |
72 | //! Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
73 | Standard_EXPORT void SetZ (const Standard_Real Z); |
74 | |
75 | |
76 | //! Returns the non transient direction with the same |
77 | //! coordinates as <me>. |
78 | Standard_EXPORT gp_Dir Dir() const; |
79 | |
80 | //! returns 1.0 which is the magnitude of any unit vector. |
79104795 |
81 | Standard_EXPORT Standard_Real Magnitude() const Standard_OVERRIDE; |
42cf5bc1 |
82 | |
83 | //! returns 1.0 which is the square magnitude of any unit vector. |
79104795 |
84 | Standard_EXPORT Standard_Real SquareMagnitude() const Standard_OVERRIDE; |
42cf5bc1 |
85 | |
86 | |
87 | //! Computes the cross product between <me> and <Other>. |
88 | //! |
89 | //! Raised if the two vectors are parallel because it is |
90 | //! not possible to have a direction with null length. |
79104795 |
91 | Standard_EXPORT void Cross (const Handle(Geom_Vector)& Other) Standard_OVERRIDE; |
42cf5bc1 |
92 | |
93 | |
94 | //! Computes the triple vector product <me> ^(V1 ^ V2). |
95 | //! |
96 | //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are |
97 | //! parallel |
79104795 |
98 | Standard_EXPORT void CrossCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) Standard_OVERRIDE; |
42cf5bc1 |
99 | |
100 | |
101 | //! Computes the cross product between <me> and <Other>. |
102 | //! A new direction is returned. |
103 | //! |
104 | //! Raised if the two vectors are parallel because it is |
105 | //! not possible to have a direction with null length. |
79104795 |
106 | Standard_EXPORT Handle(Geom_Vector) Crossed (const Handle(Geom_Vector)& Other) const Standard_OVERRIDE; |
42cf5bc1 |
107 | |
108 | |
109 | //! Computes the triple vector product <me> ^(V1 ^ V2). |
110 | //! |
111 | //! Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are |
112 | //! parallel |
79104795 |
113 | Standard_EXPORT Handle(Geom_Vector) CrossCrossed (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const Standard_OVERRIDE; |
42cf5bc1 |
114 | |
115 | //! Applies the transformation T to this unit vector, then normalizes it. |
79104795 |
116 | Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; |
42cf5bc1 |
117 | |
118 | //! Creates a new object which is a copy of this unit vector. |
79104795 |
119 | Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
120 | |
121 | |
122 | |
123 | |
124 | DEFINE_STANDARD_RTTI(Geom_Direction,Geom_Vector) |
125 | |
126 | protected: |
127 | |
128 | |
129 | |
130 | |
131 | private: |
132 | |
133 | |
134 | |
135 | |
136 | }; |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | #endif // _Geom_Direction_HeaderFile |