42cf5bc1 |
1 | // Created on: 1993-03-24 |
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 _Geom2d_Vector_HeaderFile |
18 | #define _Geom2d_Vector_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <gp_Vec2d.hxx> |
24 | #include <Geom2d_Geometry.hxx> |
25 | #include <Standard_Real.hxx> |
26 | class Standard_DomainError; |
27 | class gp_VectorWithNullMagnitude; |
28 | class gp_Vec2d; |
29 | |
30 | |
31 | class Geom2d_Vector; |
32 | DEFINE_STANDARD_HANDLE(Geom2d_Vector, Geom2d_Geometry) |
33 | |
34 | //! The abstract class Vector describes the common |
35 | //! behavior of vectors in 2D space. |
36 | //! The Geom2d package provides two concrete |
37 | //! classes of vectors: Geom2d_Direction (unit vector) |
38 | //! and Geom2d_VectorWithMagnitude. |
39 | class Geom2d_Vector : public Geom2d_Geometry |
40 | { |
41 | |
42 | public: |
43 | |
44 | |
45 | //! Reverses the vector <me>. |
46 | Standard_EXPORT void Reverse(); |
47 | |
48 | //! Returns a copy of <me> reversed. |
49 | Standard_EXPORT Handle(Geom2d_Vector) Reversed() const; |
50 | |
51 | //! Computes the angular value, in radians, between this |
52 | //! vector and vector Other. The result is a value |
53 | //! between -Pi and Pi. The orientation is from this |
54 | //! vector to vector Other. |
55 | //! Raises VectorWithNullMagnitude if one of the two vectors is a vector with |
56 | //! null magnitude because the angular value is indefinite. |
57 | Standard_EXPORT Standard_Real Angle (const Handle(Geom2d_Vector)& Other) const; |
58 | |
59 | //! Returns the coordinates of <me>. |
60 | Standard_EXPORT void Coord (Standard_Real& X, Standard_Real& Y) const; |
61 | |
62 | //! Returns the Magnitude of <me>. |
63 | Standard_EXPORT virtual Standard_Real Magnitude() const = 0; |
64 | |
65 | //! Returns the square magnitude of <me>. |
66 | Standard_EXPORT virtual Standard_Real SquareMagnitude() const = 0; |
67 | |
68 | //! Returns the X coordinate of <me>. |
69 | Standard_EXPORT Standard_Real X() const; |
70 | |
71 | //! Returns the Y coordinate of <me>. |
72 | Standard_EXPORT Standard_Real Y() const; |
73 | |
74 | //! Cross product of <me> with the vector <Other>. |
75 | Standard_EXPORT virtual Standard_Real Crossed (const Handle(Geom2d_Vector)& Other) const = 0; |
76 | |
77 | //! Returns the scalar product of 2 Vectors. |
78 | Standard_EXPORT Standard_Real Dot (const Handle(Geom2d_Vector)& Other) const; |
79 | |
80 | //! Returns a non persistent copy of <me>. |
81 | Standard_EXPORT gp_Vec2d Vec2d() const; |
82 | |
83 | |
84 | |
85 | |
86 | DEFINE_STANDARD_RTTI(Geom2d_Vector,Geom2d_Geometry) |
87 | |
88 | protected: |
89 | |
90 | |
91 | gp_Vec2d gpVec2d; |
92 | |
93 | |
94 | private: |
95 | |
96 | |
97 | |
98 | |
99 | }; |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | #endif // _Geom2d_Vector_HeaderFile |