fix(autorouter/anterouter): Correctly calculate fanout lengths

This commit is contained in:
Mikolaj Wielgus 2025-10-08 02:18:56 +02:00
parent a3521e7286
commit 8235c66c7e
2 changed files with 10 additions and 19 deletions

View File

@ -48,7 +48,7 @@ impl MenuBar {
Self { Self {
multilayer_autorouter_options: MultilayerAutorouterOptions { multilayer_autorouter_options: MultilayerAutorouterOptions {
anterouter: AnterouterOptions { anterouter: AnterouterOptions {
fanout_clearance: 100.0, fanout_clearance: 200.0,
}, },
planar: AutorouterOptions { planar: AutorouterOptions {
presort_by: PresortBy::RatlineIntersectionCountAndLength, presort_by: PresortBy::RatlineIntersectionCountAndLength,

View File

@ -348,6 +348,7 @@ impl Anterouter {
.drawing() .drawing()
.primitive(source_dot) .primitive(source_dot)
.maybe_net(); .maybe_net();
let bbox_center = point! {x: bbox.center()[0], y: bbox.center()[1]};
let center = autorouter let center = autorouter
.board() .board()
.layout() .layout()
@ -357,22 +358,19 @@ impl Anterouter {
.center(); .center();
let cardinal_direction_vector = Point::from(cardinal_direction); let cardinal_direction_vector = Point::from(cardinal_direction);
/*bbox_to_anchor *= 1.0
+ dbg!(
options.fanout_outer_length
/ Euclidean::distance(bbox_to_anchor, point! {x: 0.0, y: 0.0})
);*/
let bbox_anchor = point! { let bbox_anchor = point! {
x: (bbox.upper()[0] - bbox.lower()[0]) / 2.0 * cardinal_direction_vector.x(), x: (bbox.upper()[0] - bbox.lower()[0]) / 2.0 * cardinal_direction_vector.x(),
y: (bbox.upper()[1] - bbox.lower()[1]) / 2.0 * cardinal_direction_vector.y(), y: (bbox.upper()[1] - bbox.lower()[1]) / 2.0 * cardinal_direction_vector.y(),
}; };
let pos = center let bbox_anchor_with_clearance = bbox_anchor
+ bbox_anchor
* (1.0 * (1.0
+ options.fanout_clearance + options.fanout_clearance
/ Euclidean::distance(bbox_anchor, point! {x: 0.0, y: 0.0})); / Euclidean::distance(bbox_anchor, point! {x: 0.0, y: 0.0}));
let pos = center
//let via_bbox_to_anchor = [-pin_bbox_to_anchor[0], -pin_bbox_to_anchor[1]]; + cardinal_direction_vector
* (bbox_center + bbox_anchor_with_clearance - center)
.dot(cardinal_direction_vector);
let mut board_edit = BoardEdit::new(); let mut board_edit = BoardEdit::new();
@ -407,12 +405,5 @@ impl Anterouter {
} else { } else {
Err(()) Err(())
} }
/*let bbox = if let Some(poly) = autorouter.board().layout().drawing().geometry().compounds(dot).find(|(_, compound_weight)| {
matches!(compound_weight, CompoundWeight::Poly(..))
}) {
poly.ref_(autorouter.board().layout()).polygon()
} else {
//
}*/
} }
} }