Sha256: 9f1824d2c571972dee6005878fd9f608a4cf0352257087a054ffd70e33c8b449
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require_relative '../base_element' require_relative 'units_factory' module GridGenerator module Cubic class SquareFactory def initialize(x:, y:, width_unit:, height_unit:, offset_unit:, face:) @x, @y = x, y @width_unit = width_unit @height_unit = height_unit @offset_unit = offset_unit face_attr = FaceParser.new(face).parse @colour = face_attr && face_attr[:colour] @opacity = face_attr && face_attr[:opacity] end attr_reader :x, :y, :width_unit, :height_unit, :offset_unit, :colour, :opacity def top_left Matrix.column_vector([x, y]) + offset_unit end def top_right top_left + width_unit end def bottom_right top_left + width_unit + height_unit end def bottom_left top_left + height_unit end def points [ top_left, top_right, bottom_right, bottom_left, ] end def build GridGenerator::BaseElement.new(points: points, colour: colour, opacity: opacity) unless colour.nil? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grid_generator-0.1.5 | lib/grid_generator/cubic/square_factory.rb |