Combination of grids

In the earlier post “irregular tilings and their duals” I briefly discussed how a straight line and a hexagonal tiling can be put together to get a new irregular tiling or grid and how its dual looks like. This nicely illustrates the general case.

For each line of one grid we have to look for intersections with lines of the other grid. Each intersection gives a new point of the joint tiling in addition to the endpoints of the line. Each segment between these points is a line of the joint tiling. The code of the following post “combination of grids – the code” creates a new grid from the combination of two simpler grids.

The function “intersectionAt(…)” finds intersections between two lines. It does not return the coordinates of the intersection. Instead it gives the value of an interpolation parameter t, where t=0 and t=1 fit the endpoints of the first line. Having found the parameter values for all intersections between one line of a grid and all lines of the other grid we simply sort them to get the intersection points in correct order. Then the line segments result from pairs of sequential points.

 

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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s