Sha256: 0066354baba1c42873a3f25dc049f714cc3b6872fe35fcce76f7317c53e387fe

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 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|Symbol]
      # @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|Symbol]
      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

10 entries across 10 versions & 1 rubygems

Version Path
vedeu-0.6.30 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.29 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.28 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.27 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.26 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.25 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.24 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.23 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.22 lib/vedeu/geometry/coordinate.rb
vedeu-0.6.21 lib/vedeu/geometry/coordinate.rb