perfect-shape 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea11a066d120228aeb5889877909e17d93022e44e9c46899088bf97e52a328a6
4
- data.tar.gz: 2d9f3031bd0edfa073d20c6c8f8d56541aa473ef92335f6606b88fbe0a9b39f4
3
+ metadata.gz: 11b0b3324d2d9a6ea74cf92529f4657899021ef9b515e9bac45ce0538927b519
4
+ data.tar.gz: b89aaf29076f074800f8934e3df56111254f5f162c5efbcd26ee1afda5386734
5
5
  SHA512:
6
- metadata.gz: 8025f51a536223a337d10b8a3b0bb9cd66aefe37543d24108aa002d719c4eb123a5b19d89b00157a85054bd614f92bdaf944562efbbecf14a93ab6d9c0a6481c
7
- data.tar.gz: 06701161fbe42ec6afe1f19d9ece0db38d44db679702ea0db420fc260fa19526a2d2b4475c5aaa0d6f0500260ad48ad7267b4da1ec626153749d70175c50e523
6
+ metadata.gz: bb359cd9182b49f0d345c66d17a3cfda427a9b366b615d8bd8b63fcf75953747da9273802295135fec146ad25bb0eb6875d83626224acdf159111d23ab61213b
7
+ data.tar.gz: a2c318a07294e002af53c80421f388f662045f390ec9be24437eb9c7aeeafb9af50db36899fbb90e738b67e1a21a85cb0762b238891fb2b93ce238893c5514c6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.5.1
4
+
5
+ - `Point#intersect?(rectangle)` (equivalent to `Rectangle#contain?(point)`)
6
+
3
7
  ## 0.5.0
4
8
 
5
9
  - `Line#intersect?(rectangle)`
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Perfect Shape 0.5.0
1
+ # Perfect Shape 0.5.1
2
2
  ## Geometric Algorithms
3
3
  [![Gem Version](https://badge.fury.io/rb/perfect-shape.svg)](http://badge.fury.io/rb/perfect-shape)
4
4
  [![Test](https://github.com/AndyObtiva/perfect-shape/actions/workflows/ruby.yml/badge.svg)](https://github.com/AndyObtiva/perfect-shape/actions/workflows/ruby.yml)
@@ -14,13 +14,13 @@ To ensure high accuracy, this library does all its mathematical operations with
14
14
  Run:
15
15
 
16
16
  ```
17
- gem install perfect-shape -v 0.5.0
17
+ gem install perfect-shape -v 0.5.1
18
18
  ```
19
19
 
20
20
  Or include in Bundler `Gemfile`:
21
21
 
22
22
  ```ruby
23
- gem 'perfect-shape', '~> 0.5.0'
23
+ gem 'perfect-shape', '~> 0.5.1'
24
24
  ```
25
25
 
26
26
  And, run:
@@ -177,6 +177,7 @@ Points are simply represented by an `Array` of `[x,y]` coordinates when used wit
177
177
  - `#bounding_box`: bounding box is a rectangle with x = min x, y = min y, and width/height of shape
178
178
  - `#==(other)`: Returns `true` if equal to `other` or `false` otherwise
179
179
  - `#contain?(x_or_point, y=nil, outline: true, distance_tolerance: 0)`: checks if point matches self, with a distance tolerance (0 by default). Distance tolerance provides a fuzz factor that for example enables GUI users to mouse-click-select a point shape more successfully. `outline` option makes no difference on point
180
+ - `#intersect?(rectangle)`: Returns `true` if intersecting with interior of rectangle or `false` otherwise. This is useful for GUI optimization checks of whether a shape appears in a GUI viewport rectangle and needs redrawing
180
181
  - `#point_distance(x_or_point, y=nil)`: Returns the distance from a point to another point
181
182
 
182
183
  Example:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -96,6 +96,10 @@ module PerfectShape
96
96
  Point.point_distance(self.x, self.y, x, y)
97
97
  end
98
98
 
99
+ def intersect?(rectangle)
100
+ rectangle.contain?(self.to_a)
101
+ end
102
+
99
103
  # Convert to pair Array of x,y coordinates
100
104
  def to_a
101
105
  [self.x, self.y]
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: perfect-shape 0.5.0 ruby lib
5
+ # stub: perfect-shape 0.5.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "perfect-shape".freeze
9
- s.version = "0.5.0"
9
+ s.version = "0.5.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Andy Maleh".freeze]
14
- s.date = "2022-01-18"
14
+ s.date = "2022-01-19"
15
15
  s.description = "Perfect Shape is a collection of pure Ruby geometric algorithms that are mostly useful for GUI manipulation like checking viewport rectangle intersection or containment of a mouse click point in popular geometry shapes such as rectangle, square, arc (open, chord, and pie), ellipse, circle, polygon, and paths containing lines, quadratic b\u00E9zier curves, and cubic bezier curves, potentially with affine transforms applied like translation, scale, rotation, shear/skew, and inversion (including both Ray Casting Algorithm, aka Even-odd Rule, and Winding Number Algorithm, aka Nonzero Rule). Additionally, it contains some purely mathematical algorithms like IEEEremainder (also known as IEEE-754 remainder).".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfect-shape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-18 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equalizer