Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2012-06-20
0002 // Created by: Sergey ZERCHANINOV
0003 // Copyright (c) 2011-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Graphic3d_Vertex_HeaderFile
0017 #define _Graphic3d_Vertex_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Macro.hxx>
0022 #include <Standard_ShortReal.hxx>
0023 #include <Standard_OStream.hxx>
0024 
0025 //! This class represents a graphical 3D point.
0026 class Graphic3d_Vertex
0027 {
0028 public:
0029 
0030   DEFINE_STANDARD_ALLOC
0031 
0032   //! Creates a point with 0.0, 0.0, 0.0 coordinates.
0033   Graphic3d_Vertex()
0034   {
0035     SetCoord (0.0f, 0.0f, 0.0f);
0036   }
0037 
0038   //! Creates a point with theX, theY and theZ coordinates.
0039   Graphic3d_Vertex (const Standard_ShortReal theX,
0040                     const Standard_ShortReal theY,
0041                     const Standard_ShortReal theZ)
0042   {
0043     SetCoord (theX, theY, theZ);
0044   }
0045 
0046   //! Creates a point with theX, theY and theZ coordinates.
0047   Graphic3d_Vertex (const Standard_Real theX,
0048                     const Standard_Real theY,
0049                     const Standard_Real theZ)
0050   {
0051     SetCoord (theX, theY, theZ);
0052   }
0053 
0054   //! Modifies the coordinates.
0055   void SetCoord (const Standard_ShortReal theX,
0056                  const Standard_ShortReal theY,
0057                  const Standard_ShortReal theZ)
0058   {
0059     xyz[0] = theX;
0060     xyz[1] = theY;
0061     xyz[2] = theZ;
0062   }
0063 
0064   //! Modifies the coordinates.
0065   void SetCoord (const Standard_Real theX,
0066                  const Standard_Real theY,
0067                  const Standard_Real theZ)
0068   {
0069     xyz[0] = Standard_ShortReal (theX);
0070     xyz[1] = Standard_ShortReal (theY);
0071     xyz[2] = Standard_ShortReal (theZ);
0072   }
0073 
0074   //! Returns the coordinates.
0075   void Coord (Standard_ShortReal& theX,
0076               Standard_ShortReal& theY,
0077               Standard_ShortReal& theZ) const
0078   {
0079     theX = xyz[0];
0080     theY = xyz[1];
0081     theZ = xyz[2];
0082   }
0083 
0084   //! Returns the coordinates.
0085   void Coord (Standard_Real& theX,
0086               Standard_Real& theY,
0087               Standard_Real& theZ) const
0088   {
0089     theX = xyz[0];
0090     theY = xyz[1];
0091     theZ = xyz[2];
0092   }
0093 
0094   //! Returns the X coordinates.
0095   Standard_ShortReal X() const { return xyz[0]; }
0096 
0097   //! Returns the Y coordinate.
0098   Standard_ShortReal Y() const { return xyz[1]; }
0099 
0100   //! Returns the Z coordinate.
0101   Standard_ShortReal Z() const { return xyz[2]; }
0102 
0103   //! Returns the distance between two points.
0104   Standard_EXPORT Standard_ShortReal Distance (const Graphic3d_Vertex& theOther) const;
0105   
0106   //! Dumps the content of me into the stream
0107   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0108 
0109   float xyz[3];
0110 
0111 };
0112 
0113 #endif