Class: Chem::CDX::CDXPoint2D

Inherits:
Object
  • Object
show all
Defined in:
lib/chem/db/cdx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ CDXPoint2D

Returns a new instance of CDXPoint2D.



569
570
571
# File 'lib/chem/db/cdx.rb', line 569

def initialize x, y
  @x, @y = x.to_f, y.to_f
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



567
568
569
# File 'lib/chem/db/cdx.rb', line 567

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



567
568
569
# File 'lib/chem/db/cdx.rb', line 567

def y
  @y
end

Instance Method Details

#to_binObject



573
# File 'lib/chem/db/cdx.rb', line 573

def to_bin ; [@y, @x].pack('V2') ; end

#to_xmlObject



575
576
577
# File 'lib/chem/db/cdx.rb', line 575

def to_xml
  "%.2f %.2f" % [@x / 65536, @y / 65536]
end