Method: Bio::PDB::Utils.calculatePlane
- Defined in:
- lib/bio/db/pdb/utils.rb
.calculatePlane(coord1, coord2, coord3) ⇒ Object
calculates plane
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/bio/db/pdb/utils.rb', line 174 def calculatePlane(coord1, coord2, coord3) a = coord1.y * (coord2.z - coord3.z) + coord2.y * (coord3.z - coord1.z) + coord3.y * (coord1.z - coord2.z) b = coord1.z * (coord2.x - coord3.x) + coord2.z * (coord3.x - coord1.x) + coord3.z * (coord1.x - coord2.x) c = coord1.x * (coord2.y - coord3.y) + coord2.x * (coord3.y - coord1.y) + coord3.x * (coord1.y - coord2.y) d = -1 * ( (coord1.x * (coord2.y * coord3.z - coord3.y * coord2.z)) + (coord2.x * (coord3.y * coord1.z - coord1.y * coord3.z)) + (coord3.x * (coord1.y * coord2.z - coord2.y * coord1.z)) ) return [a,b,c,d] end |