1 // Created on: 1993-03-24
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 _Geom2d_Vector_HeaderFile
18 #define _Geom2d_Vector_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <gp_Vec2d.hxx>
24 #include <Geom2d_Geometry.hxx>
25 #include <Standard_Real.hxx>
26 class Standard_DomainError;
27 class gp_VectorWithNullMagnitude;
32 DEFINE_STANDARD_HANDLE(Geom2d_Vector, Geom2d_Geometry)
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
45 //! Reverses the vector <me>.
46 Standard_EXPORT void Reverse();
48 //! Returns a copy of <me> reversed.
49 Standard_EXPORT Handle(Geom2d_Vector) Reversed() const;
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;
59 //! Returns the coordinates of <me>.
60 Standard_EXPORT void Coord (Standard_Real& X, Standard_Real& Y) const;
62 //! Returns the Magnitude of <me>.
63 Standard_EXPORT virtual Standard_Real Magnitude() const = 0;
65 //! Returns the square magnitude of <me>.
66 Standard_EXPORT virtual Standard_Real SquareMagnitude() const = 0;
68 //! Returns the X coordinate of <me>.
69 Standard_EXPORT Standard_Real X() const;
71 //! Returns the Y coordinate of <me>.
72 Standard_EXPORT Standard_Real Y() const;
74 //! Cross product of <me> with the vector <Other>.
75 Standard_EXPORT virtual Standard_Real Crossed (const Handle(Geom2d_Vector)& Other) const = 0;
77 //! Returns the scalar product of 2 Vectors.
78 Standard_EXPORT Standard_Real Dot (const Handle(Geom2d_Vector)& Other) const;
80 //! Returns a non persistent copy of <me>.
81 Standard_EXPORT gp_Vec2d Vec2d() const;
86 DEFINE_STANDARD_RTTI(Geom2d_Vector,Geom2d_Geometry)
107 #endif // _Geom2d_Vector_HeaderFile