Sha256: 8c4dd5719f7c669900c7004695a492999cea9cf2b5c33b67077dd6b8f9ae35f0

Contents?: true

Size: 430 Bytes

Versions: 1

Compression:

Stored size: 430 Bytes

Contents

# encoding: utf-8


module GSS

  class PolarPoint
    attr_reader :r, :theta, :phi

    def initialize(r, theta, phi)
      @r = r
      @theta = theta
      @phi = phi
    end

    def to_cartesian
      x = @r * Math.sin(@theta) * Math.cos(@phi)
      y = @r * Math.sin(@theta) * Math.sin(@phi)
      z = @r * Math.cos(@theta)
      [x, y, z]
    end
  end   # of class PolarPoint

end   # of module GSS

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gss_generator-0.1.0 lib/gss/polar_point.rb