-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNEWS
executable file
·107 lines (86 loc) · 4.05 KB
/
NEWS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
[This file functions as a development log.]
23 Dec 2010:
Polygons implemented -- commits 3966b977 to 286d5dce1
This took a lot of work because several inner details needed to be
cleaned up, for some reason.
Much future work to comtemplate. Next stop: shape transformations
(rotate, translate, scale, etc.). Then: think about Postscript as a
backend instead of (or in addition to) Cairo.
15 Apr 2010:
DSL implemented. Commit aefec471b956195 has many gory details, as
well as pointers for future work. The example code in the 19 Jan
entry below looks correct still. All the inbuilt shape
specifications can be seen in lib/rgeom/shapes/specs.rb
19 Jan 2010:
Finishing work on spec_label branch and merging it into master.
Labels work and provide basic encapsulation of labels like :ABC.
Specification replaces classes like Triangle::Data and so reduces
the amount of boilerplate code. Some of the things that have been
implemented in Specification (e.g. type checking) aren't used by
client code.
It's a while ago that I started this branch and I've been on holiday
in the meantime. I don't know if I implemented everything I had in
mind; I just wanted to tidy it up (all tests pass) and move on.
The next step is a DSL for specifying shapes to reduce boilerplate
code to an absolute minimum and enable the creation of new "shapes"
such as histograms. Example:
shape :circle, :label => :K,
:arguments => %{
radius: segment
diameter: segment
centre: point=origin, radius: length=1
centre: point=origin, diameter: length
}
datatype :segment,
:match => [
lambda { |o| o.is_a? Segment and o },
lambda { |o| o.symbol? and Segment[o] }
]
datatype :point, ...
datatype :length, ...
This achieves many things. It shows that a circle's label is only
one character. It lays out the possible argument combinations that
can be given to the "circle" command, and the types and default
values (if any). This will enable automatic checking: has a valid
set of arguments been given? Are they the right type? Casting will
be done automatically: if a segment is expected, then a real Segment
object can be given, or a symbol like :XY. It's pretty cool, but
implementing it won't be easy. The "arguments" spec is a string; I
need to parse it and generate the backroom classes and methods that
process, cast and validate the user's arguments so that the construc-
tion methods can do their work with a minimum of error-checking.
"dsl" branch will be created for this work.
23 Nov 2009:
[spec_label branch off c0994f4b]
Creating Specification class to simplify the collection and
verification of shape data, and Label to simplify working with
labels. Will retrofit all code to use these. Paused work on
Polygon to do this.
22 Nov 2009:
Implemented opt-in shape registration instead of opt-out.
Calling circle(...) used to mean that circle was added to the
register, and therefore rendered. But arcs need to create a circle
_without_ adding it to the register. A messy "deregistration"
approach was implemented before, with a view to changing it.
Now:
square(...) # square goes in register
_square(...) # square doesn't go in register
As part of this work [up to 0cbcac20], construction code was
rationalised, such that commands.rb reads much better than it used
to, and some cruft has been removed from the various shape classes.
21 Nov 2009:
Completed arcs and semicircles.
See Examples 2.04 Pythagoras's Theorem again
and 2.05 Radioactive sign
More work to do in future, perhaps (like Arc#radii), and a
refactoring such that Circle < Arc, but this is a good start.
[arc branch deleted]
17 Nov 2009:
Starting work on arcs and semicircles. [arc branch]
arc(:centre => p(5,2), :radius => 4, :angle => [35,91])
semicircle(:diameter => :AB)
arc(:radius => :AB, :angle => [10,15])
16 Nov 2009:
Completed square(), including square(:base => :XY) [57261b6a] and
square(:ABCD) [c3b31fc4b].
vim: ai tw=70