Class: Bullseye

Inherits:
Figure show all
Defined in:
lib/sitac_objects.rb

Overview

Represents a bull’s eye, given its characteristics (center, radii, nbr of rings, distance between rings) @see: server.3rd-wing.net/public/Galevsky/Utilisation%20Bullseye.pdf

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SITACObjects

#as_point

Constructor Details

#initialize(name, center, hradius, vradius, rings, ring_distance) ⇒ Bullseye

Returns a new instance of Bullseye.

Parameters:

  • name (String)

    the name of the bull’s eye

  • center (Point, Array)

    the center of the bull’s eye

  • hradius (Float)

    the horizontal radius of the bull’s eye

  • vradius (Float)

    the vertical radius of the bull’s eye

  • rings (Integer)

    the number of rings of the bull’s eye

  • ring_distance (Float)

    the distance between rings of the bull’s eye



107
108
109
110
111
112
113
114
115
# File 'lib/sitac_objects.rb', line 107

def initialize(name, center, hradius, vradius, rings, ring_distance)
  super
  @name = name
  @center = as_point(center)
  @hradius = hradius / 2
  @vradius = vradius / 2
  @rings = rings
  @ring_distance = ring_distance
end

Instance Attribute Details

#centerObject (readonly)

Returns the value of attribute center.



99
100
101
# File 'lib/sitac_objects.rb', line 99

def center
  @center
end

#hradiusObject (readonly)

Returns the value of attribute hradius.



99
100
101
# File 'lib/sitac_objects.rb', line 99

def hradius
  @hradius
end

#nameObject (readonly)

Returns the value of attribute name.



99
100
101
# File 'lib/sitac_objects.rb', line 99

def name
  @name
end

#ring_distanceObject (readonly)

Returns the value of attribute ring_distance.



99
100
101
# File 'lib/sitac_objects.rb', line 99

def ring_distance
  @ring_distance
end

#ringsObject (readonly)

Returns the value of attribute rings.



99
100
101
# File 'lib/sitac_objects.rb', line 99

def rings
  @rings
end

#vradiusObject (readonly)

Returns the value of attribute vradius.



99
100
101
# File 'lib/sitac_objects.rb', line 99

def vradius
  @vradius
end

Instance Method Details

#accept(visitor) ⇒ Object



117
118
119
# File 'lib/sitac_objects.rb', line 117

def accept(visitor)
  visitor.visit_bullseye self
end