ccSphere.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU General Public License as published by #
  7. //# the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  15. //# #
  16. //##########################################################################
  17. #ifndef CC_SPHERE_PRIMITIVE_HEADER
  18. #define CC_SPHERE_PRIMITIVE_HEADER
  19. //Local
  20. #include "ccGenericPrimitive.h"
  21. //! Sphere (primitive)
  22. /** 3D sphere primitive
  23. **/
  24. class QCC_DB_LIB_API ccSphere : public ccGenericPrimitive
  25. {
  26. public:
  27. //! Default constructor
  28. /** \param radius sphere radius
  29. \param transMat optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation)
  30. \param name name
  31. \param precision drawing precision (angular step = 360/precision)
  32. \param uniqueID unique ID (handle with care)
  33. **/
  34. ccSphere( PointCoordinateType radius,
  35. const ccGLMatrix* transMat = nullptr,
  36. QString name = QString("Sphere"),
  37. unsigned precision = 24,
  38. unsigned uniqueID = ccUniqueIDGenerator::InvalidUniqueID);
  39. //! Simplified constructor
  40. /** For ccHObject factory only!
  41. **/
  42. ccSphere(QString name = QString("Sphere"));
  43. //! Returns class ID
  44. virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::SPHERE; }
  45. //inherited from ccGenericPrimitive
  46. virtual QString getTypeName() const override { return "Sphere"; }
  47. virtual bool hasDrawingPrecision() const override { return true; }
  48. virtual ccGenericPrimitive* clone() const override;
  49. //! Returns radius
  50. inline PointCoordinateType getRadius() const { return m_radius; }
  51. //! Sets radius
  52. /** \warning changes primitive content (calls ccGenericPrimitive::updateRepresentation)
  53. **/
  54. void setRadius(PointCoordinateType radius);
  55. protected:
  56. //inherited from ccGenericPrimitive
  57. bool toFile_MeOnly(QFile& out, short dataVersion) const override;
  58. bool fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) override;
  59. short minimumFileVersion_MeOnly() const override;
  60. bool buildUp() override;
  61. //inherited from ccHObject
  62. virtual void drawNameIn3D(CC_DRAW_CONTEXT& context) override;
  63. //! Radius
  64. PointCoordinateType m_radius;
  65. };
  66. #endif //CC_SPHERE_PRIMITIVE_HEADER