Measuring: Measure gizmo features registered for raycasted picking

This commit is contained in:
enricoturri1966 2022-08-29 12:55:34 +02:00
parent aeb8dec463
commit 6c0aff0d23
10 changed files with 160 additions and 29 deletions

View file

@ -49,6 +49,16 @@ public:
// For anything, return an extra point that should also be considered a part of this.
std::optional<Vec3d> get_extra_point() const { assert(m_type != SurfaceFeatureType::Undef); return m_pt3; }
bool operator == (const SurfaceFeature& other) const {
if (this->m_type != other.m_type) return false;
if (!this->m_pt1.isApprox(other.m_pt1)) return false;
if (!this->m_pt2.isApprox(other.m_pt2)) return false;
if (this->m_pt3.has_value() && !other.m_pt3.has_value()) return false;
if (!this->m_pt3.has_value() && other.m_pt3.has_value()) return false;
if (this->m_pt3.has_value() && other.m_pt3.has_value() && !(*this->m_pt3).isApprox(*other.m_pt3)) return false;
return this->m_value == other.m_value;
}
private:
SurfaceFeatureType m_type = SurfaceFeatureType::Undef;
Vec3d m_pt1;

View file

@ -67,7 +67,7 @@
#define ENABLE_RAYCAST_PICKING (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
#define ENABLE_RAYCAST_PICKING_DEBUG (0 && ENABLE_RAYCAST_PICKING)
// Enable Measure Gizmo
#define ENABLE_MEASURE_GIZMO (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
#define ENABLE_MEASURE_GIZMO (1 && ENABLE_RAYCAST_PICKING)
// Enable debug code for Measure Gizmo
#define ENABLE_MEASURE_GIZMO_DEBUG (0 && ENABLE_MEASURE_GIZMO)