SpaceCalc
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v12View latest version
A web application that calculates and visualizes whether objects can fit in a specific room with a sloped ceiling, taking into account existing blockers/obstacles.
- Width: 155 cm
- Left wall height: 115 cm
- Right wall height: 255 cm
- Ceiling: Straight slope from left to right
- Blocker Management: Add arbitrary blockers with custom dimensions and positioning
- Define blockers by width, height, and position (from left or right wall)
- Visual representation in both side and top views
- Automatic collision detection between blockers
- Easy removal of existing blockers
- Real-time calculation: Enter object dimensions and see instant results
- Visual feedback: Color-coded results (green = fits, red = doesn't fit)
- Collision detection: Prevents overlapping objects and highlights conflicts
- Dual visualization:
- Side view showing the sloped ceiling, blockers, and object placement
- Top view showing the floor plan and positioning
- Detailed results: Shows exact positioning, clearance, collision info, and failure reasons
- In the "Existing Blockers" section, enter the blocker's dimensions
- Specify position using either:
- From Left Wall: Distance from the left (short) wall
- From Right Wall: Distance from the right (tall) wall
- Click "Add Blocker" to place it in the room
- Blockers are shown in gray in both visualizations
- Remove blockers using the "Remove" button
- Enter your object's width (cm) - how wide it is along the floor
- Enter your object's height (cm) - how tall it is
- Enter the offset (cm) - gap you want from the tall wall
- View the results and visualizations
The application uses a precise geometric calculation that:
- Checks for collisions with existing blockers first
- Positions the object against the tall wall with the specified offset
- Calculates the maximum ceiling height at the object's position
- Determines if the object fits within the sloped ceiling constraints
- Provides detailed feedback on positioning, clearance, and any conflicts
- Collision Detection: Prevents overlapping blockers and objects
- Flexible Positioning: Position blockers from either wall
- Visual Feedback: Conflicting blockers are highlighted in red
- Ceiling Validation: Blockers must fit under the sloped ceiling
- Dynamic Updates: All visualizations update in real-time
├── backend/
│ └── index.ts # Hono server serving static files
├── frontend/
│ ├── index.html # Main HTML interface with blocker management
│ └── script.js # Enhanced fitting algorithm with blocker support
└── README.md
The core fitting algorithm handles edge cases like negative dimensions, objects extending beyond room boundaries, blocker collisions, and precise height calculations along the sloped ceiling.
