5 ^super.newCopyArgs(x, y);
8 ^Rect.fromPoints(this, aPoint)
11 set { arg argX=0, argY=0; x = argX; y = argY; }
14 asComplex { ^Complex.new(x,y) }
15 asPolar { ^Polar.new(this.rho, this.theta) }
17 asRect { ^Rect.new(0,0,x,y) }
18 asArray { ^[this.x, this.y] }
21 ^aPoint respondsTo: #[\x, \y] and: { x == aPoint.x and: { y == aPoint.y } }
23 hash { ^ (x.hash << 1) bitXor: y.hash }
25 performBinaryOpOnSomething { |aSelector, thing, adverb|
26 ^thing.asPoint.perform(aSelector, this, adverb)
30 deltaPoint = delta.asPoint;
31 ^(this.x + deltaPoint.x) @ (this.y + deltaPoint.y)
35 deltaPoint = delta.asPoint;
36 ^(this.x - deltaPoint.x) @ (this.y - deltaPoint.y)
41 scalePoint = scale.asPoint;
42 ^(this.x * scalePoint.x) @ (this.y * scalePoint.y)
46 scalePoint = scale.asPoint;
47 ^(this.x / scalePoint.x) @ (this.y / scalePoint.y)
51 scalePoint = scale.asPoint;
52 ^(this.x div: scalePoint.x) @ (this.y div: scalePoint.y)
54 translate { arg delta;
55 ^(this.x + delta.x) @ (this.y + delta.y)
58 ^(this.x * scale.x) @ (this.y * scale.y)
60 rotate { arg angle; // in radians
64 ^((x * cosr) - (y * sinr)) @ ((y * cosr) + (x * sinr))
67 abs { ^x.abs @ y.abs }
70 theta { ^atan2(y, x) }
73 aPoint = aPoint.asPoint;
74 ^hypot(x - aPoint.x, y - aPoint.y)
79 quant = quant.asPoint;
80 ^x.round(quant.x) @ y.round(quant.y)
83 quant = quant.asPoint;
84 ^x.trunc(quant.x) @ y.trunc(quant.y)
89 thatPoint = that.asPoint;
90 ^(this.x mod: thatPoint.x) @ (this.y mod: thatPoint.y)
94 stream << this.class.name << "( " << x << ", " << y << " )";
103 ^super.new(Signal.new(n), Signal.new(n))
118 //Polygon : PointArray
122 //ZigZag : PointArray