basis-processing 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/basis.gemspec +1 -1
  2. data/lib/screen.rb +13 -6
  3. metadata +3 -3
data/basis.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = "basis-processing"
3
- s.version = "0.4.7"
3
+ s.version = "0.4.8"
4
4
  s.author = "Avishek Sen Gupta"
5
5
  s.email = "avishek.sen.gupta@gmail.com"
6
6
  s.homepage = "http://avishek.net/blog"
data/lib/screen.rb CHANGED
@@ -26,8 +26,8 @@ class Screen
26
26
 
27
27
  def draw_ticks(ticks, displacement)
28
28
  ticks.each do |l|
29
- from = @transform.apply(l[:from])
30
- to = @transform.apply(l[:to])
29
+ from = l[:from]
30
+ to = l[:to]
31
31
  tick_vector = normal(from, to)
32
32
  to = {:x => from[:x] + tick_vector[:x], :y => from[:y] + tick_vector[:y]}
33
33
  @artist.line(from[:x],from[:y],to[:x],to[:y])
@@ -51,11 +51,18 @@ class Screen
51
51
  screen_origin = @transform.apply(origin)
52
52
  x_basis_edge = axis_screen_transform.apply(basis.x_basis_vector)
53
53
  y_basis_edge = axis_screen_transform.apply(basis.y_basis_vector)
54
- @artist.line(screen_origin[:x],screen_origin[:y],x_basis_edge[:x],x_basis_edge[:y])
55
- @artist.line(screen_origin[:x],screen_origin[:y],y_basis_edge[:x],y_basis_edge[:y])
56
54
 
57
- draw_ticks(basis.x_ticks(x_interval), {:x => 0, :y => 20})
58
- draw_ticks(basis.y_ticks(y_interval), {:x => -50, :y => 0})
55
+ x_ticks = basis.x_ticks(x_interval)
56
+ y_ticks = basis.y_ticks(y_interval)
57
+
58
+ x_ticks = x_ticks.collect {|t| {:from => @transform.apply(t[:from]), :to => @transform.apply(t[:to]), :label => t[:label]}}
59
+ y_ticks = y_ticks.collect {|t| {:from => @transform.apply(t[:from]), :to => @transform.apply(t[:to]), :label => t[:label]}}
60
+
61
+ @artist.line(x_ticks.first[:from][:x],x_ticks.first[:from][:y],x_ticks.last[:from][:x],x_ticks.last[:from][:y])
62
+ @artist.line(y_ticks.first[:from][:x],y_ticks.first[:from][:y],y_ticks.last[:from][:x],y_ticks.last[:from][:y])
63
+
64
+ draw_ticks(x_ticks, {:x => 0, :y => 20})
65
+ draw_ticks(y_ticks, {:x => -50, :y => 0})
59
66
  end
60
67
  end
61
68
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basis-processing
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 7
10
- version: 0.4.7
9
+ - 8
10
+ version: 0.4.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Avishek Sen Gupta