?

Log in

No account? Create an account

Previous Entry | Next Entry

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.

Comments

( Read 6 comments — Leave a comment )
ext_880
Nov. 11th, 2006 04:25 pm (UTC)
Mozilla Firefox has unaddressed portability issues which will impact this project. Specifically, in its reliance on bulky electrooptical rendering planes, as contrasted to alternate fibrous multi-user platforms looking to solve concurrency issues. But that's still a very cool hack!
southernbeatnik
Nov. 11th, 2006 05:32 pm (UTC)
The size of your e-wang would make Godzilla blush.

// I would love to see the stylesheet.
// Excellent work, dude!
meagenimage
Nov. 12th, 2006 01:57 am (UTC)
I'm pretty sure e-wang or e-peen refers specifically to virtual *posessions* (be they gold pieces in a game, posts on a forum or feedback on Ebay). The proper term for this is MAD SKILLZ.
southernbeatnik
Nov. 12th, 2006 04:25 am (UTC)
I'm pretty sure I'll use "e-wang" as I see fit. ;)

// If saaaaaaaaying it wrong is wrong, I don't wanna be right~
meagenimage
Nov. 12th, 2006 07:57 pm (UTC)
You are a true carrot in the velociraptor of tranquility.
brentdax
Nov. 18th, 2006 05:35 am (UTC)
Biologist: What's worse than being chased by a Velociraptor?
Physicist: Obviously, being chased by an Acceloraptor.
( Read 6 comments — Leave a comment )