You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

2 weeks ago
#ifndef SEGMENT_GENERATOR_HPP
#define SEGMENT_GENERATOR_HPP
#include "busbar_segment.hpp"
#include "busbar_config.hpp"
#include "space_analyzer.hpp"
#include <memory>
// �κ�ѡ
struct SegmentCandidate {
SegmentEndState end_state;
std::shared_ptr<BusbarSegment> segment;
float cost;
SegmentCandidate(const SegmentEndState& end,
std::shared_ptr<BusbarSegment> seg,
float c)
: end_state(end), segment(seg), cost(c) {}
};
// ��������
class SegmentGenerator {
private:
const BusbarConfig& config_;
const SpaceAnalyzer& analyzer_;
// ���ɸ�����
std::vector<SegmentCandidate> generateStraightCandidates(
const SegmentEndState& current) const;
std::vector<SegmentCandidate> generateFlatBendCandidates(
const SegmentEndState& current) const;
std::vector<SegmentCandidate> generateVerticalBendCandidates(
const SegmentEndState& current) const;
std::vector<SegmentCandidate> 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<SegmentCandidate> generateSuccessors(
const SegmentEndState& current) const;
};
#endif