The Trunk: ST80-ct.240.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ST80-ct.240.mcz

commits-2
Marcel Taeumel uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-ct.240.mcz

==================== Summary ====================

Name: ST80-ct.240
Author: ct
Time: 21 September 2019, 5:13:06.268935 pm
UUID: e9dee0c1-7bf7-0148-9bc5-9cec67d37dae
Ancestors: ST80-mt.239

Refactor Arc display

Extract method for the purpose of reuse and improve readability. Also introduce a convenience constructor.

According to my tests with Arc example, the implementation also got a bit faster (before: 1.25/after: 1.14 ms/run).

=============== Diff against ST80-mt.239 ===============

Item was added:
+ ----- Method: Arc class>>center:radius:quadrant: (in category 'instance creation') -----
+ center: aPoint radius: anInteger quadrant: section
+
+ ^ self new
+ center: aPoint radius: anInteger quadrant: section;
+ yourself!

Item was added:
+ ----- Method: Arc>>computeVertices: (in category 'displaying') -----
+ computeVertices: size
+
+ | dAngle dSin dCos point |
+ dAngle := (90 / (size - 1)) degreesToRadians.
+ dSin := dAngle sin.
+ dCos := dAngle cos.
+ point := (1 to: quadrant)
+ inject: 0 @ radius
+ into: [:p :i | p leftRotated].
+ ^ (OrderedCollection new: size)
+ add: (center + point) rounded;
+ addAll: ((1 to: size - 1) collect: [:i |
+ point := point * dCos + (point * dSin) leftRotated.
+ (center + point) rounded]);
+ yourself!