Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:17:30

0001 // Created on: 1993-03-24
0002 // Created by: JCV
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Geom2d_Vector_HeaderFile
0018 #define _Geom2d_Vector_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <gp_Vec2d.hxx>
0023 #include <Geom2d_Geometry.hxx>
0024 #include <Standard_Real.hxx>
0025 
0026 //! The abstract class Vector describes the common
0027 //! behavior of vectors in 2D space.
0028 //! The Geom2d package provides two concrete
0029 //! classes of vectors: Geom2d_Direction (unit vector)
0030 //! and Geom2d_VectorWithMagnitude.
0031 class Geom2d_Vector : public Geom2d_Geometry
0032 {
0033 
0034 public:
0035   //! Reverses the vector <me>.
0036   Standard_EXPORT void Reverse();
0037 
0038   //! Returns a copy of <me> reversed.
0039   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Vector> Reversed() const;
0040 
0041   //! Computes the angular value, in radians, between this
0042   //! vector and vector Other. The result is a value
0043   //! between -Pi and Pi. The orientation is from this
0044   //! vector to vector Other.
0045   //! Raises VectorWithNullMagnitude if one of the two vectors is a vector with
0046   //! null magnitude because the angular value is indefinite.
0047   Standard_EXPORT double Angle(const occ::handle<Geom2d_Vector>& Other) const;
0048 
0049   //! Returns the coordinates of <me>.
0050   Standard_EXPORT void Coord(double& X, double& Y) const;
0051 
0052   //! Returns the Magnitude of <me>.
0053   Standard_EXPORT virtual double Magnitude() const = 0;
0054 
0055   //! Returns the square magnitude of <me>.
0056   Standard_EXPORT virtual double SquareMagnitude() const = 0;
0057 
0058   //! Returns the X coordinate of <me>.
0059   Standard_EXPORT double X() const;
0060 
0061   //! Returns the Y coordinate of <me>.
0062   Standard_EXPORT double Y() const;
0063 
0064   //! Cross product of <me> with the vector <Other>.
0065   Standard_EXPORT virtual double Crossed(const occ::handle<Geom2d_Vector>& Other) const = 0;
0066 
0067   //! Returns the scalar product of 2 Vectors.
0068   Standard_EXPORT double Dot(const occ::handle<Geom2d_Vector>& Other) const;
0069 
0070   //! Returns a non persistent copy of <me>.
0071   Standard_EXPORT gp_Vec2d Vec2d() const;
0072 
0073   DEFINE_STANDARD_RTTIEXT(Geom2d_Vector, Geom2d_Geometry)
0074 
0075 protected:
0076   gp_Vec2d gpVec2d;
0077 };
0078 
0079 #endif // _Geom2d_Vector_HeaderFile