Class: Ray::Polygon::Point
- Inherits:
-
Object
- Object
- Ray::Polygon::Point
- Includes:
- Ray::PP
- Defined in:
- lib/ray/polygon.rb
Overview
One of the points contained in a polygon.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#polygon ⇒ Object
readonly
Returns the value of attribute polygon.
Instance Method Summary collapse
-
#color ⇒ Color
Color of the point.
-
#color=(color) ⇒ Object
Sets the color of the point.
-
#initialize(polygon, id) ⇒ Point
constructor
A new instance of Point.
- #inspect ⇒ Object
-
#outline ⇒ Color
Outline color of the point.
-
#outline=(outline) ⇒ Object
Sets the outline color of the point.
-
#pos ⇒ Ray::Vector2
Position of the point.
-
#pos=(pos) ⇒ Object
Sets the position of the point.
- #pretty_print(q) ⇒ Object
Methods included from Ray::PP
Constructor Details
#initialize(polygon, id) ⇒ Point
Returns a new instance of Point.
9 10 11 |
# File 'lib/ray/polygon.rb', line 9 def initialize(polygon, id) @polygon, @id = polygon, id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
52 53 54 |
# File 'lib/ray/polygon.rb', line 52 def id @id end |
#polygon ⇒ Object (readonly)
Returns the value of attribute polygon.
52 53 54 |
# File 'lib/ray/polygon.rb', line 52 def polygon @polygon end |
Instance Method Details
#color ⇒ Color
Returns Color of the point.
19 20 21 |
# File 'lib/ray/polygon.rb', line 19 def color @polygon.color_of(@id) end |
#color=(color) ⇒ Object
Sets the color of the point
34 35 36 |
# File 'lib/ray/polygon.rb', line 34 def color=(color) @polygon.set_color_of(@id, color) end |
#inspect ⇒ Object
43 44 45 46 |
# File 'lib/ray/polygon.rb', line 43 def inspect "#<#{self.class} polygon=#{polygon} id=#{id} pos=#{pos} color=#{color} \ outline=#{outline}>" end |
#outline ⇒ Color
Returns Outline color of the point.
24 25 26 |
# File 'lib/ray/polygon.rb', line 24 def outline @polygon.outline_of(@id) end |
#outline=(outline) ⇒ Object
Sets the outline color of the point
39 40 41 |
# File 'lib/ray/polygon.rb', line 39 def outline=(outline) @polygon.set_outline_of(@id, outline) end |
#pos ⇒ Ray::Vector2
Returns Position of the point.
14 15 16 |
# File 'lib/ray/polygon.rb', line 14 def pos @polygon.pos_of(@id) end |
#pos=(pos) ⇒ Object
Sets the position of the point
29 30 31 |
# File 'lib/ray/polygon.rb', line 29 def pos=(pos) @polygon.set_pos_of(@id, pos) end |
#pretty_print(q) ⇒ Object
48 49 50 |
# File 'lib/ray/polygon.rb', line 48 def pretty_print(q) pretty_print_attributes q, ["pos", "color", "outline"] end |