1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Graphic3d_Vector_HeaderFile
17 #define _Graphic3d_Vector_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <Standard_ShortReal.hxx>
24 #include <Standard_Real.hxx>
25 #include <Graphic3d_Vertex.hxx>
26 #include <Standard_Boolean.hxx>
27 class Graphic3d_VectorError;
30 //! This class allows the creation and update
32 class Graphic3d_Vector
39 //! Creates a vector with 1.0, 0.0, 0.0 coordinates.
40 Standard_EXPORT Graphic3d_Vector();
42 //! Creates a vector with <AX>, <AY>, <AZ> coordinates.
43 Standard_EXPORT Graphic3d_Vector(const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ);
45 //! Creates a vector from 2 points <APoint1> and <APoint2>.
46 Standard_EXPORT Graphic3d_Vector(const Graphic3d_Vertex& APoint1, const Graphic3d_Vertex& APoint2);
49 //! Category: Methods to modify the class definition
50 //! Warning: Raises VectorError if <me> is null.
51 Standard_EXPORT void Normalize();
53 //! Modifies the coordinates of the vector <me>.
54 Standard_EXPORT void SetCoord (const Standard_Real Xnew, const Standard_Real Ynew, const Standard_Real Znew);
56 //! Modifies the X coordinate of the vector <me>.
57 Standard_EXPORT void SetXCoord (const Standard_Real Xnew);
59 //! Modifies the Y coordinate of the vector <me>.
60 Standard_EXPORT void SetYCoord (const Standard_Real Ynew);
62 //! Modifies the Z coordinate of the vector <me>.
63 Standard_EXPORT void SetZCoord (const Standard_Real Znew);
65 //! Returns the coordinates of the vector <me>.
66 Standard_EXPORT void Coord (Standard_Real& AX, Standard_Real& AY, Standard_Real& AZ) const;
68 //! Returns Standard_True if <me> has length 1.
69 Standard_EXPORT Standard_Boolean IsNormalized() const;
71 //! Returns Standard_True if <me> has length zero.
72 Standard_EXPORT Standard_Boolean LengthZero() const;
74 //! Returns the X coordinates of the vector <me>.
75 Standard_EXPORT Standard_Real X() const;
77 //! Returns the Y coordinate of the vector <me>.
78 Standard_EXPORT Standard_Real Y() const;
80 //! Returns the Z coordinate of the vector <me>.
81 Standard_EXPORT Standard_Real Z() const;
83 //! Returns Standard_True if the vector <AV1> and
84 //! <AV2> are parallel.
85 Standard_EXPORT static Standard_Boolean IsParallel (const Graphic3d_Vector& AV1, const Graphic3d_Vector& AV2);
87 //! Returns the norm of the vector <AX>, <AY>, <AZ>.
88 Standard_EXPORT static Standard_Real NormeOf (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ);
90 //! Returns the norm of the vector <AVector>.
91 Standard_EXPORT static Standard_Real NormeOf (const Graphic3d_Vector& AVector);
106 Standard_ShortReal MyX;
107 Standard_ShortReal MyY;
108 Standard_ShortReal MyZ;
109 Standard_ShortReal MyNorme;
120 #endif // _Graphic3d_Vector_HeaderFile