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::graph::{TaggedIndex, DotIndex, SegIndex, BendIndex, TaggedWeight, Label, Path};
pub struct Stretch<'a> {
pub struct Bow<'a> {
seg1_dot1: DotIndex,
seg1: SegIndex,
seg1_dot2: DotIndex,
@ -14,7 +14,7 @@ pub struct Stretch<'a> {
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 {
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> {
vec![
TaggedIndex::Seg(self.seg1),

View File

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

View File

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

View File

@ -8,7 +8,7 @@ use rstar::primitives::GeomWithData;
use crate::primitive::Primitive;
use crate::shape::Shape;
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>;
@ -123,8 +123,8 @@ impl Mesh {
Primitive::new(index, &self.graph)
}
pub fn stretch(&self, bend: BendIndex) -> Stretch {
Stretch::new(bend, &self.graph)
pub fn bow(&self, bend: BendIndex) -> Bow {
Bow::new(bend, &self.graph)
}
fn insert_into_rtree(&mut self, index: TaggedIndex) {