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 inner = inner.into();
|
||||
let from = self.guide_for_head_around_bend_segment(
|
||||
let from = self.guide_for_head_around_bend(
|
||||
&from_head,
|
||||
inner,
|
||||
RotationSense::Counterclockwise,
|
||||
width,
|
||||
)?;
|
||||
let to = self.guide_for_head_around_bend_segment(
|
||||
&to_head,
|
||||
inner,
|
||||
RotationSense::Clockwise,
|
||||
width,
|
||||
)?;
|
||||
let offset = self.guide_for_head_around_bend_offset(&from_head, inner, width);
|
||||
let to =
|
||||
self.guide_for_head_around_bend(&to_head, inner, RotationSense::Clockwise, width)?;
|
||||
let offset = self.offset_for_guide_for_head_around_bend(&from_head, inner, width);
|
||||
(from, to, offset)
|
||||
} else {
|
||||
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,
|
||||
core,
|
||||
RotationSense::Counterclockwise,
|
||||
width,
|
||||
)?;
|
||||
let to = self.guide_for_head_around_dot_segment(
|
||||
&to_head,
|
||||
core,
|
||||
RotationSense::Clockwise,
|
||||
width,
|
||||
)?;
|
||||
let offset = self.guide_for_head_around_dot_offset(&from_head, core, width);
|
||||
let to =
|
||||
self.guide_for_head_around_dot(&to_head, core, RotationSense::Clockwise, width)?;
|
||||
let offset = self.offset_for_guide_for_head_around_dot(&from_head, core, width);
|
||||
(from, to, offset)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use super::{
|
|||
};
|
||||
|
||||
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,
|
||||
head: &Head,
|
||||
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)
|
||||
}
|
||||
|
||||
pub fn guide_for_head_around_dot_segments(
|
||||
pub fn guides_for_head_around_dot(
|
||||
&self,
|
||||
head: &Head,
|
||||
around: DotIndex,
|
||||
|
|
@ -52,7 +52,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
|||
Ok((tangents[0], tangents[1]))
|
||||
}
|
||||
|
||||
pub fn guide_for_head_around_dot_segment(
|
||||
pub fn guide_for_head_around_dot(
|
||||
&self,
|
||||
head: &Head,
|
||||
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))
|
||||
}
|
||||
|
||||
pub fn guide_for_head_around_dot_offset(
|
||||
pub fn offset_for_guide_for_head_around_dot(
|
||||
&self,
|
||||
head: &Head,
|
||||
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,
|
||||
head: &Head,
|
||||
around: BendIndex,
|
||||
|
|
@ -95,7 +95,7 @@ impl<CW: Clone, Cel: Copy, R: AccessRules> Drawing<CW, Cel, R> {
|
|||
Ok((tangents[0], tangents[1]))
|
||||
}
|
||||
|
||||
pub fn guide_for_head_around_bend_segment(
|
||||
pub fn guide_for_head_around_bend(
|
||||
&self,
|
||||
head: &Head,
|
||||
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))
|
||||
}
|
||||
|
||||
pub fn guide_for_head_around_bend_offset(
|
||||
pub fn offset_for_guide_for_head_around_bend(
|
||||
&self,
|
||||
head: &Head,
|
||||
around: BendIndex,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ impl<R: AccessRules> Draw for Layout<R> {
|
|||
) -> Result<BandTermsegIndex, DrawException> {
|
||||
let tangent = self
|
||||
.drawing()
|
||||
.guide_for_head_into_dot_segment(&head, into, width)
|
||||
.guide_for_head_into_dot(&head, into, width)
|
||||
.map_err(Into::<DrawException>::into)?;
|
||||
|
||||
let (layer, maybe_net) = {
|
||||
|
|
@ -139,10 +139,10 @@ impl<R: AccessRules> Draw for Layout<R> {
|
|||
) -> Result<CaneHead, DrawException> {
|
||||
let tangent =
|
||||
self.drawing()
|
||||
.guide_for_head_around_dot_segment(&head, around.into(), sense, width)?;
|
||||
let offset = self
|
||||
.drawing()
|
||||
.guide_for_head_around_dot_offset(&head, around.into(), width);
|
||||
.guide_for_head_around_dot(&head, around.into(), sense, width)?;
|
||||
let offset =
|
||||
self.drawing()
|
||||
.offset_for_guide_for_head_around_dot(&head, around.into(), width);
|
||||
self.cane_around(
|
||||
recorder,
|
||||
head,
|
||||
|
|
@ -168,10 +168,10 @@ impl<R: AccessRules> Draw for Layout<R> {
|
|||
) -> Result<CaneHead, DrawException> {
|
||||
let tangent = self
|
||||
.drawing()
|
||||
.guide_for_head_around_bend_segment(&head, around, sense, width)?;
|
||||
.guide_for_head_around_bend(&head, around, sense, width)?;
|
||||
let offset = self
|
||||
.drawing()
|
||||
.guide_for_head_around_bend_offset(&head, around, width);
|
||||
.offset_for_guide_for_head_around_bend(&head, around, width);
|
||||
|
||||
self.cane_around(
|
||||
recorder,
|
||||
|
|
|
|||
Loading…
Reference in New Issue