Commit | Line | Data |
---|---|---|
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_VectorWithMagnitude_HeaderFile | |
18 | #define _Geom_VectorWithMagnitude_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_Vec; | |
27 | class gp_Pnt; | |
28 | class Geom_Vector; | |
29 | class gp_Trsf; | |
30 | class Geom_Geometry; | |
31 | ||
32 | ||
33 | class Geom_VectorWithMagnitude; | |
34 | DEFINE_STANDARD_HANDLE(Geom_VectorWithMagnitude, Geom_Vector) | |
35 | ||
36 | ||
37 | //! Defines a vector with magnitude. | |
38 | //! A vector with magnitude can have a zero length. | |
39 | class Geom_VectorWithMagnitude : public Geom_Vector | |
40 | { | |
41 | ||
42 | public: | |
43 | ||
44 | ||
45 | //! Creates a transient copy of V. | |
46 | Standard_EXPORT Geom_VectorWithMagnitude(const gp_Vec& V); | |
47 | ||
48 | //! Creates a vector with three cartesian coordinates. | |
49 | Standard_EXPORT Geom_VectorWithMagnitude(const Standard_Real X, const Standard_Real Y, const Standard_Real Z); | |
50 | ||
51 | ||
52 | //! Creates a vector from the point P1 to the point P2. | |
53 | //! The magnitude of the vector is the distance between P1 and P2 | |
54 | Standard_EXPORT Geom_VectorWithMagnitude(const gp_Pnt& P1, const gp_Pnt& P2); | |
55 | ||
56 | //! Assigns the values X, Y and Z to the coordinates of this vector. | |
57 | Standard_EXPORT void SetCoord (const Standard_Real X, const Standard_Real Y, const Standard_Real Z); | |
58 | ||
59 | //! Converts the gp_Vec vector V into this vector. | |
60 | Standard_EXPORT void SetVec (const gp_Vec& V); | |
61 | ||
62 | //! Changes the X coordinate of <me>. | |
63 | Standard_EXPORT void SetX (const Standard_Real X); | |
64 | ||
65 | //! Changes the Y coordinate of <me> | |
66 | Standard_EXPORT void SetY (const Standard_Real Y); | |
67 | ||
68 | //! Changes the Z coordinate of <me>. | |
69 | Standard_EXPORT void SetZ (const Standard_Real Z); | |
70 | ||
71 | //! Returns the magnitude of <me>. | |
79104795 | 72 | Standard_EXPORT Standard_Real Magnitude() const Standard_OVERRIDE; |
42cf5bc1 | 73 | |
74 | //! Returns the square magnitude of <me>. | |
79104795 | 75 | Standard_EXPORT Standard_Real SquareMagnitude() const Standard_OVERRIDE; |
42cf5bc1 | 76 | |
77 | ||
78 | //! Adds the Vector Other to <me>. | |
79 | Standard_EXPORT void Add (const Handle(Geom_Vector)& Other); | |
80 | ||
81 | ||
82 | //! Adds the vector Other to <me>. | |
0be7dbe1 | 83 | Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Added (const Handle(Geom_Vector)& Other) const; |
42cf5bc1 | 84 | |
85 | ||
86 | //! Computes the cross product between <me> and Other | |
87 | //! <me> ^ Other. | |
79104795 | 88 | Standard_EXPORT void Cross (const Handle(Geom_Vector)& Other) Standard_OVERRIDE; |
42cf5bc1 | 89 | |
90 | ||
91 | //! Computes the cross product between <me> and Other | |
92 | //! <me> ^ Other. A new vector is returned. | |
79104795 | 93 | Standard_EXPORT Handle(Geom_Vector) Crossed (const Handle(Geom_Vector)& Other) const Standard_OVERRIDE; |
42cf5bc1 | 94 | |
95 | ||
96 | //! Computes the triple vector product <me> ^ (V1 ^ V2). | |
79104795 | 97 | Standard_EXPORT void CrossCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) Standard_OVERRIDE; |
42cf5bc1 | 98 | |
99 | ||
100 | //! Computes the triple vector product <me> ^ (V1 ^ V2). | |
101 | //! A new vector is returned. | |
79104795 | 102 | Standard_EXPORT Handle(Geom_Vector) CrossCrossed (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const Standard_OVERRIDE; |
42cf5bc1 | 103 | |
104 | //! Divides <me> by a scalar. | |
105 | Standard_EXPORT void Divide (const Standard_Real Scalar); | |
106 | ||
107 | ||
108 | //! Divides <me> by a scalar. A new vector is returned. | |
0be7dbe1 | 109 | Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Divided (const Standard_Real Scalar) const; |
42cf5bc1 | 110 | |
111 | ||
112 | //! Computes the product of the vector <me> by a scalar. | |
113 | //! A new vector is returned. | |
0be7dbe1 | 114 | Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const; |
42cf5bc1 | 115 | |
116 | ||
117 | //! Computes the product of the vector <me> by a scalar. | |
118 | Standard_EXPORT void Multiply (const Standard_Real Scalar); | |
119 | ||
120 | //! Normalizes <me>. | |
121 | //! | |
122 | //! Raised if the magnitude of the vector is lower or equal to | |
123 | //! Resolution from package gp. | |
124 | Standard_EXPORT void Normalize(); | |
125 | ||
126 | //! Returns a copy of <me> Normalized. | |
127 | //! | |
128 | //! Raised if the magnitude of the vector is lower or equal to | |
129 | //! Resolution from package gp. | |
0be7dbe1 | 130 | Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Normalized() const; |
42cf5bc1 | 131 | |
132 | //! Subtracts the Vector Other to <me>. | |
133 | Standard_EXPORT void Subtract (const Handle(Geom_Vector)& Other); | |
134 | ||
135 | ||
136 | //! Subtracts the vector Other to <me>. A new vector is returned. | |
0be7dbe1 BB |
137 | Standard_EXPORT Standard_NODISCARD |
138 | Handle(Geom_VectorWithMagnitude) Subtracted (const Handle(Geom_Vector)& Other) const; | |
42cf5bc1 | 139 | |
140 | //! Applies the transformation T to this vector. | |
79104795 | 141 | Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; |
42cf5bc1 | 142 | |
143 | //! Creates a new object which is a copy of this vector. | |
79104795 | 144 | Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 | 145 | |
146 | ||
147 | ||
148 | ||
92efcf78 | 149 | DEFINE_STANDARD_RTTIEXT(Geom_VectorWithMagnitude,Geom_Vector) |
42cf5bc1 | 150 | |
151 | protected: | |
152 | ||
153 | ||
154 | ||
155 | ||
156 | private: | |
157 | ||
158 | ||
159 | ||
160 | ||
161 | }; | |
162 | ||
163 | ||
164 | ||
165 | ||
166 | ||
167 | ||
168 | ||
169 | #endif // _Geom_VectorWithMagnitude_HeaderFile |