Program Listing for File function_item_evaluator.h¶
↰ Return to documentation for file (src/ifcgeom/function_item_evaluator.h)
#ifndef ITERATOR_PWF_EVALUATOR_H
#define ITERATOR_PWF_EVALUATOR_H
#include "../ifcgeom/taxonomy.h"
namespace ifcopenshell { namespace geom {
IFC_GEOM_API std::vector<double> helmert_curve_point(double A0, double A1, double A2, double s);
inline taxonomy::function_item::ptr convert_loop_to_function_item(taxonomy::loop::ptr loop) {
return ifcopenshell::geom::taxonomy::dcast<taxonomy::function_item>(loop);
}
struct IFC_GEOM_API fn_evaluator {
fn_evaluator(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : settings_(settings), logger_(logger) {
}
fn_evaluator(const fn_evaluator& other) = default;
virtual ~fn_evaluator() = default;
virtual fn_evaluator* clone() const = 0;
virtual Eigen::Matrix4d evaluate(double u) const = 0;
virtual double start() const = 0;
virtual double end() const = 0;
double length() const { return end() - start(); }
ifcopenshell::geom::settings settings_;
protected:
ifcopenshell::logger& logger_;
};
class IFC_GEOM_API function_item_evaluator {
public:
function_item_evaluator(const ifcopenshell::geom::settings& settings, taxonomy::function_item::const_ptr fn, ifcopenshell::logger& logger = ifcopenshell::logger::root());
function_item_evaluator(const function_item_evaluator& other);
~function_item_evaluator();
std::vector<double> evaluation_points() const;
std::vector<double> evaluation_points(double ustart, double uend, unsigned nsteps) const;
taxonomy::item::ptr evaluate() const;
taxonomy::item::ptr evaluate(double ustart, double uend, unsigned nsteps) const;
Eigen::Matrix4d evaluate(double u) const;
private:
taxonomy::item::ptr evaluate(const std::vector<double>& dist) const;
fn_evaluator* fn_evaluator_ = nullptr;
mutable std::optional<std::vector<double>> eval_points_; // cache evaluation points
ifcopenshell::logger& logger_;
};
}}
#endif