Brent Dax (brentdax) wrote,
Brent Dax
brentdax

  • Mood:
  • Music:

Silly, clever hacks

We're starting to think about how the furniture will be laid out in the new house.  When we rearrange a room, we usually do it by sketching it out (to scale) on graph paper, cutting out to-scale pieces of graph paper to represent the furniture, and then moving all the furniture around the room until we're happy with the arrangement.

I spent a couple nights doing this and finally finished on Wednesday night.  When Dad looked at it, though, he wasn't very happy with it--I had used a scale of one square = 5 inches, which is about the largest I could get away with and still be able to fit all the rooms.  The problem, of course, was that five inches is an incredibly inconvenient number to work with.

So I sat down tonight to sketch them out again with a one square = 6 inches scale.  And then I realized something.

There are basically two things involved in sketching a room:
  1. Drawing boxes with straight edges.
  2. Performing simple computations to handle a scale factor.
As it turns out, there's a computer program that excels at doing simple math and then drawing boxes on the screen.  It's called "Mozilla Firefox".

So I described the rooms as XML:
<room xmlns="http://xmlns.brentdax.com/roomarrange"
        width="170.5" height="206" scale="2">
    <name>Living room</name>
    <thing type="deadspace" top="61.5" height="83.75" left="0" width="2"></thing>
    <thing type="deadspace" top="63.5" height="79.75" left="2" width="23">
        <name>Fireplace</name>
    </thing>
    <aperture type="window" surface="left" top="36" height="23"></aperture>
    <aperture type="window" surface="left" bottom="34" height="23"></aperture>
    <aperture type="window" surface="top" left="58" right="58"></aperture>
    <aperture type="walkway" surface="right" top="60" bottom="61">
        <name>Hallway</name>
    </aperture>
</room>
And then wrote some simple style sheets to render it and a little bit of JavaScript to convert the various sizes to style= attributes, based on the specified scale.



Thus far, it works like a charm.  Next up: allowing people to create furniture and move it around the room with drag-and-drop.
Tags: geekiness, hacking, life, new house
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 6 comments