This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yes, it is possible to shape the grid edges to follow the hull’s shape and interpolate between the outer and inner hulls, rather than simply laying a regular grid over the deck and trimming it. This can be achieved by using a mapped grid that adapts to the deck’s geometry while maintaining a structured layout. Below, I’ll explain how this works and why it’s a great fit for your procedural starship deck layout generator. | |
What Does This Mean? | |
When you talk about shaping the grid edges to follow the hull and interpolating between the outer hull (the perimeter) and the inner hull (the core), you’re asking for a grid that: | |
• Conforms to the hull’s shape at the boundary. | |
• Transitions smoothly from the core to the hull. | |
• Avoids the irregular or partial cells that result from trimming a regular grid. | |
Instead of starting with a rigid, square grid and cutting it to fit, we can design a grid that naturally molds to the deck’s contours while still being usable for room placement. | |
How It Works: The Mapped Grid Appr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from shapely.geometry import Polygon, Point | |
from shapely.affinity import scale | |
import argparse | |
import pygame | |
import sys | |
# Set random seed for reproducibility | |
np.random.seed(42) |