Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/editor/lib/build-palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ export const BASE_BUILD_TYPES: BuildType[] = [
mode: 'terrain-sculpt',
section: 'outdoor',
},
{
id: 'terrain-break',
label: /* i18n */ { id: 'app.lib.buildPalette.terrainBreak', message: 'Terrain break' },
iconSrc: '/icons/mesh.webp',
kind: 'terrain-break',
section: 'outdoor',
},
// An outdoor room (no walls, no ceiling), drawn like a room; see `startTerraceDraft`.
{
id: 'terrace',
Expand Down
137 changes: 134 additions & 3 deletions packages/core/src/agent-operations/__fixtures__/notation-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,124 @@ export const NOTATION_CASES: NotationCase[] = [
['2.6 cm', 26],
],
},
{
tool: 'add_ramp',
field: 'start[]',
readings: [
[1, 1],
['100 cm', 1],
],
},
{
tool: 'add_ramp',
field: 'segments[].end[]',
readings: [
[2, 2],
['200 cm', 2],
],
},
{
tool: 'add_ramp',
field: 'segments[].center[]',
readings: [
[-1, -1],
['-100 cm', -1],
],
},
{
tool: 'add_ramp',
field: 'segments[].sweep',
readings: [
[-QUARTER_TURN, -QUARTER_TURN],
['180 deg', Math.PI],
],
},
{
tool: 'add_ramp',
field: 'width',
readings: [
[1, 1],
['100 cm', 1],
],
},
{
tool: 'add_ramp',
field: 'startHeight',
readings: [
[0, 0],
['50 cm', 0.5],
],
},
{
tool: 'add_ramp',
field: 'endHeight',
readings: [
[-1, -1],
['-150 cm', -1.5],
],
},
{
tool: 'add_ramp',
field: 'thickness',
readings: [
[0.2, 0.2],
['20 cm', 0.2],
],
},
{
tool: 'add_ramp',
field: 'startTransition',
readings: [
[0, 0],
['150 cm', 1.5],
],
},
{
tool: 'add_ramp',
field: 'endTransition',
readings: [
[0, 0],
['200 cm', 2],
],
},
{
tool: 'add_ramp',
field: 'retainingHeight',
readings: [
[0, 0],
['75 cm', 0.75],
],
},
{
tool: 'shape_site_terrain',
field: 'area.radiusM',
readings: [
[2, 2],
['250 cm', 2.5],
],
},
{
tool: 'shape_site_terrain',
field: 'heightM',
readings: [
[-0.5, -0.5],
['50 cm', 0.5],
],
},
{
tool: 'shape_site_terrain',
field: 'softness',
readings: [
[0, 0],
['25 cm', 0.25],
],
},
]

/**
* Every other number a shared tool takes by name, none of them a length or an angle. Numbers in
* an array are coordinates (points, outlines, vectors) and whole numbers are counts, indices or
* pixels, so neither is listed; a length or an angle added as a bare number fails the test.
* Every other number a shared tool takes by name, including the explicitly recorded notation
* debts below. Numbers in an array are coordinates (points, outlines, vectors) and whole numbers
* are counts, indices or pixels, so neither is listed; a new bare length or angle fails the test.
*/
export const NOT_LENGTHS = new Set([
'add_window.rollerShutterOpen',
Expand All @@ -340,6 +452,12 @@ export const NOT_LENGTHS = new Set([
// says; the one notation (N1) is still owed on them.
'move_node.y',
'move_node.rotation',
// Terrain input schemas still take these elevations and sampling distances in metres only.
'add_terrain_break.left',
'add_terrain_break.right',
'read_site_terrain.cellM',
'read_terrain_contours.intervalM',
'sample_terrain_line.stepM',
// Coordinates, in level metres.
'add_column.x',
'add_column.y',
Expand All @@ -357,6 +475,8 @@ export const NOT_LENGTHS = new Set([
'place_in_room.clearanceAreas[].maxZ',
'pull_site_data.latitude',
'pull_site_data.longitude',
'shape_site_terrain.area.x',
'shape_site_terrain.area.z',
// Fractions along a wall or an edge.
'add_door.t',
'add_door.position',
Expand All @@ -365,6 +485,17 @@ export const NOT_LENGTHS = new Set([
'create_room.doors[].t',
'create_room.windows[].t',
// Ratios, a material's own properties, a duration.
'shape_site_terrain.strength',
// A batter's run: horizontal metres per metre of height (2 is 1:2), a ratio.
'grade_around_house.run',
'seat_house.run',
'grade_along_line.run',
'add_terraces.run',
'add_terraces.stepsAt',
// A fall or a grade, in percent.
'add_ramp.maxSlopePercent',
'seat_house.padFallPercent',
'grade_along_line.maxSlopePercent',
'view_scene.camera.aspect',
'paint.material.properties.roughness',
'paint.material.properties.metalness',
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/agent-operations/__fixtures__/site-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,17 @@ export const GET_SITE_CASES: AgentToolCase[] = [
{
name: 'a terrain far off the lot, its samples 10 nm apart: read over the field’s own lines',
tool: 'get_site',
// past the field heightAt holds its edge, so the lot's lines cross only the field's few grid
// lines, not the 10^24 between the lot and the field; the field's west column rises 2 m
// the lot's lines cross only the field's few grid lines, not the 10^24 between the lot and
// the field. Past the field the ground continues as the field's own context plane (virtual
// ground, not its edge held), which is flat: the lot far from the field reads 0 m of fall.
scene: () => {
const field = createTerrainField({ origin: [1e16, 0], spacing: 1e-8, cols: 2, rows: 2 })
field.heights[2] = quantize(field, 2)
const terrain = encodeTerrainField(field)
return scene(site({ polygon: STRAIGHT.polygon, terrain }), building(), level())
},
input: {},
expect: { result: { ground: { state: 'sloped', reliefM: 2 } } },
expect: { result: { ground: { state: 'sloped', reliefM: 0 } } },
},
{
name: 'a terrain finer than the coordinates can hold: the fall heightAt shows, not its samples',
Expand Down
Loading
Loading