This guide explains how to create a TARDIS model using the Curv
language. We’ll go through each part of the TARDIS step-by-step, with detailed explanations of each command and keyword used in Curv.
To start, install Curv from https://curv3d.github.io/. Curv is a functional 3D modeling language that you can use on the command line or via the graphical interface.
Curv allows defining variables for dimensions. We’ll use these to parameterize the TARDIS dimensions for scalability and flexibility.
// Set base dimensions
let width = 100; // Width of the TARDIS base in mm
let height = 200; // Total height of the TARDIS
let wall_thickness = 5; // Wall thickness
let roof_height = 30; // Height of the roof section
let door_height = 130; // Door height
let window_height = 30; // Window height
In Curv, we create 3D shapes using built-in functions such as cube
and difference
. The cube
function creates a rectangular prism, and the difference
function allows us to create hollowed structures by subtracting shapes.
// Create the base structure of the TARDIS with walls
let base = difference(
cube([width, width, height]), // Outer box
cube([width - 2 * wall_thickness, width - 2 * wall_thickness, height - wall_thickness]) // Hollowed interior
);
let
: Declares a variable.cube
: Creates a rectangular prism. The argument is a list with three values representing the X, Y, and Z dimensions.difference
: Subtracts one shape from another. Here, we create the hollowed TARDIS structure by subtracting a smaller cube from a larger cube.We add windows and doors by creating cutouts on the walls using cube
and difference
functions to create holes for each part.
// Define the window dimensions and position
let window = difference(
base,
cube([20, 5, window_height]) * translate([40, width - wall_thickness, height / 2])
);
cube
: Creates a rectangular prism shape, which we position to act as a cutout.translate
: Moves the cube to the correct position for the window cutout.
// Define the door dimensions and position on the front face
let door = difference(
base,
cube([width / 4, 5, door_height]) * translate([width / 4, wall_thickness, 0])
);
cube
: Defines the shape of the door.translate
: Moves the door shape into the correct position on the TARDIS.The roof is represented by a scaled cube, while the light fixture is a sphere positioned on top of the roof. We use the scale
and translate
commands to position and resize each part.
// Create the pyramid-shaped roof
let roof = scale([1, 1, 0.3], cube([width, width, roof_height])) * translate([0, 0, height]);
// Add a light fixture on the top center of the roof
let light = sphere(5) * translate([0, 0, height + roof_height]);
scale
: Scales an object along specified dimensions. Here, the cube is scaled to create a pyramid shape.sphere
: Creates a spherical shape; in this case, it’s used to create the light on the roof.translate
: Positions the roof and light fixture in their correct locations.In Curv, we can add color using material
. Below, we set the colors for the base and the light fixture.
// Adding color
let tardis_base = material("plastic", "blue") * base;
let tardis_light = material("glass", "light") * light;
material
: Defines material properties and color for objects. Here, the TARDIS base is colored blue and made of "plastic," while the light is set to "glass."