mirror of https://codeberg.org/topola/topola.git
refactor(drawing/guide): Make method names somewhat clearer
This commit is contained in:
parent
177c8abb18
commit
7fbfed710c
|
|
@ -728,35 +728,27 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
|
|
||||||
let (from, to, offset) = if let Some(inner) = rail_primitive.inner() {
|
let (from, to, offset) = if let Some(inner) = rail_primitive.inner() {
|
||||||
let inner = inner.into();
|
let inner = inner.into();
|
||||||
let from = self.guide_for_head_around_bend_segment(
|
let from = self.guide_for_head_around_bend(
|
||||||
&from_head,
|
&from_head,
|
||||||
inner,
|
inner,
|
||||||
RotationSense::Counterclockwise,
|
RotationSense::Counterclockwise,
|
||||||
width,
|
width,
|
||||||
)?;
|
)?;
|
||||||
let to = self.guide_for_head_around_bend_segment(
|
let to =
|
||||||
&to_head,
|
self.guide_for_head_around_bend(&to_head, inner, RotationSense::Clockwise, width)?;
|
||||||
inner,
|
let offset = self.offset_for_guide_for_head_around_bend(&from_head, inner, width);
|
||||||
RotationSense::Clockwise,
|
|
||||||
width,
|
|
||||||
)?;
|
|
||||||
let offset = self.guide_for_head_around_bend_offset(&from_head, inner, width);
|
|
||||||
(from, to, offset)
|
(from, to, offset)
|
||||||
} else {
|
} else {
|
||||||
let core = rail_primitive.core().into();
|
let core = rail_primitive.core().into();
|
||||||
let from = self.guide_for_head_around_dot_segment(
|
let from = self.guide_for_head_around_dot(
|
||||||
&from_head,
|
&from_head,
|
||||||
core,
|
core,
|
||||||
RotationSense::Counterclockwise,
|
RotationSense::Counterclockwise,
|
||||||
width,
|
width,
|
||||||
)?;
|
)?;
|
||||||
let to = self.guide_for_head_around_dot_segment(
|
let to =
|
||||||
&to_head,
|
self.guide_for_head_around_dot(&to_head, core, RotationSense::Clockwise, width)?;
|
||||||
core,
|
let offset = self.offset_for_guide_for_head_around_dot(&from_head, core, width);
|
||||||
RotationSense::Clockwise,
|
|
||||||
width,
|
|
||||||
)?;
|
|
||||||
let offset = self.guide_for_head_around_dot_offset(&from_head, core, width);
|
|
||||||
(from, to, offset)
|
(from, to, offset)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use super::{
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
pub fn guide_for_head_into_dot_segment(
|
pub fn guide_for_head_into_dot(
|
||||||
&self,
|
&self,
|
||||||
head: &Head,
|
head: &Head,
|
||||||
into: FixedDotIndex,
|
into: FixedDotIndex,
|
||||||
|
|
@ -36,7 +36,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
math::tangent_segment(from_circle, from_sense, to_circle, None)
|
math::tangent_segment(from_circle, from_sense, to_circle, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn guide_for_head_around_dot_segments(
|
pub fn guides_for_head_around_dot(
|
||||||
&self,
|
&self,
|
||||||
head: &Head,
|
head: &Head,
|
||||||
around: DotIndex,
|
around: DotIndex,
|
||||||
|
|
@ -52,7 +52,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
Ok((tangents[0], tangents[1]))
|
Ok((tangents[0], tangents[1]))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn guide_for_head_around_dot_segment(
|
pub fn guide_for_head_around_dot(
|
||||||
&self,
|
&self,
|
||||||
head: &Head,
|
head: &Head,
|
||||||
around: DotIndex,
|
around: DotIndex,
|
||||||
|
|
@ -67,7 +67,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
math::tangent_segment(from_circle, from_sense, to_circle, Some(sense))
|
math::tangent_segment(from_circle, from_sense, to_circle, Some(sense))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn guide_for_head_around_dot_offset(
|
pub fn offset_for_guide_for_head_around_dot(
|
||||||
&self,
|
&self,
|
||||||
head: &Head,
|
head: &Head,
|
||||||
around: DotIndex,
|
around: DotIndex,
|
||||||
|
|
@ -79,7 +79,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn guide_for_head_around_bend_segments(
|
pub fn guides_for_head_around_bend(
|
||||||
&self,
|
&self,
|
||||||
head: &Head,
|
head: &Head,
|
||||||
around: BendIndex,
|
around: BendIndex,
|
||||||
|
|
@ -95,7 +95,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
Ok((tangents[0], tangents[1]))
|
Ok((tangents[0], tangents[1]))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn guide_for_head_around_bend_segment(
|
pub fn guide_for_head_around_bend(
|
||||||
&self,
|
&self,
|
||||||
head: &Head,
|
head: &Head,
|
||||||
around: BendIndex,
|
around: BendIndex,
|
||||||
|
|
@ -110,7 +110,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
||||||
math::tangent_segment(from_circle, from_sense, to_circle, Some(sense))
|
math::tangent_segment(from_circle, from_sense, to_circle, Some(sense))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn guide_for_head_around_bend_offset(
|
pub fn offset_for_guide_for_head_around_bend(
|
||||||
&self,
|
&self,
|
||||||
head: &Head,
|
head: &Head,
|
||||||
around: BendIndex,
|
around: BendIndex,
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ impl<R: AccessRules> Draw for Layout<R> {
|
||||||
) -> Result<BandTermsegIndex, DrawException> {
|
) -> Result<BandTermsegIndex, DrawException> {
|
||||||
let tangent = self
|
let tangent = self
|
||||||
.drawing()
|
.drawing()
|
||||||
.guide_for_head_into_dot_segment(&head, into, width)
|
.guide_for_head_into_dot(&head, into, width)
|
||||||
.map_err(Into::<DrawException>::into)?;
|
.map_err(Into::<DrawException>::into)?;
|
||||||
|
|
||||||
let (layer, maybe_net) = {
|
let (layer, maybe_net) = {
|
||||||
|
|
@ -139,10 +139,10 @@ impl<R: AccessRules> Draw for Layout<R> {
|
||||||
) -> Result<CaneHead, DrawException> {
|
) -> Result<CaneHead, DrawException> {
|
||||||
let tangent =
|
let tangent =
|
||||||
self.drawing()
|
self.drawing()
|
||||||
.guide_for_head_around_dot_segment(&head, around.into(), sense, width)?;
|
.guide_for_head_around_dot(&head, around.into(), sense, width)?;
|
||||||
let offset = self
|
let offset =
|
||||||
.drawing()
|
self.drawing()
|
||||||
.guide_for_head_around_dot_offset(&head, around.into(), width);
|
.offset_for_guide_for_head_around_dot(&head, around.into(), width);
|
||||||
self.cane_around(
|
self.cane_around(
|
||||||
recorder,
|
recorder,
|
||||||
head,
|
head,
|
||||||
|
|
@ -168,10 +168,10 @@ impl<R: AccessRules> Draw for Layout<R> {
|
||||||
) -> Result<CaneHead, DrawException> {
|
) -> Result<CaneHead, DrawException> {
|
||||||
let tangent = self
|
let tangent = self
|
||||||
.drawing()
|
.drawing()
|
||||||
.guide_for_head_around_bend_segment(&head, around, sense, width)?;
|
.guide_for_head_around_bend(&head, around, sense, width)?;
|
||||||
let offset = self
|
let offset = self
|
||||||
.drawing()
|
.drawing()
|
||||||
.guide_for_head_around_bend_offset(&head, around, width);
|
.offset_for_guide_for_head_around_bend(&head, around, width);
|
||||||
|
|
||||||
self.cane_around(
|
self.cane_around(
|
||||||
recorder,
|
recorder,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue