Class: Ray::Polygon::Point

Inherits:
Object
  • Object
show all
Includes:
Ray::PP
Defined in:
lib/ray/polygon.rb

Overview

One of the points contained in a polygon.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Ray::PP

#pretty_print_attributes

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

#idObject (readonly)

Returns the value of attribute id.



52
53
54
# File 'lib/ray/polygon.rb', line 52

def id
  @id
end

#polygonObject (readonly)

Returns the value of attribute polygon.



52
53
54
# File 'lib/ray/polygon.rb', line 52

def polygon
  @polygon
end

Instance Method Details

#colorColor

Returns Color of the point.

Returns:

  • (Color)

    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

#inspectObject



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

#outlineColor

Returns Outline color of the point.

Returns:

  • (Color)

    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

#posRay::Vector2

Returns Position of the point.

Returns:



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