Friday Fun Problem: Floor Plans With Perl

2008-12-05 Thread Greg McCarroll

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.


Re: Friday Fun Problem: Floor Plans With Perl

2008-12-05 Thread Ash Berlin


On 5 Dec 2008, at 08:26, Greg McCarroll wrote:



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.



Fire places. Right angles. Square walls. Ha!


Re: Friday Fun Problem: Floor Plans With Perl

2008-12-05 Thread David Cantrell
On Fri, Dec 05, 2008 at 08:26:15AM +, Greg McCarroll wrote:

 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

There are a very large number of shapes with those edge lengths.  You
need an angle too.  And in a lot of houses, they're not *quite* 90
degrees in the corners.  I *think* that in general for an N sided shape
you need N-3 angles along with all the edge lengths.  Some Greek dude
probably proved this 2000 years ago so I'm not going to bother to try.

 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?

That sounds like you want Logo.  I see there are Language::Logo and
Tk::CanvasLogo on the CPAN.

-- 
David Cantrell | http://www.cantrell.org.uk/david

THIS IS THE LANGUAGE POLICE
PUT DOWN YOUR THESAURUS
STEP AWAY FROM THE CLICHE


Re: Friday Fun Problem: Floor Plans With Perl

2008-12-05 Thread Nicholas Clark
On Fri, Dec 05, 2008 at 12:54:53PM +, David Cantrell wrote:
 On Fri, Dec 05, 2008 at 08:26:15AM +, Greg McCarroll wrote:

  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?
 
 That sounds like you want Logo.  I see there are Language::Logo and
 Tk::CanvasLogo on the CPAN.

And so Logo soon to be moving up from position twenty on a certain site
listing programming languages in an order it pulled out of its elbow? :-)

[yes, I suspect i'm going to find myself unsubscribed if I keep this up]

Nicholas Clark