disp3D 0.2.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/Gemfile +1 -1
  2. data/README.md +56 -0
  3. data/VERSION +1 -1
  4. data/disp3D.gemspec +24 -20
  5. data/example/stl_viewer/document_ctrl.rb +2 -2
  6. data/example/stl_viewer/qt_widget_controller.rb +3 -7
  7. data/example/tutorial/03_CameraScene.rb +5 -5
  8. data/example/tutorial/04_Qt.rb +4 -4
  9. data/example/tutorial/05_Pick.rb +13 -13
  10. data/example/tutorial/06_FileParser.rb +3 -3
  11. data/example/tutorial/07_SceneGraph.rb +16 -4
  12. data/example/tutorial/08_SceneGraph2.rb +16 -15
  13. data/example/tutorial/09_Texture.rb +28 -0
  14. data/example/tutorial/10_Animation.rb +27 -0
  15. data/example/tutorial/10_AnimationQt.rb +53 -0
  16. data/example/tutorial/11_MultiView.rb +41 -0
  17. data/example/tutorial/12_Light.rb +65 -0
  18. data/example/tutorial/13_RectPick.rb +38 -0
  19. data/example/tutorial/14_LineRubberband.rb +43 -0
  20. data/example/{test → tutorial}/data/test.png +0 -0
  21. data/example/{test → tutorial}/data/test2.jpg +0 -0
  22. data/lib/camera.rb +8 -0
  23. data/lib/compass.rb +21 -14
  24. data/lib/disp3D.rb +3 -0
  25. data/lib/gl_view.rb +70 -40
  26. data/lib/glut_window.rb +24 -18
  27. data/lib/light.rb +35 -21
  28. data/lib/manipulator.rb +0 -7
  29. data/lib/node/node.rb +100 -105
  30. data/lib/node/node_arrows.rb +1 -1
  31. data/lib/node/node_collection.rb +63 -17
  32. data/lib/node/node_cone.rb +49 -0
  33. data/lib/node/node_coord.rb +26 -11
  34. data/lib/node/node_leaf.rb +17 -11
  35. data/lib/node/node_lines.rb +1 -1
  36. data/lib/node/node_points.rb +2 -1
  37. data/lib/node/node_polylines.rb +1 -1
  38. data/lib/node/node_rectangle.rb +9 -4
  39. data/lib/node/node_sphere.rb +28 -0
  40. data/lib/node/node_tea_pod.rb +4 -4
  41. data/lib/node/node_text.rb +2 -2
  42. data/lib/node/node_tris.rb +1 -1
  43. data/lib/node/node_workplane.rb +33 -1
  44. data/lib/picker.rb +157 -3
  45. data/lib/qt_widget_gl.rb +24 -11
  46. data/lib/scene_graph.rb +3 -3
  47. data/test/node/test_node.rb +230 -0
  48. data/test/node/test_node_collection.rb +99 -79
  49. data/test/test_picker.rb +6 -6
  50. metadata +28 -24
  51. data/README.rdoc +0 -63
  52. data/example/test/capture_test.rb +0 -16
  53. data/example/test/dsl_test.rb +0 -46
  54. data/example/test/texture_test.rb +0 -39
  55. data/test/data/binary_test.stl +0 -0
  56. data/test/data/bunny-flatfoot.stl +0 -0
data/test/test_picker.rb CHANGED
@@ -11,7 +11,7 @@ class PickerTestCase < MiniTest::Unit::TestCase
11
11
  gl_view.world_scene_graph.add(rect_node)
12
12
  gl_view.fit
13
13
 
14
- picked_result = gl_view.picker.pick(200,149)
14
+ picked_result = gl_view.picker.point_pick(200,149)
15
15
  assert_equal(1, picked_result.size)
16
16
  picked_world_pos = picked_result[0].world_position
17
17
 
@@ -26,7 +26,7 @@ class PickerTestCase < MiniTest::Unit::TestCase
26
26
  translate = Vector3.new(0.1, -0.3, 0.0)
27
27
  gl_view.camera.pre_translate = translate
28
28
 
29
- picked_result = gl_view.picker.pick(200,149)
29
+ picked_result = gl_view.picker.point_pick(200,149)
30
30
  assert_equal(1, picked_result.size)
31
31
  picked_world_pos = picked_result[0].world_position
32
32
  assert_in_delta(-0.1, picked_world_pos.x, precision)
@@ -39,7 +39,7 @@ class PickerTestCase < MiniTest::Unit::TestCase
39
39
  translate = Vector3.new(10, -3, 0.0)
40
40
  gl_view.camera.pre_translate = translate
41
41
 
42
- picked_result = gl_view.picker.pick(200,149)
42
+ picked_result = gl_view.picker.point_pick(200,149)
43
43
  assert_equal(0, picked_result.size)
44
44
  end
45
45
 
@@ -50,7 +50,7 @@ class PickerTestCase < MiniTest::Unit::TestCase
50
50
  gl_view.world_scene_graph.add(box_node)
51
51
  gl_view.fit
52
52
 
53
- picked_result = gl_view.picker.pick(200,149)
53
+ picked_result = gl_view.picker.point_pick(200,149)
54
54
  assert_equal(1, picked_result.size)
55
55
  picked_world_pos = picked_result[0].world_position
56
56
 
@@ -64,7 +64,7 @@ class PickerTestCase < MiniTest::Unit::TestCase
64
64
  # rotate model
65
65
  angle_45 = 45.0*Math::PI/180.0
66
66
  gl_view.camera.rotate = Quat.from_axis(Vector3.new(1,0,0), angle_45)
67
- picked_result = gl_view.picker.pick(200,149)
67
+ picked_result = gl_view.picker.point_pick(200,149)
68
68
 
69
69
  assert_equal(1, picked_result.size)
70
70
  picked_world_pos = picked_result[0].world_position
@@ -86,7 +86,7 @@ class PickerTestCase < MiniTest::Unit::TestCase
86
86
  gl_view.fit
87
87
 
88
88
  precision = 0.001
89
- picked_results = gl_view.picker.pick(200,149)
89
+ picked_results = gl_view.picker.point_pick(200,149)
90
90
  assert_equal(2, picked_results.size)
91
91
  picked_results.each do |picked|
92
92
  assert_equal(1, picked.node_path_info.size)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disp3D
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-01 00:00:00.000000000Z
12
+ date: 2011-12-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &21377964 !ruby/object:Gem::Requirement
16
+ requirement: &22795224 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *21377964
24
+ version_requirements: *22795224
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jeweler
27
- requirement: &21377292 !ruby/object:Gem::Requirement
27
+ requirement: &22794864 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: 1.6.4
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *21377292
35
+ version_requirements: *22794864
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gmath3D
38
- requirement: &21353184 !ruby/object:Gem::Requirement
38
+ requirement: &22794396 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.2.5
43
+ version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *21353184
46
+ version_requirements: *22794396
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ruby-opengl
49
- requirement: &21352356 !ruby/object:Gem::Requirement
49
+ requirement: &22793940 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.60.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *21352356
57
+ version_requirements: *22793940
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rmagick
60
- requirement: &21351456 !ruby/object:Gem::Requirement
60
+ requirement: &22793388 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,19 +65,19 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *21351456
68
+ version_requirements: *22793388
69
69
  description: disp3D provide 3D GUI framework
70
70
  email: toshi0328@gmail.com
71
71
  executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files:
74
74
  - LICENSE.txt
75
- - README.rdoc
75
+ - README.md
76
76
  files:
77
77
  - .document
78
78
  - Gemfile
79
79
  - LICENSE.txt
80
- - README.rdoc
80
+ - README.md
81
81
  - Rakefile
82
82
  - VERSION
83
83
  - disp3D.gemspec
@@ -86,11 +86,6 @@ files:
86
86
  - example/stl_viewer/main.rb
87
87
  - example/stl_viewer/qt_widget_controller.rb
88
88
  - example/stl_viewer/stl_viewer.rb
89
- - example/test/capture_test.rb
90
- - example/test/data/test.png
91
- - example/test/data/test2.jpg
92
- - example/test/dsl_test.rb
93
- - example/test/texture_test.rb
94
89
  - example/tutorial/01_helloworld.rb
95
90
  - example/tutorial/02_elements.rb
96
91
  - example/tutorial/03_CameraScene.rb
@@ -99,7 +94,16 @@ files:
99
94
  - example/tutorial/06_FileParser.rb
100
95
  - example/tutorial/07_SceneGraph.rb
101
96
  - example/tutorial/08_SceneGraph2.rb
97
+ - example/tutorial/09_Texture.rb
98
+ - example/tutorial/10_Animation.rb
99
+ - example/tutorial/10_AnimationQt.rb
100
+ - example/tutorial/11_MultiView.rb
101
+ - example/tutorial/12_Light.rb
102
+ - example/tutorial/13_RectPick.rb
103
+ - example/tutorial/14_LineRubberband.rb
102
104
  - example/tutorial/data/bunny.stl
105
+ - example/tutorial/data/test.png
106
+ - example/tutorial/data/test2.jpg
103
107
  - lib/camera.rb
104
108
  - lib/compass.rb
105
109
  - lib/disp3D.rb
@@ -112,12 +116,14 @@ files:
112
116
  - lib/node/node.rb
113
117
  - lib/node/node_arrows.rb
114
118
  - lib/node/node_collection.rb
119
+ - lib/node/node_cone.rb
115
120
  - lib/node/node_coord.rb
116
121
  - lib/node/node_leaf.rb
117
122
  - lib/node/node_lines.rb
118
123
  - lib/node/node_points.rb
119
124
  - lib/node/node_polylines.rb
120
125
  - lib/node/node_rectangle.rb
126
+ - lib/node/node_sphere.rb
121
127
  - lib/node/node_tea_pod.rb
122
128
  - lib/node/node_text.rb
123
129
  - lib/node/node_tris.rb
@@ -128,8 +134,6 @@ files:
128
134
  - lib/qt_widget_gl.rb
129
135
  - lib/scene_graph.rb
130
136
  - lib/stl.rb
131
- - test/data/binary_test.stl
132
- - test/data/bunny-flatfoot.stl
133
137
  - test/data/cube-ascii.stl
134
138
  - test/data/cube-binary.stl
135
139
  - test/helper.rb
@@ -167,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
171
  version: '0'
168
172
  segments:
169
173
  - 0
170
- hash: 1037830061
174
+ hash: 97386611
171
175
  required_rubygems_version: !ruby/object:Gem::Requirement
172
176
  none: false
173
177
  requirements:
@@ -176,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
180
  version: '0'
177
181
  requirements: []
178
182
  rubyforge_project:
179
- rubygems_version: 1.7.2
183
+ rubygems_version: 1.8.12
180
184
  signing_key:
181
185
  specification_version: 3
182
186
  summary: disp3D provide 3D GUI framework.
data/README.rdoc DELETED
@@ -1,63 +0,0 @@
1
- = disp3D
2
- 本ライブラリは、Qtと組み合わせて、3次元の表示が簡単に可能なフレームワークを提供する目的で開発されています。ターゲットは、簡単なアプリ、プロトタイピング、学術利用などを想定しています。
3
-
4
- 以下のような特徴を持つようなライブラリを目指します。
5
- - シンプルで使いやすく!
6
- - Rubyでの開発が可能
7
- - windows,mac,linuxなどプラットフォームを問わない
8
-
9
- また、ゲーム、CGや大規模モデルなどは当面の目標からは外れます。
10
-
11
- == インストール
12
- ライブラリは以下の3つのgemに依存しています。
13
- - gmath3D
14
- - ruby-opengl
15
- - rmagick
16
- - qtbindings(オプション)
17
-
18
- == 使い方
19
- === 例
20
- 1.点や線を3次元ビュー上に追加し、表示する
21
- 開発中
22
-
23
- 2.Qtアプリケーションとして開発をする
24
- 開発中
25
-
26
- 3.STLファイルを読み込み、表示する
27
- 開発中
28
-
29
- 4.表示要素をマウス操作で取得する
30
- 開発中
31
-
32
- === データ構造
33
- 中心となるクラスは、GLViewおよびSceneGraphです。
34
- 執筆中
35
-
36
- == 今後の課題
37
- === 開発項目
38
- - デモアプリ(STLビューワー)
39
-  - QTでのアプリケーション設計
40
-  - tri_nodeの法線方向指定
41
- - インディケート処理の追加
42
- - trackball manipulatorを洗練させる
43
-  - 回転中心を変えるとか・・・
44
- - DSLの設計
45
- - 自動テスト構築
46
- - Windowsでの利用(なぜか、インストールでエラー・・・)
47
- - ライティングの工夫、表示の洗練
48
- - ドキュメント整理(html?)
49
- - テクスチャの貼り付け
50
- - データの可視化としての応用
51
- - アニメーション
52
- - モバイル応用
53
-
54
- === 他ライブラリとの組み合わせ
55
- - 3次元画像処理,pclの利用
56
- - 医用応用として、DICOMパーサー(Ruby-DICOM)の利用
57
- - 2次元画像処理、RMagicに任せる・・・(Ruby-DICOMとのつなぎなど)
58
-
59
- == Copyright
60
-
61
- Copyright (c) 2011 Toshiyasu Shimizu. See LICENSE.txt for
62
- further details.
63
-
@@ -1,16 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
2
- require 'disp3D'
3
-
4
- main_view = Disp3D::GLUTWindow.new(400,300)
5
- node_tea_pod = Disp3D::NodeTeaPod.new(5)
6
- node_tea_pod.material_color = [1,1,0,1]
7
- main_view.world_scene_graph.add(node_tea_pod)
8
- main_view.camera.is_orth = true
9
- main_view.fit
10
- angle = 30.0/180.0*Math::PI
11
- main_view.camera.rotate = Quat.from_axis(Vector3.new(1,0.5,0.0).normalize, angle)
12
-
13
- image = main_view.capture
14
- image.write File.dirname(__FILE__) + '/data/captured.png'
15
-
16
- main_view.start
@@ -1,46 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
2
-
3
- require 'disp3D'
4
-
5
- main_view = Disp3D::GLUTWindow.new(600,400)
6
-
7
- Disp3D::NodeCollection.create :root_node do
8
- add_new :type => :Points,
9
- :geom => Vector3.new(0,0,0),
10
- :colors => [1,1,0,1],
11
- :size => 5
12
-
13
- add_new :type => :Lines,
14
- :name => :line1,
15
- :geom => FiniteLine.new(Vector3.new(-1, 1, 0),Vector3.new(1, 1, 0)),
16
- :width => 3
17
-
18
- add_new :sub_node do
19
- transform :pre_translate => Vector3.new(0,0,-1)
20
- add_new :type => :Points,
21
- :geom => Vector3.new(0,0,0),
22
- :colors => [1,0,0,1],
23
- :size => 3
24
-
25
- add :line1
26
- end
27
-
28
- # "add_new" is as same as "create" and "add" process
29
- create :type => :Polylines,
30
- :name => :polyline1,
31
- :geom => Polyline.new([Vector3.new(-1,0,0), Vector3.new(1,0,0), Vector3.new(1,3,0)]),
32
- :colors => [0,1,0,1],
33
- :width => 4
34
-
35
- add :polyline1
36
- end
37
-
38
- main_view.world_scene_graph.add(:root_node)
39
-
40
- main_view.world_scene_graph.open do
41
- add_new :type => :TeaPod,
42
- :material_color => [0,0,1,1],
43
- :post_translate => Vector3.new(0,0,-4),
44
- :size => 3
45
- end
46
- main_view.start
@@ -1,39 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
2
- require 'disp3D'
3
-
4
- main_view = Disp3D::GLUTWindow.new(600,400)
5
-
6
- #=========================
7
- # load image
8
- file_path1 = File.dirname(__FILE__) + '/data/test.png'
9
- image1 = Magick::Image.read(file_path1).first
10
-
11
- #=========================
12
- # rect
13
- original_point = Vector3.new(0,0,0)
14
- length = 100
15
- rect_geom1 = Rectangle.new(original_point, Vector3.new(length,0,0), Vector3.new(0,length,0))
16
- rect_node1 = Disp3D::NodeRectangle.new(rect_geom1, nil, image1)
17
- main_view.world_scene_graph.add(rect_node1)
18
-
19
- #=========================
20
- # load image
21
- file_path2 = File.dirname(__FILE__) + '/data/test2.jpg'
22
- image2 = Magick::Image.read(file_path2).first
23
-
24
- #=========================
25
- # rect
26
- original_point = Vector3.new(200,0,0)
27
- rect_geom2 = Rectangle.new(original_point, Vector3.new(length,0,0), Vector3.new(0,length,0))
28
- rect_node2 = Disp3D::NodeRectangle.new(rect_geom2, nil, image2)
29
- main_view.world_scene_graph.add(rect_node2)
30
-
31
- #=========================
32
- # rectplane
33
- original_point = Vector3.new(-200,0,0)
34
- rect_geom3 = Rectangle.new(original_point, Vector3.new(length,0,0), Vector3.new(0,length,0))
35
- rect_node3 = Disp3D::NodeRectangle.new(rect_geom3)
36
- main_view.world_scene_graph.add(rect_node3)
37
-
38
- main_view.fit
39
- main_view.start
Binary file
Binary file