class Point

For the dualization method we need a better data structure than for the projection method. Thus I defined a new class “Point” to represent grid-points and dual-points. It is an improved version of the class “TPoint”, see “TPoint – the code“. You find the code in the next post.

To make connections with other points we now use the lines of the tiling that have this point as an endpoint. The other endpoints of the lines give the points having a connection with this point. In addition, the polygon dual to this point is now part of the data for this point. Note that these are only references to lines and polygons. If we change some properties say of  this dualPolygon are changed elsewhere, we will also see these changes here.

As in “TPoint” there are routines to sort connections and to make polygons. Here we need convex polygons that may be irregular.

A point may be created without knowing anything. Then only an empty array for the connections will be defined and the position vector “vec” and the dual polygon will be equal to null. Thus we have to test for null-references before using them, else the program might abort. You see this in the method “show()”, that only displays a point if its vec-reference is not equal to null.

We can also put an object equal to null. This is useful for functions that search for an object or create an object. If the search or creation fails, the function creates a dummy object equal to null and returns that. The calling routine has then to check whether this result is equal to null and acts accordingly.

This entry was posted in programming and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s