Class: Bio::PDB::Coordinate
- Inherits:
-
Vector
- Object
- Vector
- Bio::PDB::Coordinate
- Defined in:
- lib/bio/db/pdb/atom.rb
Overview
Bio::PDB::Coordinate is a class to store a 3D coordinate. It inherits Vector (in bundled library in Ruby).
Class Method Summary collapse
-
.[](x, y, z) ⇒ Object
same as Vector..
-
.elements(array, *a) ⇒ Object
same as Vector.elements.
Instance Method Summary collapse
-
#distance(object2) ⇒ Object
distance between object2.
-
#to_ary ⇒ Object
Implicit conversion to an array.
-
#x ⇒ Object
x.
-
#x=(n) ⇒ Object
x=(n).
-
#xyz ⇒ Object
returns self.
-
#y ⇒ Object
y.
-
#y=(n) ⇒ Object
y=(n).
-
#z ⇒ Object
z.
-
#z=(n) ⇒ Object
z=(n).
Class Method Details
.[](x, y, z) ⇒ Object
same as Vector.
33 34 35 |
# File 'lib/bio/db/pdb/atom.rb', line 33 def self.[](x,y,z) super end |
.elements(array, *a) ⇒ Object
same as Vector.elements
38 39 40 41 |
# File 'lib/bio/db/pdb/atom.rb', line 38 def self.elements(array, *a) raise 'Size of given array must be 3' if array.size != 3 super end |
Instance Method Details
#distance(object2) ⇒ Object
distance between object2.
70 71 72 73 |
# File 'lib/bio/db/pdb/atom.rb', line 70 def distance(object2) Utils::convert_to_xyz(object2) (self - object2).r end |
#to_ary ⇒ Object
Implicit conversion to an array.
Note that this method would be deprecated in the future.
– Definition of ‘to_ary’ means objects of the class is implicitly regarded as an array. ++
64 |
# File 'lib/bio/db/pdb/atom.rb', line 64 def to_ary; self.to_a; end |
#x ⇒ Object
x
44 |
# File 'lib/bio/db/pdb/atom.rb', line 44 def x; self[0]; end |
#x=(n) ⇒ Object
x=(n)
50 |
# File 'lib/bio/db/pdb/atom.rb', line 50 def x=(n); self[0]=n; end |
#xyz ⇒ Object
returns self.
67 |
# File 'lib/bio/db/pdb/atom.rb', line 67 def xyz; self; end |
#y ⇒ Object
y
46 |
# File 'lib/bio/db/pdb/atom.rb', line 46 def y; self[1]; end |
#y=(n) ⇒ Object
y=(n)
52 |
# File 'lib/bio/db/pdb/atom.rb', line 52 def y=(n); self[1]=n; end |
#z ⇒ Object
z
48 |
# File 'lib/bio/db/pdb/atom.rb', line 48 def z; self[2]; end |
#z=(n) ⇒ Object
z=(n)
54 |
# File 'lib/bio/db/pdb/atom.rb', line 54 def z=(n); self[2]=n; end |