Rename `Stretch` to `Bow`

I wanted to name it `String` (as in bowstring), but it's taken in Rust,
and `Bowstring` is longer than just `Bow`, and the thing in question is
very much bow-shaped, so I went with `Bow`.
This commit is contained in:
Mikolaj Wielgus 2023-07-26 02:29:54 +02:00
parent f563bc2c5a
commit e5a1c52655
4 changed files with 10 additions and 10 deletions

View File

@ -3,7 +3,7 @@ use petgraph::stable_graph::StableDiGraph;
use crate::primitive::{Dot, Seg, Bend}; use crate::primitive::{Dot, Seg, Bend};
use crate::graph::{TaggedIndex, DotIndex, SegIndex, BendIndex, TaggedWeight, Label, Path}; use crate::graph::{TaggedIndex, DotIndex, SegIndex, BendIndex, TaggedWeight, Label, Path};
pub struct Stretch<'a> { pub struct Bow<'a> {
seg1_dot1: DotIndex, seg1_dot1: DotIndex,
seg1: SegIndex, seg1: SegIndex,
seg1_dot2: DotIndex, seg1_dot2: DotIndex,
@ -14,7 +14,7 @@ pub struct Stretch<'a> {
graph: &'a StableDiGraph<TaggedWeight, Label, usize>, graph: &'a StableDiGraph<TaggedWeight, Label, usize>,
} }
impl<'a> Stretch<'a> { impl<'a> Bow<'a> {
pub fn new(index: BendIndex, graph: &'a StableDiGraph<TaggedWeight, Label, usize>) -> Self { pub fn new(index: BendIndex, graph: &'a StableDiGraph<TaggedWeight, Label, usize>) -> Self {
let bend = index; let bend = index;
@ -39,7 +39,7 @@ impl<'a> Stretch<'a> {
} }
} }
impl<'a> Path for Stretch<'a> { impl<'a> Path for Bow<'a> {
fn interior(&self) -> Vec<TaggedIndex> { fn interior(&self) -> Vec<TaggedIndex> {
vec![ vec![
TaggedIndex::Seg(self.seg1), TaggedIndex::Seg(self.seg1),

View File

@ -155,9 +155,9 @@ impl Layout {
let mut cur_bend = bend; let mut cur_bend = bend;
while let Some(outer) = self.mesh.primitive(cur_bend).outer() { while let Some(outer) = self.mesh.primitive(cur_bend).outer() {
let stretch = self.mesh.stretch(outer); let bow = self.mesh.bow(outer);
endss.push(stretch.ends()); endss.push(bow.ends());
interiors.push(stretch.interior()); interiors.push(bow.interior());
cur_bend = outer; cur_bend = outer;
} }

View File

@ -4,7 +4,7 @@ extern crate sdl2;
mod layout; mod layout;
mod rules; mod rules;
mod mesh; mod mesh;
mod stretch; mod bow;
mod primitive; mod primitive;
mod shape; mod shape;
mod math; mod math;

View File

@ -8,7 +8,7 @@ use rstar::primitives::GeomWithData;
use crate::primitive::Primitive; use crate::primitive::Primitive;
use crate::shape::Shape; use crate::shape::Shape;
use crate::graph::{Tag, TaggedIndex, DotIndex, SegIndex, BendIndex, Index, TaggedWeight, DotWeight, SegWeight, BendWeight, Label, Path}; use crate::graph::{Tag, TaggedIndex, DotIndex, SegIndex, BendIndex, Index, TaggedWeight, DotWeight, SegWeight, BendWeight, Label, Path};
use crate::stretch::Stretch; use crate::bow::Bow;
pub type RTreeWrapper = GeomWithData<Shape, TaggedIndex>; pub type RTreeWrapper = GeomWithData<Shape, TaggedIndex>;
@ -123,8 +123,8 @@ impl Mesh {
Primitive::new(index, &self.graph) Primitive::new(index, &self.graph)
} }
pub fn stretch(&self, bend: BendIndex) -> Stretch { pub fn bow(&self, bend: BendIndex) -> Bow {
Stretch::new(bend, &self.graph) Bow::new(bend, &self.graph)
} }
fn insert_into_rtree(&mut self, index: TaggedIndex) { fn insert_into_rtree(&mut self, index: TaggedIndex) {