lib/geometry/annulus.rb in geometry-6.4 vs lib/geometry/annulus.rb in geometry-6.5
- old
+ new
@@ -64,9 +64,27 @@
@inner_diameter = options[:inner_diameter]
@inner_radius = options[:inner_radius]
@outer_diameter = options[:outer_diameter] || options[:diameter]
@outer_radius = options[:outer_radius] || options[:radius]
end
+
+ # @!attribute max
+ # @return [Point] The upper right corner of the bounding {Rectangle}
+ def max
+ @center+radius
+ end
+
+ # @!attribute min
+ # @return [Point] The lower left corner of the bounding {Rectangle}
+ def min
+ @center-radius
+ end
+
+ # @!attribute minmax
+ # @return [Array<Point>] The lower left and upper right corners of the bounding {Rectangle}
+ def minmax
+ [self.min, self.max]
+ end
end
# Ring is an alias of Annulus because that's the word that most people use,
# despite the proclivities of mathmeticians.
Ring = Annulus