Sha256: d535aff96f89139a12b7f190242b5f79ec10d77fa05c23700edb8bac9e3fad02

Contents?: true

Size: 774 Bytes

Versions: 5

Compression:

Stored size: 774 Bytes

Contents

require 'forwardable'

module Geom
  class Vertex
    attr_accessor(:position,:normal)
    extend Forwardable
    def_delegators(:@position,
      :x, :y, :z, :x=, :y=, :z=,
      :distance_x, :distance_y, :distance_z, :distance, :to_floats)
    def initialize(x=0.0,y=0.0,z=0.0,normal=nil)
      @position = Number3D.new(x,y,z)
      @normal = normal
    end

    def == (other)
      @position == other.position
    end

    def equal?(other,snap)
      @position.x-snap < other.x && @position.x+snap > other.x &&
      @position.y-snap < other.y && @position.y+snap > other.y &&
      @position.z-snap < other.z && @position.z+snap > other.z
    end

    def clone
      Vertex.new(x,y,z)
    end

    def to_s
      "#<Geom::Vertex:#{@position.to_s}>"
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
floorplanner-fml-0.2.1 lib/geom/vertex.rb
floorplanner-fml-0.2 lib/geom/vertex.rb
fml-0.2.3 lib/geom/vertex.rb
fml-0.2.2 lib/geom/vertex.rb
fml-0.2.1 lib/geom/vertex.rb