layout: make infringables include bends around the source

This fixes some of the routing failures due to rule infringements.
This commit is contained in:
Mikolaj Wielgus 2024-02-11 20:38:58 +00:00
parent d5d2ffd9d8
commit 12af34d492
1 changed files with 23 additions and 3 deletions

View File

@ -259,7 +259,7 @@ impl<R: RulesTrait> Layout<R> {
cw: bool, cw: bool,
) -> Result<Segbend, LayoutException> { ) -> Result<Segbend, LayoutException> {
let maybe_wraparound = self.wraparoundable(around).wraparound(); let maybe_wraparound = self.wraparoundable(around).wraparound();
let mut infringables = self.this_and_wraparound_bow(around); let mut infringables = self.segbend_inner_and_outer_bibows(from, around);
if let Some(wraparound) = maybe_wraparound { if let Some(wraparound) = maybe_wraparound {
infringables.append(&mut self.outer_bows(wraparound)); infringables.append(&mut self.outer_bows(wraparound));
@ -336,6 +336,21 @@ impl<R: RulesTrait> Layout<R> {
v v
} }
#[debug_ensures(self.geometry_with_rtree.graph().node_count() == old(self.geometry_with_rtree.graph().node_count()))]
#[debug_ensures(self.geometry_with_rtree.graph().edge_count() == old(self.geometry_with_rtree.graph().edge_count()))]
fn segbend_inner_and_outer_bibows(
&self,
from: DotIndex,
around: WraparoundableIndex,
) -> Vec<GeometryIndex> {
let mut v = match from {
DotIndex::Fixed(..) => vec![],
DotIndex::Loose(dot) => self.inner_bow_and_outer_bow(self.primitive(dot).bend().into()),
};
v.append(&mut self.this_and_wraparound_bow(around));
v
}
#[debug_ensures(self.geometry_with_rtree.graph().node_count() == old(self.geometry_with_rtree.graph().node_count()))] #[debug_ensures(self.geometry_with_rtree.graph().node_count() == old(self.geometry_with_rtree.graph().node_count()))]
#[debug_ensures(self.geometry_with_rtree.graph().edge_count() == old(self.geometry_with_rtree.graph().edge_count()))] #[debug_ensures(self.geometry_with_rtree.graph().edge_count() == old(self.geometry_with_rtree.graph().edge_count()))]
fn this_and_wraparound_bow(&self, around: WraparoundableIndex) -> Vec<GeometryIndex> { fn this_and_wraparound_bow(&self, around: WraparoundableIndex) -> Vec<GeometryIndex> {
@ -530,7 +545,7 @@ impl<R: RulesTrait> Layout<R> {
seg_weight, seg_weight,
bend_weight, bend_weight,
cw, cw,
&self.this_and_wraparound_bow(around), &self.segbend_inner_and_outer_bibows(from, around),
) )
} }
@ -618,7 +633,12 @@ impl<R: RulesTrait> Layout<R> {
to: LooseDotIndex, to: LooseDotIndex,
weight: SeqLooseSegWeight, weight: SeqLooseSegWeight,
) -> Result<SeqLooseSegIndex, Infringement> { ) -> Result<SeqLooseSegIndex, Infringement> {
let seg = self.add_seg_infringably(from, to.into(), weight, &[])?; let seg = self.add_seg_infringably(
from,
to.into(),
weight,
&self.inner_bow_and_outer_bow(self.primitive(to).bend().into()),
)?;
if let DotIndex::Fixed(dot) = from { if let DotIndex::Fixed(dot) = from {
self.connectivity.update_edge( self.connectivity.update_edge(