MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSphereObject.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRFeatureObject.h"
6#include "MRMeshFwd.h"
7#include "MRVisualObject.h"
8
9namespace MR
10{
13
14
17class MRMESH_CLASS SphereObject : public AddVisualProperties<FeatureObject, DimensionsVisualizePropertyType::diameter>
18{
19public:
21 MRMESH_API SphereObject();
23 MRMESH_API SphereObject( const std::vector<Vector3f>& pointsToApprox );
24
25 SphereObject( SphereObject&& ) noexcept = default;
26 SphereObject& operator = ( SphereObject&& ) noexcept = default;
27
28 constexpr static const char* StaticTypeName() noexcept { return "SphereObject"; }
29 virtual const char* typeName() const override {return StaticTypeName(); }
30
31 constexpr static const char* StaticClassName() noexcept { return "Sphere"; }
32 virtual std::string className() const override { return StaticClassName(); }
33
34 constexpr static const char* StaticClassNameInPlural() noexcept { return "Spheres"; }
35 virtual std::string classNameInPlural() const override { return StaticClassNameInPlural(); }
36
39
40 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
41 MRMESH_API virtual std::shared_ptr<Object> shallowClone() const override;
42
44 MRMESH_API float getRadius( ViewportId id = {} ) const;
46 MRMESH_API Vector3f getCenter( ViewportId id = {} ) const;
48 MRMESH_API void setRadius( float radius, ViewportId id = {} );
50 MRMESH_API void setCenter( const Vector3f& center, ViewportId id = {} );
51
52 MRMESH_API virtual const std::vector<FeatureObjectSharedProperty>& getAllSharedProperties() const override;
53
54 [[nodiscard]] MRMESH_API FeatureObjectProjectPointResult projectPoint( const Vector3f& point, ViewportId id = {} ) const override;
55
56protected:
57 SphereObject( const SphereObject& other ) = default;
58
60 MRMESH_API virtual void swapBase_( Object& other ) override;
61
62 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
63
64 virtual Expected<std::future<Expected<void>>> serializeModel_( const std::filesystem::path& ) const override
65 { return {}; }
66
67 virtual Expected<void> deserializeModel_( const std::filesystem::path&, ProgressCallback ) override
68 { return {}; }
69
70 MRMESH_API void setupRenderObject_() const override;
71};
72
73}
Definition MRAddVisualPropertiesMixin.h:17
named object in the data model
Definition MRObject.h:62
Definition MRSphereObject.h:18
Definition MRViewportId.h:16
SphereObject(const SphereObject &other)=default
virtual std::string classNameInPlural() const override
Definition MRSphereObject.h:35
virtual MRMESH_API std::shared_ptr< Object > clone() const override
static constexpr const char * StaticClassName() noexcept
Definition MRSphereObject.h:31
static constexpr const char * StaticClassNameInPlural() noexcept
Definition MRSphereObject.h:34
virtual const char * typeName() const override
Definition MRSphereObject.h:29
MRMESH_API void setRadius(float radius, ViewportId id={})
updates xf to fit given radius
MRMESH_API SphereObject(const std::vector< Vector3f > &pointsToApprox)
Finds best sphere to approx given points.
SphereObject(SphereObject &&) noexcept=default
virtual Expected< void > deserializeModel_(const std::filesystem::path &, ProgressCallback) override
Reads model from file.
Definition MRSphereObject.h:67
MRMESH_API FeatureObjectProjectPointResult projectPoint(const Vector3f &point, ViewportId id={}) const override
MRMESH_API void setCenter(const Vector3f &center, ViewportId id={})
updates xf to fit given center
tl::expected< T, E > Expected
Definition MRExpected.h:31
MRMESH_API Vector3f getCenter(ViewportId id={}) const
calculates center from xf
virtual MRMESH_API void serializeFields_(Json::Value &root) const override
virtual MRMESH_API void swapBase_(Object &other) override
swaps this object with other
MRMESH_API void setupRenderObject_() const override
SphereObject(ProtectedStruct, const SphereObject &obj)
Definition MRSphereObject.h:38
virtual MRMESH_API const std::vector< FeatureObjectSharedProperty > & getAllSharedProperties() const override
Create and generate list of bounded getters and setters for the main properties of feature object,...
virtual Expected< std::future< Expected< void > > > serializeModel_(const std::filesystem::path &) const override
Definition MRSphereObject.h:64
virtual std::string className() const override
Definition MRSphereObject.h:32
MRMESH_API SphereObject()
Creates simple sphere object with center in zero and radius - 1.
virtual MRMESH_API std::shared_ptr< Object > shallowClone() const override
MRMESH_API float getRadius(ViewportId id={}) const
calculates radius from xf
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRFeatureObject.h:81
Definition MRObject.h:284