Sha256: 30af7d889197be8413f0b308a716082a082b639e0752f08ef71ae93b6660d13e

Contents?: true

Size: 1.69 KB

Versions: 8

Compression:

Stored size: 1.69 KB

Contents

module Vedeu

  module Geometry

    # Crudely corrects out of range values.
    #
    class Coordinate

      extend Forwardable

      def_delegators :x,
                     :x_position,
                     :xn

      def_delegators :y,
                     :y_position,
                     :yn

      # Returns a new instance of Vedeu::Geometry::Coordinate.
      #
      # @param name [String]
      # @param oy [Fixnum]
      # @param ox [Fixnum]
      # @return [Vedeu::Geometry::Coordinate]
      def initialize(name, oy, ox)
        @name = name
        @ox   = ox
        @oy   = oy
      end

      protected

      # @!attribute [r] name
      # @return [String]
      attr_reader :name

      # @!attribute [rw] ox
      # @return [Fixnum]
      attr_accessor :ox

      # @!attribute [rw] oy
      # @return [Fixnum]
      attr_accessor :oy

      private

      # Provide an instance of Vedeu::Geometry::GenericCoordinate to determine
      # correct x related coordinates.
      #
      # @return [Vedeu::Geometry::GenericCoordinate]
      def x
        @x ||= Vedeu::Geometry::GenericCoordinate.new(name:   name,
                                                      offset: ox,
                                                      type:   :x)
      end

      # Provide an instance of Vedeu::Geometry::GenericCoordinate to determine
      # correct y related coordinates.
      #
      # @return [Vedeu::Geometry::GenericCoordinate]
      def y
        @y ||= Vedeu::Geometry::GenericCoordinate.new(name:   name,
                                                      offset: oy,
                                                      type:   :y)
      end

    end # Coordinate

  end # Geometry

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.6.12 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.11 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.10 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.9 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.8 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.7 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.6 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.5 lib/vedeu/geometry/coordinate.rb