Files
茂之钳 12db7d3e5a
CI / Build & Test (push) Failing after 1m31s
CI / Release Build (push) Failing after 31s
Build & Test / build-and-test (push) Has been cancelled
Build & Test / python-bindings (push) Has been cancelled
feat(v3.5): perf caching + measure + flange/gear + feature tree + assembly constraints
2026-07-24 14:02:24 +00:00

65 lines
1.4 KiB
C++

#pragma once
#include "vde/brep/brep.h"
#include <string>
#include <vector>
#include <memory>
#include <functional>
namespace vde::brep {
/// Feature operation types
enum class FeatureType {
PrimitiveBox,
PrimitiveCylinder,
PrimitiveSphere,
Extrude,
Fillet,
Chamfer,
Shell,
BooleanUnion,
BooleanDifference,
BooleanIntersection
};
/// Parameters for a feature operation
struct FeatureParams {
std::vector<double> values; // numeric params
std::vector<int> int_values; // integer params
std::string name; // operation name
};
/// One node in the feature tree
struct FeatureNode {
FeatureType type;
FeatureParams params;
std::vector<std::unique_ptr<FeatureNode>> children;
/// Evaluate this feature (rebuild geometry from parameters)
[[nodiscard]] BrepModel evaluate() const;
};
/// Feature tree with undo/redo support
class FeatureHistory {
public:
/// Apply a feature operation
void apply(const BrepModel& input, FeatureType type, const FeatureParams& params);
/// Undo last operation
[[nodiscard]] bool undo();
/// Redo last undone operation
[[nodiscard]] bool redo();
/// Get current model
[[nodiscard]] const BrepModel& current() const;
/// Number of operations in history
[[nodiscard]] size_t size() const { return states_.size(); }
private:
std::vector<BrepModel> states_;
size_t current_idx_ = 0;
};
} // namespace vde::brep