#ifndef SEGMENT_GENERATOR_HPP #define SEGMENT_GENERATOR_HPP #include "busbar_segment.hpp" #include "busbar_config.hpp" #include "space_analyzer.hpp" #include // 段候选 struct SegmentCandidate { SegmentEndState end_state; std::shared_ptr segment; float cost; SegmentCandidate(const SegmentEndState& end, std::shared_ptr seg, float c) : end_state(end), segment(seg), cost(c) {} }; // 段生成器 class SegmentGenerator { private: const BusbarConfig& config_; const SpaceAnalyzer& analyzer_; // 生成各类段 std::vector generateStraightCandidates( const SegmentEndState& current) const; std::vector generateFlatBendCandidates( const SegmentEndState& current) const; std::vector generateVerticalBendCandidates( const SegmentEndState& current) const; std::vector generateTwistCandidates( const SegmentEndState& current) const; public: // 检查段是否有效(无碰撞) bool isSegmentValid(const BusbarSegment& segment) const; SegmentGenerator(const BusbarConfig& config, const SpaceAnalyzer& analyzer) : config_(config), analyzer_(analyzer) {} // 主接口:生成所有可行的后继段 std::vector generateSuccessors( const SegmentEndState& current) const; }; #endif