Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:37

0001 // Created on: 1993-03-10
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 _Geom_Vector_HeaderFile
0018 #define _Geom_Vector_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <gp_Vec.hxx>
0023 #include <Geom_Geometry.hxx>
0024 #include <Standard_Real.hxx>
0025 
0026 
0027 class Geom_Vector;
0028 DEFINE_STANDARD_HANDLE(Geom_Vector, Geom_Geometry)
0029 
0030 //! The abstract class Vector describes the common
0031 //! behavior of vectors in 3D space.
0032 //! The Geom package provides two concrete classes of
0033 //! vectors: Geom_Direction (unit vector) and Geom_VectorWithMagnitude.
0034 class Geom_Vector : public Geom_Geometry
0035 {
0036 
0037 public:
0038 
0039   
0040   //! Reverses the vector <me>.
0041   Standard_EXPORT void Reverse();
0042   
0043 
0044   //! Returns a copy of <me> reversed.
0045   Standard_NODISCARD Standard_EXPORT Handle(Geom_Vector) Reversed() const;
0046   
0047   //! Computes the angular value, in radians, between this
0048   //! vector and vector Other. The result is a value between 0 and Pi.
0049   //! Exceptions
0050   //! gp_VectorWithNullMagnitude if:
0051   //! - the magnitude of this vector is less than or equal to
0052   //! gp::Resolution(), or
0053   //! - the magnitude of vector Other is less than or equal
0054   //! to gp::Resolution().
0055   Standard_EXPORT Standard_Real Angle (const Handle(Geom_Vector)& Other) const;
0056   
0057   //! Computes the angular value, in radians, between this
0058   //! vector and vector Other. The result is a value
0059   //! between -Pi and Pi. The vector VRef defines the
0060   //! positive sense of rotation: the angular value is positive
0061   //! if the cross product this ^ Other has the same
0062   //! orientation as VRef (in relation to the plane defined
0063   //! by this vector and vector Other). Otherwise, it is negative.
0064   //! Exceptions
0065   //! Standard_DomainError if this vector, vector Other
0066   //! and vector VRef are coplanar, except if this vector
0067   //! and vector Other are parallel.
0068   //! gp_VectorWithNullMagnitude if the magnitude of
0069   //! this vector, vector Other or vector VRef is less than
0070   //! or equal to gp::Resolution().
0071   Standard_EXPORT Standard_Real AngleWithRef (const Handle(Geom_Vector)& Other, const Handle(Geom_Vector)& VRef) const;
0072   
0073   //! Returns the coordinates X, Y and Z of this vector.
0074   Standard_EXPORT void Coord (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
0075   
0076   //! Returns the  Magnitude of <me>.
0077   Standard_EXPORT virtual Standard_Real Magnitude() const = 0;
0078   
0079   //! Returns the square magnitude of <me>.
0080   Standard_EXPORT virtual Standard_Real SquareMagnitude() const = 0;
0081   
0082   //! Returns the X coordinate of <me>.
0083   Standard_EXPORT Standard_Real X() const;
0084   
0085   //! Returns the Y coordinate of <me>.
0086   Standard_EXPORT Standard_Real Y() const;
0087   
0088   //! Returns the Z coordinate of <me>.
0089   Standard_EXPORT Standard_Real Z() const;
0090   
0091 
0092   //! Computes the cross product between <me> and <Other>.
0093   //!
0094   //! Raised if <me> is a "Direction" and if <me> and <Other>
0095   //! are parallel because it is not possible to build a
0096   //! "Direction" with null length.
0097   Standard_EXPORT virtual void Cross (const Handle(Geom_Vector)& Other) = 0;
0098   
0099 
0100   //! Computes the cross product between <me> and <Other>.
0101   //! A new direction is returned.
0102   //!
0103   //! Raised if <me> is a "Direction" and if the two vectors
0104   //! are parallel because it is not possible to create a
0105   //! "Direction" with null length.
0106   Standard_EXPORT virtual Handle(Geom_Vector) Crossed (const Handle(Geom_Vector)& Other) const = 0;
0107   
0108 
0109   //! Computes the triple vector product  <me> ^(V1 ^ V2).
0110   //!
0111   //! Raised if <me> is a "Direction" and if V1 and V2 are parallel
0112   //! or <me> and (V1 ^ V2) are  parallel
0113   Standard_EXPORT virtual void CrossCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) = 0;
0114   
0115 
0116   //! Computes the triple vector product <me> ^(V1 ^ V2).
0117   //!
0118   //! Raised if <me> is a direction and if V1 and V2 are
0119   //! parallel or <me> and (V1 ^ V2) are parallel
0120   Standard_EXPORT virtual Handle(Geom_Vector) CrossCrossed (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const = 0;
0121   
0122   //! Computes the scalar product of this vector and vector Other.
0123   Standard_EXPORT Standard_Real Dot (const Handle(Geom_Vector)& Other) const;
0124   
0125 
0126   //! Computes the triple scalar product. Returns me . (V1 ^ V2)
0127   Standard_EXPORT Standard_Real DotCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const;
0128   
0129   //! Converts this vector into a gp_Vec vector.
0130   Standard_EXPORT const gp_Vec& Vec() const;
0131 
0132 
0133 
0134 
0135   DEFINE_STANDARD_RTTIEXT(Geom_Vector,Geom_Geometry)
0136 
0137 protected:
0138 
0139 
0140   gp_Vec gpVec;
0141 
0142 
0143 private:
0144 
0145 
0146 
0147 
0148 };
0149 
0150 
0151 
0152 
0153 
0154 
0155 
0156 #endif // _Geom_Vector_HeaderFile