From f3acff155899b1b484a0d95c10894f9e134c28ed Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 7 May 2022 13:37:28 +0100 Subject: [PATCH] shapelib: Rename nominal arg to rect from centre This is the nominal location, around which the rectangle is centred. This makes it clearer exp. for the call sites elsewhere, where this parameter is just the piece position. Signed-off-by: Ian Jackson --- src/shapelib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shapelib.rs b/src/shapelib.rs index c6f8f0f1..934a05a8 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -647,14 +647,14 @@ pub struct RectShape { pub xy: PosC } impl RectShape { // Used by code elsewhere eg deck.rs for occultation boundaries etc. #[throws(CoordinateOverflow)] - pub fn rect(&self, centre: Pos) -> RectC { + pub fn rect(&self, nominal: Pos) -> RectC { let offset = (self.xy * 0.5)?; let offset = offset.try_map( |c| c.floor().to_i32().ok_or(CoordinateOverflow) )?; let rect = RectC{ corners: [-1,1].iter().map(|&signum| Ok::<_,CoordinateOverflow>({ - (centre + (offset * signum)?)? + (nominal + (offset * signum)?)? })) .collect::,_>>()? .into_inner().unwrap() @@ -663,8 +663,8 @@ impl RectShape { } #[throws(CoordinateOverflow)] - pub fn region(&self, centre: Pos) -> Region { - Region::Rect(self.rect(centre)?) + pub fn region(&self, nominal: Pos) -> Region { + Region::Rect(self.rect(nominal)?) } } -- 2.30.2