Class: Ra::Pattern::Checkers

Inherits:
Base
  • Object
show all
Defined in:
lib/ra/pattern/checkers.rb

Overview

A checkers pattern that alternates colors using:

colors[⌊√(point.x² + point.z²)⌋]

Instance Attribute Summary collapse

Attributes inherited from Base

#transform

Instance Method Summary collapse

Methods inherited from Base

#color

Constructor Details

#initialize(colors:, transform: Transform::IDENTITY) ⇒ Checkers

Returns a new instance of Checkers.

Parameters:

  • colors (Array<Ra::Color>)
  • transform (Ra::Matrix) (defaults to: Transform::IDENTITY)


13
14
15
16
# File 'lib/ra/pattern/checkers.rb', line 13

def initialize(colors:, transform: Transform::IDENTITY)
  super(transform:)
  @colors = colors
end

Instance Attribute Details

#colorsObject

Returns the value of attribute colors.



9
10
11
# File 'lib/ra/pattern/checkers.rb', line 9

def colors
  @colors
end