Kevin Lee 6 kuukautta sitten
vanhempi
commit
a4ac621288
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 7 3
      src/ezcad/objects/mod.rs

+ 7 - 3
src/ezcad/objects/mod.rs

@@ -289,15 +289,18 @@ pub struct ObjectModifier {
 }
 
 impl ObjectModifier {
+    /// Apply relative move to origin correction vector
     pub fn move_relative(&mut self, delta: Coordinate) {
         self.default = 255.into();
         self.modifiers.correction += delta;
     }
 
+    /// Return correction to origin offset of object
     pub fn correction(&self) -> Coordinate {
         self.modifiers.correction
     }
 
+    /// Returns scaling vector of object 
     pub fn scale(&self) -> Coordinate {
         Coordinate {
             x: self.modifiers.x_scale,
@@ -305,6 +308,7 @@ impl ObjectModifier {
         }
     }
 
+    /// Returns skewing vector of object
     pub fn skew(&self) -> Coordinate {
         Coordinate {
             x: self.modifiers.y_skew.asin(), // Radians from X axis
@@ -312,7 +316,7 @@ impl ObjectModifier {
         }
     }
 
-    /// Returns origin, width, and height of bounding box given two rectangular corners
+    /// Returns origin, width, and height of bounding box after applying scale, skew, and  offset corrections
     pub fn corrected(&self, pt1: Coordinate, pt2: Coordinate) -> (Coordinate, f64, f64) {
         debug!(
             "Skew degree from X axis: {:.2}",
@@ -370,7 +374,7 @@ impl ObjectModifier {
                 .join(", ")
         );
 
-        // Apply correction
+        // Apply scale and origin correction
         let corrected_pts: Vec<Coordinate> = skewed_pts
             .iter()
             .map(|pt| *pt * self.scale() + self.correction())
@@ -391,7 +395,7 @@ impl ObjectModifier {
         let min_y: f64 = corrected_pts.iter().fold(f64::MAX, |acc, pt| acc.min(pt.y));
         let max_y: f64 = corrected_pts.iter().fold(f64::MIN, |acc, pt| acc.max(pt.y));
 
-        // Compute corrected min/max bounding box
+        // Compute min/max bounding box
         let bound_a: Coordinate = Coordinate { x: min_x, y: min_y };
         let bound_b: Coordinate = Coordinate { x: max_x, y: max_y };