MeshLib Documentation
Loading...
Searching...
No Matches
MRCircleObject.h
Go to the documentation of this file.
1#pragma once
4#include "MRMeshFwd.h"
5#include "MRFeatureObject.h"
6#include "MRVisualObject.h"
7#include "MRPlane3.h"
8
9namespace MR
10{
13
16class MRMESH_CLASS CircleObject : public AddVisualProperties<FeatureObject, DimensionsVisualizePropertyType::diameter>
17{
18public:
22 MRMESH_API CircleObject( const std::vector<Vector3f>& pointsToApprox );
23
24 CircleObject( CircleObject&& ) noexcept = default;
25 CircleObject& operator = ( CircleObject&& ) noexcept = default;
26
27 constexpr static const char* TypeName() noexcept
28 {
29 return "CircleObject";
30 }
31 virtual const char* typeName() const override
32 {
33 return TypeName();
34 }
35
39
40 virtual std::string getClassName() const override
41 {
42 return "Circle";
43 }
44
45 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
46 MRMESH_API virtual std::shared_ptr<Object> shallowClone() const override;
47
49 [[nodiscard]] MRMESH_API float getRadius( ViewportId id = {} ) const;
51 [[nodiscard]] MRMESH_API Vector3f getCenter( ViewportId id = {} ) const;
53 [[nodiscard]] MRMESH_API Vector3f getNormal( ViewportId id = {} ) const;
55 MRMESH_API void setRadius( float radius, ViewportId id = {} );
57 MRMESH_API void setCenter( const Vector3f& center, ViewportId id = {} );
59 MRMESH_API void setNormal( const Vector3f& normal, ViewportId id = {} );
60
61 [[nodiscard]] MRMESH_API FeatureObjectProjectPointResult projectPoint( const Vector3f& point, ViewportId id = {} ) const override;
62
63 [[nodiscard]] MRMESH_API virtual const std::vector<FeatureObjectSharedProperty>& getAllSharedProperties() const override;
64
65protected:
66 CircleObject( const CircleObject& other ) = default;
67
69 MRMESH_API virtual void swapBase_( Object& other ) override;
70
71 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
72
73 virtual Expected<std::future<Expected<void>>> serializeModel_( const std::filesystem::path& ) const override
74 {
75 return {};
76 }
77
78 virtual Expected<void> deserializeModel_( const std::filesystem::path&, ProgressCallback ) override
79 {
80 return {};
81 }
82
83 MRMESH_API void setupRenderObject_() const override;
84};
85
86}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
#define MRMESH_CLASS
Definition MRMesh/MRMeshFwd.h:50
Definition MRAddVisualPropertiesMixin.h:14
Definition MRCircleObject.h:17
MRMESH_API FeatureObjectProjectPointResult projectPoint(const Vector3f &point, ViewportId id={}) const override
virtual Expected< std::future< Expected< void > > > serializeModel_(const std::filesystem::path &) const override
Definition MRCircleObject.h:73
virtual MRMESH_API std::shared_ptr< Object > shallowClone() const override
virtual MRMESH_API std::shared_ptr< Object > clone() const override
virtual Expected< void > deserializeModel_(const std::filesystem::path &, ProgressCallback) override
Reads model from file.
Definition MRCircleObject.h:78
virtual MRMESH_API void serializeFields_(Json::Value &root) const override
MRMESH_API void setupRenderObject_() const override
MRMESH_API void setCenter(const Vector3f &center, ViewportId id={})
updates xf to fit given center
virtual MRMESH_API void swapBase_(Object &other) override
swaps this object with other
MRMESH_API float getRadius(ViewportId id={}) const
calculates radius from xf
virtual const char * typeName() const override
Definition MRCircleObject.h:31
MRMESH_API Vector3f getNormal(ViewportId id={}) const
calculates normal from xf
MRMESH_API Vector3f getCenter(ViewportId id={}) const
calculates center from xf
CircleObject(CircleObject &&) noexcept=default
MRMESH_API void setNormal(const Vector3f &normal, ViewportId id={})
updates xf to fit given normal
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,...
MRMESH_API void setRadius(float radius, ViewportId id={})
updates xf to fit given radius
CircleObject(ProtectedStruct, const CircleObject &obj)
Definition MRCircleObject.h:37
MRMESH_API CircleObject(const std::vector< Vector3f > &pointsToApprox)
Finds best sphere to approx given points.
MRMESH_API CircleObject()
Creates simple sphere object with center in zero and radius - 1.
virtual std::string getClassName() const override
return human readable name of subclass
Definition MRCircleObject.h:40
CircleObject(const CircleObject &other)=default
named object in the data model
Definition MRObject.h:60
Definition MRViewportId.h:16
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:58
Definition MRFeatureObject.h:78
Definition MRObject.h:246