MeshLib C++ Docs
Loading...
Searching...
No Matches
MRCylinderObject.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 CylinderObject : public AddVisualProperties<FeatureObject,
18 DimensionsVisualizePropertyType::diameter,
19 DimensionsVisualizePropertyType::length
20>
21{
22public:
24 MRMESH_API CylinderObject();
26 MRMESH_API CylinderObject( const std::vector<Vector3f>& pointsToApprox );
27
28 CylinderObject( CylinderObject&& ) noexcept = default;
29 CylinderObject& operator = ( CylinderObject&& ) noexcept = default;
30
31 constexpr static const char* StaticTypeName() noexcept { return "CylinderObject"; }
32 virtual const char* typeName() const override { return StaticTypeName(); }
33
34 constexpr static const char* StaticClassName() noexcept { return "Cylinder"; }
35 virtual std::string className() const override { return StaticClassName(); }
36
37 constexpr static const char* StaticClassNameInPlural() noexcept { return "Cylinders"; }
38 virtual std::string classNameInPlural() const override { return StaticClassNameInPlural(); }
39
43
44 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
45 MRMESH_API virtual std::shared_ptr<Object> shallowClone() const override;
46
48 MRMESH_API float getRadius( ViewportId id = {} ) const;
50 MRMESH_API Vector3f getCenter( ViewportId id = {} ) const;
52 MRMESH_API void setRadius( float radius, ViewportId id = {} );
54 MRMESH_API void setCenter( const Vector3f& center, ViewportId id = {} );
56 MRMESH_API Vector3f getDirection( ViewportId id = {} ) const;
58 MRMESH_API void setDirection( const Vector3f& normal, ViewportId id = {} );
60 MRMESH_API float getLength( ViewportId id = {} ) const;
62 MRMESH_API void setLength( float length, ViewportId id = {} );
63
65 [[nodiscard]] MRMESH_API virtual Vector3f getBasePoint( ViewportId id = {} ) const override;
66
67 MRMESH_API virtual const std::vector<FeatureObjectSharedProperty>& getAllSharedProperties() const override;
68
69 [[nodiscard]] MRMESH_API FeatureObjectProjectPointResult projectPoint( const Vector3f& point, ViewportId id = {} ) const override;
70
71protected:
72 CylinderObject( const CylinderObject& other ) = default;
73
75 MRMESH_API virtual void swapBase_( Object& other ) override;
76
77 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
78
79 virtual Expected<std::future<Expected<void>>> serializeModel_( const std::filesystem::path& ) const override
80 {
81 return {};
82 }
83
84 virtual Expected<void> deserializeModel_( const std::filesystem::path&, ProgressCallback ) override
85 {
86 return {};
87 }
88
89 MRMESH_API void setupRenderObject_() const override;
90};
91
92}
Definition MRAddVisualPropertiesMixin.h:17
Definition MRCylinderObject.h:21
named object in the data model
Definition MRObject.h:62
Definition MRViewportId.h:16
CylinderObject(const CylinderObject &other)=default
virtual Expected< void > deserializeModel_(const std::filesystem::path &, ProgressCallback) override
Reads model from file.
Definition MRCylinderObject.h:84
MRMESH_API Vector3f getDirection(ViewportId id={}) const
calculates main axis direction from xf
MRMESH_API void setLength(float length, ViewportId id={})
updates xf to fit cylinder length
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 Vector3f getCenter(ViewportId id={}) const
calculates center from xf
CylinderObject(CylinderObject &&) noexcept=default
virtual Expected< std::future< Expected< void > > > serializeModel_(const std::filesystem::path &) const override
Definition MRCylinderObject.h:79
MRMESH_API void setRadius(float radius, ViewportId id={})
updates xf to fit given radius
virtual const char * typeName() const override
Definition MRCylinderObject.h:32
MRMESH_API float getLength(ViewportId id={}) const
calculates cylinder length from xf
tl::expected< T, E > Expected
Definition MRExpected.h:31
virtual MRMESH_API std::shared_ptr< Object > shallowClone() const override
virtual std::string className() const override
Definition MRCylinderObject.h:35
MRMESH_API void setDirection(const Vector3f &normal, ViewportId id={})
updates xf to fit main axis
virtual MRMESH_API std::shared_ptr< Object > clone() const override
MRMESH_API float getRadius(ViewportId id={}) const
calculates radius from xf
virtual MRMESH_API Vector3f getBasePoint(ViewportId id={}) const override
Returns point considered as base for the feature.
MRMESH_API FeatureObjectProjectPointResult projectPoint(const Vector3f &point, ViewportId id={}) const override
MRMESH_API void setupRenderObject_() const override
virtual MRMESH_API void serializeFields_(Json::Value &root) const override
static constexpr const char * StaticClassNameInPlural() noexcept
Definition MRCylinderObject.h:37
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
virtual std::string classNameInPlural() const override
Definition MRCylinderObject.h:38
MRMESH_API CylinderObject(const std::vector< Vector3f > &pointsToApprox)
Finds best Cylinder to approx given points.
static constexpr const char * StaticClassName() noexcept
Definition MRCylinderObject.h:34
CylinderObject(ProtectedStruct, const CylinderObject &obj)
Definition MRCylinderObject.h:41
MRMESH_API CylinderObject()
Creates simple Cylinder object with center in zero and radius - 1.
length
Definition MRObjectDimensionsEnum.h:17
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRFeatureObject.h:81
Definition MRObject.h:284