Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
BlobSizeRange.h 905 B
#pragma once

#include <misc/vec2.h>
#include <misc/metastring.h>

namespace cmn {

class BlobSizeRange {
    GETTER(std::set<Rangef>, ranges)
    GETTER(Rangef, max_range)
    
public:
    BlobSizeRange(const std::vector<Rangef>& ranges = {});
    bool in_range_of_one(float cmsq, float scale_factor = -1, float scale_factor_r = -1) const;
    bool close_to_minimum_of_one(float cmsq, float scale_factor) const;
    bool close_to_maximum_of_one(float cmsq, float scale_factor) const;
    void add(const Rangef&);
    
    operator MetaObject() const;
    inline bool operator==(const BlobSizeRange& other) const {
        return _ranges == other._ranges;
    }
    inline bool operator!=(const BlobSizeRange& other) const {
        return _ranges != other._ranges;
    }
    
    static std::string class_name() { return "BlobSizeRange"; }
    static BlobSizeRange fromStr(const std::string& str);
};

}