rays 0.1.47 → 0.1.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/rays/bitmap.cpp +287 -46
  3. data/.doc/ext/rays/camera.cpp +2 -2
  4. data/.doc/ext/rays/color.cpp +11 -0
  5. data/.doc/ext/rays/defs.cpp +32 -8
  6. data/.doc/ext/rays/font.cpp +50 -2
  7. data/.doc/ext/rays/image.cpp +3 -3
  8. data/.doc/ext/rays/matrix.cpp +65 -7
  9. data/.doc/ext/rays/native.cpp +2 -4
  10. data/.doc/ext/rays/painter.cpp +117 -9
  11. data/.doc/ext/rays/point.cpp +1 -11
  12. data/.doc/ext/rays/polygon.cpp +133 -97
  13. data/.doc/ext/rays/polyline.cpp +89 -10
  14. data/.doc/ext/rays/rays.cpp +80 -0
  15. data/.doc/ext/rays/{noise.cpp → util.cpp} +2 -2
  16. data/ChangeLog.md +46 -0
  17. data/VERSION +1 -1
  18. data/ext/rays/bitmap.cpp +288 -46
  19. data/ext/rays/camera.cpp +2 -2
  20. data/ext/rays/color.cpp +13 -1
  21. data/ext/rays/defs.cpp +32 -8
  22. data/ext/rays/defs.h +56 -3
  23. data/ext/rays/font.cpp +56 -4
  24. data/ext/rays/image.cpp +3 -3
  25. data/ext/rays/matrix.cpp +69 -7
  26. data/ext/rays/native.cpp +2 -4
  27. data/ext/rays/painter.cpp +132 -13
  28. data/ext/rays/point.cpp +1 -12
  29. data/ext/rays/polygon.cpp +136 -99
  30. data/ext/rays/polyline.cpp +95 -9
  31. data/ext/rays/rays.cpp +80 -0
  32. data/ext/rays/{noise.cpp → util.cpp} +2 -2
  33. data/include/rays/color.h +3 -1
  34. data/include/rays/defs.h +24 -26
  35. data/include/rays/font.h +17 -3
  36. data/include/rays/image.h +1 -1
  37. data/include/rays/matrix.h +24 -0
  38. data/include/rays/painter.h +24 -0
  39. data/include/rays/polygon.h +68 -43
  40. data/include/rays/polyline.h +17 -2
  41. data/include/rays/ruby/polygon.h +0 -11
  42. data/include/rays/ruby/rays.h +4 -0
  43. data/include/rays/{noise.h → util.h} +2 -2
  44. data/lib/rays/color.rb +7 -1
  45. data/lib/rays/font.rb +1 -1
  46. data/lib/rays/image.rb +11 -1
  47. data/lib/rays/matrix.rb +16 -0
  48. data/lib/rays/painter.rb +18 -7
  49. data/lib/rays/point.rb +5 -1
  50. data/lib/rays/polygon.rb +44 -35
  51. data/lib/rays/polyline.rb +54 -8
  52. data/lib/rays.rb +0 -1
  53. data/rays.gemspec +2 -2
  54. data/src/color.cpp +11 -2
  55. data/src/font.cpp +37 -18
  56. data/src/font.h +6 -5
  57. data/src/image.cpp +58 -14
  58. data/src/ios/font.mm +89 -32
  59. data/src/ios/helper.h +2 -2
  60. data/src/ios/helper.mm +2 -2
  61. data/src/matrix.cpp +45 -0
  62. data/src/osx/font.mm +93 -33
  63. data/src/osx/helper.h +2 -2
  64. data/src/osx/helper.mm +2 -2
  65. data/src/painter.cpp +246 -114
  66. data/src/painter.h +11 -3
  67. data/src/polygon.cpp +431 -332
  68. data/src/polyline.cpp +138 -27
  69. data/src/polyline.h +3 -5
  70. data/src/shader.cpp +36 -4
  71. data/src/shader.h +1 -1
  72. data/src/texture.cpp +23 -4
  73. data/src/texture.h +2 -0
  74. data/src/{noise.cpp → util.cpp} +1 -1
  75. data/src/win32/font.cpp +1 -1
  76. data/test/test_bitmap.rb +12 -5
  77. data/test/test_color.rb +25 -4
  78. data/test/test_font.rb +23 -2
  79. data/test/test_image.rb +44 -18
  80. data/test/test_matrix.rb +22 -0
  81. data/test/test_painter.rb +27 -0
  82. data/test/test_point.rb +1 -1
  83. data/test/test_polygon.rb +52 -45
  84. data/test/test_polyline.rb +191 -72
  85. metadata +12 -18
  86. data/.doc/ext/rays/polygon_line.cpp +0 -97
  87. data/ext/rays/polygon_line.cpp +0 -100
  88. data/lib/rays/polygon_line.rb +0 -33
  89. data/test/test_polygon_line.rb +0 -164
data/include/rays/defs.h CHANGED
@@ -23,32 +23,6 @@ namespace Rays
23
23
  typedef float coord;
24
24
 
25
25
 
26
- enum DrawMode
27
- {
28
-
29
- DRAW_POINTS = 0,
30
-
31
- DRAW_LINES,
32
-
33
- DRAW_LINE_STRIP,
34
-
35
- DRAW_TRIANGLES,
36
-
37
- DRAW_TRIANGLE_STRIP,
38
-
39
- DRAW_TRIANGLE_FAN,
40
-
41
- DRAW_QUADS,
42
-
43
- DRAW_QUAD_STRIP,
44
-
45
- DRAW_POLYGON,
46
-
47
- DRAW_MAX,
48
-
49
- };// DrawMode
50
-
51
-
52
26
  enum CapType
53
27
  {
54
28
 
@@ -108,6 +82,30 @@ namespace Rays
108
82
  };// BlendMode
109
83
 
110
84
 
85
+ enum TexCoordMode
86
+ {
87
+
88
+ TEXCOORD_IMAGE = 0,
89
+
90
+ TEXCOORD_NORMAL,
91
+
92
+ TEXCOORD_MODE_MAX
93
+
94
+ };// TexCoordMode
95
+
96
+
97
+ enum TexCoordWrap
98
+ {
99
+
100
+ TEXCOORD_CLAMP = 0,
101
+
102
+ TEXCOORD_REPEAT,
103
+
104
+ TEXCOORD_WRAP_MAX
105
+
106
+ };// TexCoordWrap
107
+
108
+
111
109
  }// Rays
112
110
 
113
111
 
data/include/rays/font.h CHANGED
@@ -4,6 +4,8 @@
4
4
  #define __RAYS_FONT_H__
5
5
 
6
6
 
7
+ #include <vector>
8
+ #include <map>
7
9
  #include <xot/pimpl.h>
8
10
  #include <rays/defs.h>
9
11
 
@@ -17,15 +19,21 @@ namespace Rays
17
19
 
18
20
  public:
19
21
 
22
+ enum {DEFAULT_SIZE = 12};
23
+
20
24
  Font ();
21
25
 
22
- Font (const char* name, coord size = 0);
26
+ Font (const char* name, coord size = DEFAULT_SIZE);
23
27
 
24
28
  ~Font ();
25
29
 
30
+ Font dup () const;
31
+
26
32
  String name () const;
27
33
 
28
- coord size () const;
34
+ void set_size (coord size);
35
+
36
+ coord size () const;
29
37
 
30
38
  coord get_width (const char* str) const;
31
39
 
@@ -45,7 +53,13 @@ namespace Rays
45
53
  };// Font
46
54
 
47
55
 
48
- const Font& default_font ();
56
+ typedef std::map<String, std::vector<String>> FontFamilyMap;
57
+
58
+ const FontFamilyMap& get_font_families ();
59
+
60
+ Font load_font (const char* path, coord size = Font::DEFAULT_SIZE);
61
+
62
+ const Font& get_default_font ();
49
63
 
50
64
 
51
65
  }// Rays
data/include/rays/image.h CHANGED
@@ -47,7 +47,7 @@ namespace Rays
47
47
 
48
48
  Painter painter ();
49
49
 
50
- Bitmap& bitmap ();
50
+ Bitmap& bitmap (bool modify = false);
51
51
 
52
52
  const Bitmap& bitmap () const;
53
53
 
@@ -57,6 +57,8 @@ namespace Rays
57
57
 
58
58
  This& reset (const coord* elements, size_t size);
59
59
 
60
+ This& transpose ();
61
+
60
62
  This& translate (coord x, coord y, coord z = 0);
61
63
 
62
64
  This& translate (const Coord3& translate);
@@ -92,6 +94,28 @@ namespace Rays
92
94
  };// Matrix
93
95
 
94
96
 
97
+ Matrix ortho (
98
+ coord left, coord right,
99
+ coord top, coord bottom);
100
+
101
+ Matrix ortho (
102
+ coord left, coord right,
103
+ coord top, coord bottom,
104
+ coord near, coord far);
105
+
106
+ Matrix perspective (float fov_y, float aspect_ratio, coord near, coord far);
107
+
108
+ Matrix look_at (
109
+ coord eye_x, coord eye_y, coord eye_z,
110
+ coord target_x, coord target_y, coord target_z,
111
+ coord up_x = 0, coord up_y = 1, coord up_z = 0);
112
+
113
+ Matrix look_at (
114
+ const Point& eye,
115
+ const Point& target,
116
+ const Point& up = Point(0, 1, 0));
117
+
118
+
95
119
  }// Rays
96
120
 
97
121
 
@@ -77,6 +77,12 @@ namespace Rays
77
77
  void polygon (
78
78
  const Polygon& polygon, const Bounds& bounds);
79
79
 
80
+ void point (coord x, coord y);
81
+
82
+ void point (const Point& point);
83
+
84
+ void points (const Point* points, size_t size);
85
+
80
86
  void line (coord x1, coord y1, coord x2, coord y2);
81
87
 
82
88
  void line (const Point& p1, const Point& p2);
@@ -235,6 +241,10 @@ namespace Rays
235
241
 
236
242
  uint nsegment () const;
237
243
 
244
+ void set_line_height (coord height);
245
+
246
+ coord line_height (bool raw = false) const;
247
+
238
248
  void set_blend_mode (BlendMode mode);
239
249
 
240
250
  BlendMode blend_mode () const;
@@ -253,6 +263,20 @@ namespace Rays
253
263
 
254
264
  const Font& font () const;
255
265
 
266
+ void set_texture (const Image& image);
267
+
268
+ void no_texture ();
269
+
270
+ const Image& texture () const;
271
+
272
+ void set_texcoord_mode (TexCoordMode mode);
273
+
274
+ TexCoordMode texcoord_mode () const;
275
+
276
+ void set_texcoord_wrap (TexCoordWrap wrap);
277
+
278
+ TexCoordWrap texcoord_wrap () const;
279
+
256
280
  void set_shader (const Shader& shader);
257
281
 
258
282
  void no_shader ();
@@ -20,50 +20,19 @@ namespace Rays
20
20
 
21
21
  public:
22
22
 
23
- struct Line : public Polyline
24
- {
23
+ typedef std::vector<Polyline> PolylineList;
25
24
 
26
- typedef Polyline Super;
27
-
28
- public:
29
-
30
- Line ();
31
-
32
- Line (
33
- const Point* points, size_t size,
34
- bool loop = true,
35
- bool hole = false);
36
-
37
- Line (const Polyline& polyline, bool hole = false);
38
-
39
- bool hole () const;
40
-
41
- operator bool () const;
42
-
43
- bool operator ! () const;
44
-
45
- private:
46
-
47
- bool hole_;
48
-
49
- };// Line
50
-
51
- typedef std::vector<Line> LineList;
52
-
53
- typedef LineList::const_iterator const_iterator;
25
+ typedef PolylineList::const_iterator const_iterator;
54
26
 
55
27
  Polygon ();
56
28
 
57
29
  Polygon (
58
- const Point* points, size_t size, bool loop = true);
59
-
60
- Polygon (
61
- DrawMode mode,
62
- const Point* points, size_t size, bool loop = true);
30
+ const Point* points, size_t size, bool loop = true,
31
+ const Color* colors = NULL, const Coord3* texcoords = NULL);
63
32
 
64
33
  Polygon (const Polyline& polyline);
65
34
 
66
- Polygon (const Line* lines, size_t size);
35
+ Polygon (const Polyline* polylines, size_t size);
67
36
 
68
37
  ~Polygon ();
69
38
 
@@ -84,12 +53,14 @@ namespace Rays
84
53
 
85
54
  const_iterator end () const;
86
55
 
87
- const Line& operator [] (size_t index) const;
56
+ const Polyline& operator [] (size_t index) const;
88
57
 
89
58
  operator bool () const;
90
59
 
91
60
  bool operator ! () const;
92
61
 
62
+ friend Polygon operator + (const Polygon& lhs, const Polyline& rhs);
63
+
93
64
  friend Polygon operator + (const Polygon& lhs, const Polygon& rhs);
94
65
 
95
66
  friend Polygon operator - (const Polygon& lhs, const Polygon& rhs);
@@ -115,6 +86,13 @@ namespace Rays
115
86
  };// Polygon
116
87
 
117
88
 
89
+ Polygon create_point (coord x, coord y);
90
+
91
+ Polygon create_point (const Point& point);
92
+
93
+ Polygon create_points (const Point* points, size_t size);
94
+
95
+
118
96
  Polygon create_line (coord x1, coord y1, coord x2, coord y2);
119
97
 
120
98
  Polygon create_line (const Point& p1, const Point& p2);
@@ -123,6 +101,29 @@ namespace Rays
123
101
 
124
102
  Polygon create_line (const Polyline& polyline);
125
103
 
104
+ Polygon create_lines (const Point* points, size_t size);
105
+
106
+
107
+ Polygon create_triangle (
108
+ coord x1, coord y1, coord x2, coord y2, coord x3, coord y3,
109
+ bool loop = true);
110
+
111
+ Polygon create_triangle (
112
+ const Point& p1, const Point& p2, const Point& p3,
113
+ bool loop = true);
114
+
115
+ Polygon create_triangles (
116
+ const Point* points, size_t size, bool loop = true,
117
+ const Color* colors = NULL, const Coord3* texcoords = NULL);
118
+
119
+ Polygon create_triangle_strip (
120
+ const Point* points, size_t size,
121
+ const Color* colors = NULL, const Coord3* texcoords = NULL);
122
+
123
+ Polygon create_triangle_fan (
124
+ const Point* points, size_t size,
125
+ const Color* colors = NULL, const Coord3* texcoords = NULL);
126
+
126
127
 
127
128
  Polygon create_rect (
128
129
  coord x, coord y, coord width, coord height,
@@ -147,6 +148,24 @@ namespace Rays
147
148
  uint nsegment = 0);
148
149
 
149
150
 
151
+ Polygon create_quad (
152
+ coord x1, coord y1, coord x2, coord y2,
153
+ coord x3, coord y3, coord x4, coord y4,
154
+ bool loop = true);
155
+
156
+ Polygon create_quad (
157
+ const Point& p1, const Point& p2, const Point& p3, const Point& p4,
158
+ bool loop = true);
159
+
160
+ Polygon create_quads (
161
+ const Point* points, size_t size, bool loop = true,
162
+ const Color* colors = NULL, const Coord3* texcoords = NULL);
163
+
164
+ Polygon create_quad_strip (
165
+ const Point* points, size_t size,
166
+ const Color* colors = NULL, const Coord3* texcoords = NULL);
167
+
168
+
150
169
  Polygon create_ellipse (
151
170
  coord x, coord y, coord width, coord height = 0,
152
171
  const Point& hole_size = 0,
@@ -172,29 +191,35 @@ namespace Rays
172
191
  Polygon create_curve (
173
192
  coord x1, coord y1, coord x2, coord y2,
174
193
  coord x3, coord y3, coord x4, coord y4,
175
- bool loop = false);
194
+ bool loop = false,
195
+ uint nsegment = 0);
176
196
 
177
197
  Polygon create_curve (
178
198
  const Point& p1, const Point& p2, const Point& p3, const Point& p4,
179
- bool loop = false);
199
+ bool loop = false,
200
+ uint nsegment = 0);
180
201
 
181
202
  Polygon create_curve (
182
203
  const Point* points, size_t size,
183
- bool loop = false);
204
+ bool loop = false,
205
+ uint nsegment = 0);
184
206
 
185
207
 
186
208
  Polygon create_bezier (
187
209
  coord x1, coord y1, coord x2, coord y2,
188
210
  coord x3, coord y3, coord x4, coord y4,
189
- bool loop = false);
211
+ bool loop = false,
212
+ uint nsegment = 0);
190
213
 
191
214
  Polygon create_bezier (
192
215
  const Point& p1, const Point& p2, const Point& p3, const Point& p4,
193
- bool loop = false);
216
+ bool loop = false,
217
+ uint nsegment = 0);
194
218
 
195
219
  Polygon create_bezier (
196
220
  const Point* points, size_t size,
197
- bool loop = false);
221
+ bool loop = false,
222
+ uint nsegment = 0);
198
223
 
199
224
 
200
225
  }// Rays
@@ -15,6 +15,7 @@ namespace Rays
15
15
  {
16
16
 
17
17
 
18
+ struct Color;
18
19
  class Polygon;
19
20
 
20
21
 
@@ -29,9 +30,15 @@ namespace Rays
29
30
 
30
31
  Polyline ();
31
32
 
32
- Polyline (const Point* points, size_t size, bool loop = false);
33
+ Polyline (
34
+ const Point* points, size_t size, bool loop = false,
35
+ const Color* colors = NULL, const Coord3* texcoords = NULL,
36
+ bool hole = false);
33
37
 
34
- Polyline (const Point* points, size_t size, bool loop, bool fill);
38
+ Polyline (
39
+ const Point* points, size_t size, bool loop, bool fill,
40
+ const Color* colors = NULL, const Coord3* texcoords = NULL,
41
+ bool hole = false);
35
42
 
36
43
  ~Polyline ();
37
44
 
@@ -48,6 +55,14 @@ namespace Rays
48
55
 
49
56
  bool fill () const;
50
57
 
58
+ bool hole () const;
59
+
60
+ const Point* points () const;
61
+
62
+ const Color* colors () const;
63
+
64
+ const Coord3* texcoords () const;
65
+
51
66
  size_t size () const;
52
67
 
53
68
  bool empty () const;
@@ -11,8 +11,6 @@
11
11
 
12
12
  RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::Polygon)
13
13
 
14
- RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::Polygon::Line)
15
-
16
14
 
17
15
  namespace Rays
18
16
  {
@@ -21,9 +19,6 @@ namespace Rays
21
19
  Rucy::Class polygon_class ();
22
20
  // class Rays::Polygon
23
21
 
24
- Rucy::Class polygon_line_class ();
25
- // class Rays::Polygon::Line
26
-
27
22
 
28
23
  }// Rays
29
24
 
@@ -38,12 +33,6 @@ namespace Rucy
38
33
  return Rays::polygon_class();
39
34
  }
40
35
 
41
- template <> inline Class
42
- get_ruby_class<Rays::Polygon::Line> ()
43
- {
44
- return Rays::polygon_line_class();
45
- }
46
-
47
36
 
48
37
  }// Rucy
49
38
 
@@ -15,6 +15,10 @@ RUCY_DECLARE_CONVERT_TO(Rays::JoinType)
15
15
 
16
16
  RUCY_DECLARE_CONVERT_TO(Rays::BlendMode)
17
17
 
18
+ RUCY_DECLARE_CONVERT_TO(Rays::TexCoordMode)
19
+
20
+ RUCY_DECLARE_CONVERT_TO(Rays::TexCoordWrap)
21
+
18
22
 
19
23
  namespace Rays
20
24
  {
@@ -1,7 +1,7 @@
1
1
  // -*- c++ -*-
2
2
  #pragma once
3
- #ifndef __RAYS_NOISE_H__
4
- #define __RAYS_NOISE_H__
3
+ #ifndef __RAYS_UTIL_H__
4
+ #define __RAYS_UTIL_H__
5
5
 
6
6
 
7
7
  #include <rays/defs.h>
data/lib/rays/color.rb CHANGED
@@ -21,6 +21,8 @@ module Rays
21
21
  alias a= alpha=
22
22
  alias a alpha
23
23
 
24
+ alias to_hsb to_hsv
25
+
24
26
  def opaque?()
25
27
  alpha >= 1
26
28
  end
@@ -82,7 +84,11 @@ module Rays
82
84
  end
83
85
 
84
86
  def inspect()
85
- "#<#{self.class.name} #{to_s}>"
87
+ "#<#{self.class.name} #{to_a.join ' '}>"
88
+ end
89
+
90
+ class << self
91
+ alias hsb hsv
86
92
  end
87
93
 
88
94
  end# Color
data/lib/rays/font.rb CHANGED
@@ -17,7 +17,7 @@ module Rays
17
17
  end
18
18
 
19
19
  def inspect()
20
- "#<Rays::Font name=#{name}, size=#{size}>"
20
+ "#<Rays::Font name='#{name}', size=#{size}>"
21
21
  end
22
22
 
23
23
  end# Font
data/lib/rays/image.rb CHANGED
@@ -9,7 +9,9 @@ module Rays
9
9
 
10
10
  extend Forwardable
11
11
 
12
- def_delegators :bitmap, :[], :[]=
12
+ def_delegators :bitmap, :pixels, :[]
13
+
14
+ def_delegators :bitmap_for_write, :pixels=, :[]=
13
15
 
14
16
  def paint(&block)
15
17
  painter.paint self, &block
@@ -24,6 +26,14 @@ module Rays
24
26
  Bounds.new 0, 0, width, height
25
27
  end
26
28
 
29
+ def bitmap(modify = false)
30
+ get_bitmap modify
31
+ end
32
+
33
+ private def bitmap_for_write()
34
+ get_bitmap true
35
+ end
36
+
27
37
  end# Image
28
38
 
29
39
 
data/lib/rays/matrix.rb CHANGED
@@ -9,6 +9,22 @@ module Rays
9
9
  include Comparable
10
10
  include Enumerable
11
11
 
12
+ def transpose()
13
+ dup.transpose!
14
+ end
15
+
16
+ def translate(*args)
17
+ dup.translate!(*args)
18
+ end
19
+
20
+ def scale(*args)
21
+ dup.scale!(*args)
22
+ end
23
+
24
+ def rotate(*args)
25
+ dup.rotate!(*args)
26
+ end
27
+
12
28
  def each(&block)
13
29
  to_a.each(&block)
14
30
  end
data/lib/rays/painter.rb CHANGED
@@ -57,26 +57,26 @@ module Rays
57
57
 
58
58
  def line(*args, loop: false)
59
59
  if args.first.kind_of?(Polyline)
60
- draw_polyline args.first
60
+ polyline! args.first
61
61
  else
62
- draw_line args, loop
62
+ line! args, loop
63
63
  end
64
64
  end
65
65
 
66
66
  def rect(*args, round: nil, lt: nil, rt: nil, lb: nil, rb: nil)
67
- draw_rect args, round, lt, rt, lb, rb
67
+ rect! args, round, lt, rt, lb, rb
68
68
  end
69
69
 
70
70
  def ellipse(*args, center: nil, radius: nil, hole: nil, from: nil, to: nil)
71
- draw_ellipse args, center, radius, hole, from, to
71
+ ellipse! args, center, radius, hole, from, to
72
72
  end
73
73
 
74
74
  def curve(*args, loop: false)
75
- draw_curve args, loop
75
+ curve! args, loop
76
76
  end
77
77
 
78
78
  def bezier(*args, loop: false)
79
- draw_bezier args, loop
79
+ bezier! args, loop
80
80
  end
81
81
 
82
82
  def color=(fill, stroke = nil)
@@ -118,9 +118,20 @@ module Rays
118
118
  replace: BLEND_REPLACE
119
119
  }
120
120
 
121
+ const_symbol_accessor :texcoord_mode, **{
122
+ image: TEXCOORD_IMAGE,
123
+ normal: TEXCOORD_NORMAL
124
+ }
125
+
126
+ const_symbol_accessor :texcoord_wrap, **{
127
+ clamp: TEXCOORD_CLAMP,
128
+ repeat: TEXCOORD_REPEAT
129
+ }
130
+
121
131
  universal_accessor :background, :fill, :stroke, :color,
122
132
  :stroke_width, :stroke_outset, :stroke_cap, :stroke_join, :miter_limit,
123
- :nsegment, :blend_mode, :shader, :clip, :font
133
+ :nsegment, :line_height, :blend_mode, :clip, :font,
134
+ :texture, :texcoord_mode, :texcoord_wrap, :shader
124
135
 
125
136
  private
126
137
 
data/lib/rays/point.rb CHANGED
@@ -17,6 +17,10 @@ module Rays
17
17
  dup.move_by!(*args)
18
18
  end
19
19
 
20
+ def rotate(degree)
21
+ dup.rotate!(degree)
22
+ end
23
+
20
24
  def zero?()
21
25
  length == 0
22
26
  end
@@ -47,7 +51,7 @@ module Rays
47
51
  end
48
52
 
49
53
  def inspect()
50
- "#<Rays::Point #{to_a(3).join ', '}>"
54
+ "#<Rays::Point #{to_a(3).join ' '}>"
51
55
  end
52
56
 
53
57
  end# Point