From: Ian Jackson Date: Sat, 7 May 2022 12:37:28 +0000 (+0100) Subject: shapelib: Rename nominal arg to rect from centre X-Git-Tag: otter-1.1.0~250 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f3acff155899b1b484a0d95c10894f9e134c28ed;p=otter.git 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 --- 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)?) } }