MeshLib C++ Docs
Loading...
Searching...
No Matches
MRAngleMeasurementObject.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace MR
6{
9
10
12class MRMESH_CLASS AngleMeasurementObject : public MeasurementObject
13{
15public:
17
19 AngleMeasurementObject& operator=( AngleMeasurementObject&& ) noexcept = default;
20
21 constexpr static const char* StaticTypeName() noexcept { return "AngleMeasurementObject"; }
22 const char* typeName() const override { return StaticTypeName(); }
23
24 constexpr static const char* StaticClassName() noexcept { return "Angle"; }
25 virtual std::string className() const override { return StaticClassName(); }
26
27 constexpr static const char* StaticClassNameInPlural() noexcept { return "Angles"; }
28 virtual std::string classNameInPlural() const override { return StaticClassNameInPlural(); }
29
32
33 MRMESH_API std::shared_ptr<Object> clone() const override;
34 MRMESH_API std::shared_ptr<Object> shallowClone() const override;
35
37 [[nodiscard]] MRMESH_API Vector3f getWorldPoint() const;
39 [[nodiscard]] MRMESH_API Vector3f getLocalPoint() const;
40
43 [[nodiscard]] MRMESH_API Vector3f getWorldRay( bool second ) const;
45 [[nodiscard]] MRMESH_API Vector3f getLocalRay( bool second ) const;
46
48 MRMESH_API virtual void setLocalPoint( const MR::Vector3f& point );
51 MRMESH_API virtual void setLocalRays( const MR::Vector3f& a, const MR::Vector3f& b );
52
54 [[nodiscard]] MRMESH_API bool getIsConical() const;
55 MRMESH_API void setIsConical( bool value );
56
58 [[nodiscard]] MRMESH_API bool getShouldVisualizeRay( bool second ) const;
59 MRMESH_API void setShouldVisualizeRay( bool second, bool enable );
60
62 [[nodiscard]] MRMESH_API float computeAngle() const;
63
64 [[nodiscard]] MRMESH_API std::vector<std::string> getInfoLines() const override;
65
66protected:
68
69 MRMESH_API void swapBase_( Object& other ) override;
70
71 MRMESH_API void serializeFields_( Json::Value& root ) const override;
72 MRMESH_API void deserializeFields_( const Json::Value& root ) override;
73
74 MRMESH_API void setupRenderObject_() const override;
75
76 MRMESH_API void onWorldXfChanged_() override;
77
78private:
80
82 bool isConical_ = false;
83
85 bool shouldVisualizeRay_[2]{};
86
88 mutable std::optional<float> cachedValue_;
89};
90
91}
Represents an angle measurement.
Definition MRAngleMeasurementObject.h:13
Definition MRMeasurementObject.h:14
named object in the data model
Definition MRObject.h:62
MRMESH_API Vector3f getWorldPoint() const
Get the angle point in world coordinates.
MRMESH_API std::shared_ptr< Object > clone() const override
static constexpr const char * StaticClassNameInPlural() noexcept
Definition MRAngleMeasurementObject.h:27
MRMESH_API void swapBase_(Object &other) override
swaps this object with other
virtual std::string className() const override
Definition MRAngleMeasurementObject.h:25
MRMESH_API bool getShouldVisualizeRay(bool second) const
Whether we should draw a ray from the center point to better visualize the angle. Enable this if ther...
MRMESH_API void serializeFields_(Json::Value &root) const override
MRMESH_API void setIsConical(bool value)
AngleMeasurementObject(const AngleMeasurementObject &other)=default
MRMESH_API void deserializeFields_(const Json::Value &root) override
MRMESH_API bool getIsConical() const
Whether this is a conical angle. The middle line between the rays is preserved, but the rays themselv...
virtual MRMESH_API void setLocalRays(const MR::Vector3f &a, const MR::Vector3f &b)
MRMESH_API Vector3f getWorldRay(bool second) const
AngleMeasurementObject(AngleMeasurementObject &&) noexcept=default
MRMESH_API std::vector< std::string > getInfoLines() const override
return several info lines that can better describe the object in the UI
MRMESH_API std::shared_ptr< Object > shallowClone() const override
AngleMeasurementObject()
The xf encodes the two rays: the origin is the angle point, (1,0,0) is the first ray,...
Definition MRAngleMeasurementObject.h:16
MRMESH_API float computeAngle() const
Computes the angle value, as if by acos(dot(...)) from the two normalized getWorldRay()s.
const char * typeName() const override
Definition MRAngleMeasurementObject.h:22
MRMESH_API void setShouldVisualizeRay(bool second, bool enable)
static constexpr const char * StaticClassName() noexcept
Definition MRAngleMeasurementObject.h:24
virtual std::string classNameInPlural() const override
Definition MRAngleMeasurementObject.h:28
MRMESH_API Vector3f getLocalPoint() const
Get the angle point in local coordinates.
virtual MRMESH_API void setLocalPoint(const MR::Vector3f &point)
Set the angle point in the local coordinates.
MRMESH_API Vector3f getLocalRay(bool second) const
Same, but in local coordinates.
AngleMeasurementObject(ProtectedStruct, const AngleMeasurementObject &obj)
For std::make_shared() in clone().
Definition MRAngleMeasurementObject.h:31
MRMESH_API void setupRenderObject_() const override
MRMESH_API void onWorldXfChanged_() override
Emits worldXfChangedSignal, but derived classes can add additional behavior to it.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRObject.h:284