5 ^super.newCopyArgs(rho, theta)
13 real { ^rho * cos(theta) }
14 imag { ^rho * sin(theta) }
17 asComplex { ^Complex.new(this.real, this.imag) }
18 asPoint { ^Point.new(this.real, this.imag) }
21 ^Polar.new(rho * scale, theta)
23 rotate { arg angle; // in radians
24 ^Polar.new(rho, theta + angle)
28 + { arg aNumber; ^this.asComplex + aNumber }
29 - { arg aNumber; ^this.asComplex - aNumber }
30 * { arg aNumber; ^this.asComplex * aNumber }
31 / { arg aNumber; ^this.asComplex / aNumber }
34 ^aPolar respondsTo: #[\rho, \theta] and: {
35 rho == aPolar.rho and: { theta == aPolar.theta }
40 ^rho.hash bitXor: theta.hash
43 neg { ^Polar.new(rho, theta + pi) }
45 performBinaryOpOnSomething { |aSelector, thing, adverb|
46 ^thing.asComplex.perform(aSelector, this, adverb)
49 performBinaryOpOnUGen { arg aSelector, aUGen;
51 BinaryOpUGen.new(aSelector, aUGen, this.real),
52 BinaryOpUGen.new(aSelector, aUGen, this.imag)
57 stream << "Polar( " << rho << ", " << theta << " )";
59 storeArgs { ^[rho,theta] }