1 // Created on: 2012-06-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-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_Vertex_HeaderFile
17 #define _Graphic3d_Vertex_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Macro.hxx>
22 #include <Standard_ShortReal.hxx>
23 #include <Standard_Real.hxx>
25 //! This class represents a graphical 3D point.
26 class Graphic3d_Vertex
32 //! Creates a point with 0.0, 0.0, 0.0 coordinates.
35 SetCoord (0.0f, 0.0f, 0.0f);
38 //! Creates a point with coordinates identical to thePoint.
39 Graphic3d_Vertex (const Graphic3d_Vertex& thePoint)
41 SetCoord (thePoint.X(), thePoint.Y(), thePoint.Z());
44 //! Creates a point with theX, theY and theZ coordinates.
45 Graphic3d_Vertex (const Standard_ShortReal theX,
46 const Standard_ShortReal theY,
47 const Standard_ShortReal theZ)
49 SetCoord (theX, theY, theZ);
52 //! Creates a point with theX, theY and theZ coordinates.
53 Graphic3d_Vertex (const Standard_Real theX,
54 const Standard_Real theY,
55 const Standard_Real theZ)
57 SetCoord (theX, theY, theZ);
60 //! Modifies the coordinates.
61 void SetCoord (const Standard_ShortReal theX,
62 const Standard_ShortReal theY,
63 const Standard_ShortReal theZ)
70 //! Modifies the coordinates.
71 void SetCoord (const Standard_Real theX,
72 const Standard_Real theY,
73 const Standard_Real theZ)
75 xyz[0] = Standard_ShortReal (theX);
76 xyz[1] = Standard_ShortReal (theY);
77 xyz[2] = Standard_ShortReal (theZ);
80 //! Returns the coordinates.
81 void Coord (Standard_ShortReal& theX,
82 Standard_ShortReal& theY,
83 Standard_ShortReal& theZ) const
90 //! Returns the coordinates.
91 void Coord (Standard_Real& theX,
93 Standard_Real& theZ) const
100 //! Returns the X coordinates.
101 Standard_ShortReal X() const { return xyz[0]; }
103 //! Returns the Y coordinate.
104 Standard_ShortReal Y() const { return xyz[1]; }
106 //! Returns the Z coordinate.
107 Standard_ShortReal Z() const { return xyz[2]; }
109 //! Returns the distance between two points.
110 Standard_EXPORT Standard_ShortReal Distance (const Graphic3d_Vertex& theOther) const;