Eutoshape commands in 1456 object code.

William Overington

Copyright 2001 William Overington

I have been fascinated when using the Microsoft PowerPoint package with the availability of Autoshapes and the way that some of them have one or more adjustment handles so that one may easily produce on the screen shapes such as polygons, stars and various other shapes. I began to think that it would be nice if 1456 programmers could have similar facilities available as standard features within the eutodraw system. Yet what would I call them? Microsoft Corporation uses the word Autoshape and I felt that I should acknowledge the source of my idea. However, it may be that Autoshape is a proprietary word and that I should not use it within the 1456 object code system unless I were to seek and obtain specific permission from Microsoft Corporation to do so. However, I also thought that the shapes in the shape drawing system that I am using, though inspired by the Autoshapes of PowerPoint are fundamentally different in that they are generated by software commands with numerical parameters encoded at the occasion of programming rather than by mouse operations at the occasion of designing. I sought a specific name for these shapes. With hindsight it took a quite long time to devise the name eutoshapes.

In adding eutoshapes to the 1456 object code system I have taken into consideration the factor that 1456 object code must balance having on the one hand a comprehensive set of facilities such that it is not regardable as being highly limited in its application capabilities: on the other hand being not so large that it becomes unreasonable for some other person or persons who wish to do so to write their own version of a 1456 engine that implements the 1456 object code specification.

This factor has led me to add facilities to easily draw regular polygons and stars and a method for other shapes, yet not to include long lists of other shapes. Please bear in mind that many shapes can be produced using a combination of other shapes.

demo24.htm

The demonstration program shows the shapes used as examples in this document.


A regular polygon is drawn using action code 23. A filled regular polygon is drawn using action code 24. For both of these cases the points of the polygon are computed in an identical manner.

x

200

100

7

y

50

100

90000

c

2402

-2

-2

The table shows an example. Three columns and only three columns are used for the generation of a regular polygon. The first column contains the coordinates of the top left hand corner of a rectangle that is not drawn, but is part of the construction mathematics. The second column contains the width and height of a rectangle that is not drawn, but is also part of the construction mathematics. Please note that these two values are equal, denoting a square construction area. Regular polygons are intended to usually be drawn as if in a square box rather than a rectangular box. A rectangular box may however be used if desired, though a regular polygon will not be produced, though the facility can be useful for graphic effects on occasions so is included, as the software overhead is very small given that the eutodraw table is providing space for both a width and a height in any case. For this example a square box will be assumed as that is the intended situation. The box in this example is 100 pixels by 100 pixels in size. Within this box, please imagine an inscribed circle, the largest such circle that can be drawn touching the edge of the box and in pixel terms writing over the pixels of the edges of the box in four places. The polygon in the example is filled and is red in colour. The polygon in the example has seven sides. The remaining parameter is the parameter that in the example has the value of 90000. It is one thousand times the rotation angle. The numerical values in the eutodraw table are integers. Sometimes one might like to use a part of an angle, such as a half a degree. For example, an angle of 22.5 degrees in order to rotate an octagon such that it has a horizontal straight line at the top. Figures such as a heptagon would need an angle that needs several decimal places of non-zero digits for accuracy. So, a factor of one thousand times is a reasonable balance bearing in mind the resolution of the screen. The method of constructing the polygon when the rotation angle is 0 is to place the first point of the polygon at the three o'clock position on the inscribed circle. The second point is placed on the inscribed circle at a position that is anticlockwise by an angle that is 1/n th of a revolution from the three o'clock position. The third point is placed on the inscribed circle at a position that is anticlockwise by an angle that is 2/n th of a revolution from the three o'clock position. And so on until the polygon has been produced.

When the rotation angle is not zero, that angle is added in an anticlockwise direction to the three o'clock starting position for the points. A 90 degree rotation angle means that the first point is at the twelve o'clock position so that the polygon will have a vertex at the top. The angle is expressed in degrees.


A line drawn star is drawn using action code 25. A filled star is drawn using action code 26. Drawing a star uses four columns of the eutodraw table, which is the most number of columns used for any eutodraw command with a fixed number of columns associated with it so far. Ordinary polygons use a variable number of columns of the eutodraw table.

Two example are given for stars. Please note that both of these examples use a 7 pointed star. The drawing of a star is within an inscribed circle as for a regular polygon and, with the exception of the difference of the action code, the data of the first two columns has the same meaning as for a regular polygon. Stars may be drawn within rectangles, but the intended usage is within a square. The third column gives the number of points for the star, seven points in these examples, and one thousand times the rotation angle for the positioning of the first point of the star on the construction circle as in the construction of a regular polygon detailed above, 90 degrees in these examples, expressed as the number 90000 so that one of the points of the star points vertically upwards.

In constructing a star the eutodraw system constructs a polygon with twice as many sides as the star has points. For the seven sided stars in the examples, this means a polygon with fourteen sides. A polygon with these extra sides needs the same number of extra vertices. These vertices are points on a second construction circle, concentric with the inscribed circle and of smaller radius. The points on the inner circle are staggered at angles half way between the angles of the points on the inscribed circle, starting in an anticlockwise direction from the first point.

The final matter that needs to be decided is the radius of the inner circle as a ratio of its radius to the radius of the inscribed circle. This ratio will always be a number in the range 0.0 to 1.0 and usually neither at, nor near, either extreme of the permitted range. There are two methods provided of selecting this ratio, which may be used at the choice of the 1456 programmer.

x

350

100

7

0

y

50

100

90000

350

c

2605

-2

-2

-2

The first method, shown in the example above, is to set the star selector to have a value of zero and in the position in the table below the zero to have an integer that is one thousand times the value of the desired ratio.

x

500

100

7

3

y

50

100

90000

0

c

2606

-2

-2

-2

The second method, shown in the example above, is to set the star selector to have a value that is not zero. In this case the figure below the star selector is not used and is conventionally set to zero. The value of the star selector may be any integer that is both greater than or equal to 2 and is also less than or equal to half of one less than the number of points of the star. Thus for a five pointed star the star selector may only have the value of 2. A seven pointed star may have a star selector with a value of 2 or 3 as chosen by the 1456 programmer. An eight pointed star may have a star selector with a value of 2 or 3 as chosen by the 1456 programmer. A 15 pointed star may have a star selector with a value of 2, 3, 4, 5, 6 or 7 as chosen by the 1456 programmer.

What does a non-zero star selector value mean? Consider that one is drawing a star using a pencil and paper construction. Suppose that it is a five pointed star. One draws a circle. One places five points equally spaced around the circle. One joins each point with a straight line to the point that is 2 points away. The star is in the middle once the construction lines are rubbed out or ignored.

Consider that one is drawing another star using a pencil and paper construction. Suppose that it is a seven pointed star. One draws a circle. One places seven points equally spaced around the circle. Now one has to make a decision. Should one join each point with a straight line to the point that is 2 points away, or should one join each point with a straight line to the point that is 3 points away. One chooses either a 2 point away method or a 3 point away method. The star is in the middle once the construction lines are rubbed out or ignored.

The number that one chooses when one chooses how to construct the star as to how many points away to find the point to which to draw the straight line is that which I have called the star selector. Where there is a choice, a larger value of star selector will result in a star with sharper points. Where there are many choices of star selector value a value about two thirds of the way up the range often gives aesthetically pleasant results.

The above comprehensive method using four columns of the eutodraw table provides the opportunity to produce a wide variety of star designs. It can be potentially slightly inefficient if one is wanting to produce a lot of standard five pointed stars all of which have a star selector with a value of 2, though the fourth column can sometimes provide a useful alternative for five pointed stars by having a star selector value of zero and a low value of the ratio specified.


In addition to regular polygons and stars the eutodraw system has a facility to draw generalized polygons specified relative to an origin point and to rotate them about a point (which may but need not be the origin point) and to scale them and to mirror them. This is achieved using action codes 27 and 28 for line drawn and filled polygons respectively. These codes are an attempt to provide some of the capabilities of the Autoshapes of PowerPoint without needing the 1456 engine to carry details of many shapes with it either on the internet or when used as telesoftware in direct broadcast satellite broadcasts.

The method used is that an entry is made into the eutodraw table consisting of 3 columns followed by as many columns as there are sides to the polygon. Thus for example, a seven sided polygon manipulated using these action codes would need a total of ten columns in the eutodraw table.

Here are the first three columns for several examples. Firstly for a brown outline of the shape, normal size, unrotated.

x

50

100

1000

y

200

100

0

c

2701

-2

-2

Secondly, a yellow solid shape, three quarter size, rotated 45 degrees.

x

220

100

750

y

200

100

45000

c

2804

-2

-2

Thirdly, a cyan solid shape, half size, rotated 45 degrees, mirrored.

x

340

100

-500

y

200

100

45000

c

2810

-2

-2

For each of the three uses of the shape, columns 4 to 10 are the same, as follows. Please note the use of the -3 in the last column, to signal that it is the last column.

x

0

100

0

0

20

20

0

y

0

0

100

40

40

20

20

c

-2

-2

-2

-2

-2

-2

-3

The first column contains the coordinates of the top left corner of a construction box together with information about the action code and the colour of the eutoshape. The second column contains information about the width and height of a construction box. Yet for these eutoshapes the size of the construction box does not determine the size of the eutoshape. The construction box is used only to determine the point about which any rotation or amplification will take place. That point is the centre point of the construction box. The construction box may be made to have zero width and zero height if desired, thereby placing the centre point for rotations at the same place as the top left corner of the construction box. It is often useful, however, to have the top left corner of the construction box and its centre at two different points.

It may be wondered as to why a construction box is used at all, for the coordinates of the centre point of rotations could have been expressed either absolutely or relative to the top left corner of the construction box. Essentially, the answer is that using a top left corner and a centre point of rotations that are in different places allows points in the polygon to be entered relative to the top left corner of the construction box using positive numbers, even when the centre point of any rotations is within the polygon. The centre point of rotations is computed from the centre point of the construction box rather than being entered directly as a relative displacement from the top left hand corner point as that makes the method aesthetically align with other eutoshape commands. It may be that this will have practical programming advantage at some future time where perhaps a eutoshape is being superimposed on a regular polygon for some purpose, yet the fundamental reason is an aesthetic consideration in the design of the system.

The third column of the eutodraw table for this command contains two values. The x row contains a number that is one thousand times the amplification factor and the y row contains a number that is one thousand times the rotation angle. If the one thousand times the amplification factor is given as 0 then an amplification of 1 is used. If a negative amplification factor is used, a mirror image of the shape is produced.


The ability to draw American style doughnuts and related shapes is provided by action code 29. Doughnuts are always drawn filled, so there is only one action code associated with them.

As with the star four columns of the eutodraw table are used. The first two columns give the top left coordinates, the action code and the colour as usual. The second column gives a box size that may, but need not, be square. For a conventional doughnut, width and height are set equal, yet the eutodraw system easily produces elliptical doughnuts should those be required. The third column selects the doughnut outer type in the x row and the inner type in the y row. Set as 0 for a round doughnut and 1 for a straight edged doughnut. The fourth column selects inner radius ratios for the central hole. For a conventional doughnut with a circular hole these are set equal to each other. Elliptical holes may be produced by using values that are not equal. Values are set as integers between 0 and 1000, where the integer is one thousand times the ratio to be used.

Here is an example for a square outer, round inner doughnut.

x

500

100

1

500

y

200

100

0

500

c

2907

-2

-2

-2


Here is the mathematical method used for computing the inner radius when the value of star selector is non-zero. This example is drawn using a five pointed star as an example. For a five pointed star the value of star selector must be 2 if a non-zero value is used.

This diagram was produced using 1456 software. A screen print was made and the picture was produced as a gif file. The reason for doing this was that the diagram uses some Greek letters and would not have displayed correctly on a browser which did not have Greek letters in the fount available and would not have displayed at all on a non-Java enabled browser.

The angle alpha, shown as α, is 2π multiplied by the ratio of the value of star selector to the number of points in the star. In this example, star selector has the value of 2 and the number of points in the star is 5, so alpha has a value of 4π/5 which is 144 degrees.

There is an isoceles triangle that has one angle alpha and two equal angles beta, shown as β. For every possible case, alpha plus two beta equals π so the value of beta can be found. In this example beta is π/10 which is 18 degrees, since 18 = (180 - 144)/2.

The angle gamma, shown as γ, is 2π divided by twice the number of star points. In this example gamma is π/5 which is 36 degrees, since 36 = 360/(2 * 5).

The angle xi, shown as ξ, is in a triangle with beta and gamma, so xi is π - beta - gamma. In this example, xi is 7π/10 which is 126 degrees, since 126 = 180 - 18 - 36.

The value of the inner radius, r2 can now be found.

Suppose that the radius of the star is r.

r/sin(xi)=r2/sin(beta)

Therefore r2=r*sin(beta)/sin(xi)

In this example, beta is 18 degrees and xi is 126 degrees. The sine of 126 degrees is the sine of (90 + 36) degrees and that has the same value as the sine of (90 - 36), which is the sine of 54 degrees. The sine of 18 degrees is less than the sine of 54 degrees and so r2 is less than r.

1456 object code

Copyright 2001 William Overington