The class Points has an array “points” of objects of the class Point to organize the points of the tiling. This is similar to the code for the projection method, where the class tiling has the objects TPoint too in an array “points”, see “class Tiling – the code“. There are many methods, such as “show()”, that simply call the related method for each point.

The function “findOrCreate” is important. It searches in “points” for a point at the place given by the vector v. If such a point is found it returns this point and else it creates a new object “Point”, adds it to the array “points” and return the new point. This avoids having duplicate points, which would make further computations impossible. However, the search takes a lot of time as it is done for each point. Thus the time of computation increases as the square of the number of points. For large tilings this becomes too large and requires improvement.

The computation time can greatly be reduced if space we divide space into small regions of fixed size. Then we have only to search for points inside one of these regions. The time for the search is then independent of the size of the tiling and the overall computation time will be proportional to the size of the tiling. Thus the program could easily be accelerated by a factor of 10 or even 100 without buying a new faster computer.

To get a good display of the tiling I have methods to translate the points and to multiply their coordinates by a constant. Functions that calculate the center of all points and the maximum of their coordinate values help to fit the tiling to the display.

You will find the code in the next post. Be ready for a long series of posts defining object classes before the dualization method will be completed.

### Like this:

Like Loading...

*Related*