Skip to content

File bench_bounding_box.h

File List > benchmark > metrics > implementations > bench_bounding_box.h

Go to the documentation of this file

#pragma once

#include "../../../include/mesh/Vector3D.h"
#include "../Metric.h"
#include <benchmark/benchmark.h>

#include <vector>

namespace Argos {

    struct BoundingBox {
        Vector3D<double> min;
        Vector3D<double> max;

        Vector3D<double> size() const;
        double volume() const;
        double diagonal() const;
        Vector3D<double> center() const;
    };

    class BoundingBoxComputer {
    public:
        static BoundingBox compute(const std::vector<Vector3D<double>>& points);
    };

    double centerDistance(const BoundingBox& a, const BoundingBox& b);
    double normalizedCenterDistance(const BoundingBox& a, const BoundingBox& b);

    class BoundingBoxMetric : public Metric {
    public:
        BoundingBoxMetric() : Metric("BoundingBox") {}

        ~BoundingBoxMetric() = default;

        void compute(const Mesh& original, const Mesh& reconstructed, benchmark::State& state) const override;
    };
}