Class: Osgb::Helmert
- Inherits:
-
Object
- Object
- Osgb::Helmert
- Defined in:
- lib/osgb/helmert.rb
Constant Summary collapse
- @@instances =
{}
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#rx ⇒ Object
Returns the value of attribute rx.
-
#ry ⇒ Object
Returns the value of attribute ry.
-
#rz ⇒ Object
Returns the value of attribute rz.
-
#s ⇒ Object
Returns the value of attribute s.
-
#tx ⇒ Object
Returns the value of attribute tx.
-
#ty ⇒ Object
Returns the value of attribute ty.
-
#tz ⇒ Object
Returns the value of attribute tz.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, attributes) ⇒ Helmert
constructor
A new instance of Helmert.
- #s1 ⇒ Object
- #transform(x, y, z) ⇒ Object
Constructor Details
#initialize(name, attributes) ⇒ Helmert
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/osgb/helmert.rb', line 6 def initialize(name, attributes) @name = name @tx = attributes[:tx] @ty = attributes[:ty] @tz = attributes[:tz] @rx = (attributes[:rx]/3600).to_radians @ry = (attributes[:ry]/3600).to_radians @rz = (attributes[:rz]/3600).to_radians @s = attributes[:s] @@instances[name] = self end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def name @name end |
#rx ⇒ Object
Returns the value of attribute rx.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def rx @rx end |
#ry ⇒ Object
Returns the value of attribute ry.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def ry @ry end |
#rz ⇒ Object
Returns the value of attribute rz.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def rz @rz end |
#s ⇒ Object
Returns the value of attribute s.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def s @s end |
#tx ⇒ Object
Returns the value of attribute tx.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def tx @tx end |
#ty ⇒ Object
Returns the value of attribute ty.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def ty @ty end |
#tz ⇒ Object
Returns the value of attribute tz.
3 4 5 |
# File 'lib/osgb/helmert.rb', line 3 def tz @tz end |
Class Method Details
.[](name) ⇒ Object
29 30 31 |
# File 'lib/osgb/helmert.rb', line 29 def self.[](name) @@instances[name] end |
Instance Method Details
#s1 ⇒ Object
18 19 20 |
# File 'lib/osgb/helmert.rb', line 18 def s1 s/1e6 + 1 end |
#transform(x, y, z) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/osgb/helmert.rb', line 22 def transform(x,y,z) xp = tx + x*s1 - y*rz + z*ry yp = ty + x*rz + y*s1 - z*rx zp = tz - x*ry + y*rx + z*s1 [xp, yp, zp] end |