Friday Fun Problem: Floor Plans With Perl

Greg McCarroll greg at mccarroll.org.uk
Fri Dec 5 08:26:15 GMT 2008


I thought this might interest some of you.

I was lying in bed this morning wondering about how to take a pile
of measurements and have Perl (for why use something silly like a
CAD package) generate floor plans.

So say my room is like this

    B
   /|
  A |
  | |
  D-C

I might end up with a set of measurements

  A-B 5
  B-C 4
  C-D 3  
  D-A 4

Now to get the floor plans knowing which walls touch which is useful
but more useful is knowing the relative coordinates.

Now I figure I can probably construct a set of equations and set Ax,Ay
to 0,0. Stick it in Mathematica and have it pat me on the head
condescendingly and give me the answers. Or hunt around on CPAN.

However my problem comes when you think of fire places

  A-----B
  |     |
  |     |
  | F-E |
  | | | | 
  H-G D-C

If I could indicate that CDE was a right turn, could this then be
solved easily?

G.


More information about the london.pm mailing list