Compare commits

..
Author SHA1 Message Date
shaneandshinyobjectz 1b20fff4d0 A part never stands on what it holds: a mug isn't sunk into its coffee (#365)
Co-authored-by: shinyobjectz <[email protected]>
2026-12-06 07:23:27 -08:00
4 changed files with 26 additions and 16 deletions

No files matched your search

+1 -3
View File
@@ -83,9 +83,7 @@ export default function Title({ children, region = "top", size = 64, style, face
fontWeight: 800,
fontSize: size,
lineHeight: 1.1,
// white on its own dark plate, as raea's captions are (brand.ts CAPTION): never the website's text colour, which
// is dark for a light page (12-06, Dutch on rc5: every hook black on the plate, 1.3:1, five floor errors)
color: "#fff",
color: "var(--brand-text, #fff)",
// a dark plate, as raea's captions have: a hook over a beige coat or a sky read under 3:1 with a shadow alone
background: "rgba(0,0,0,0.6)",
padding: `${Math.round(px * 0.08)}px ${Math.round(px * 0.3)}px`,
-12
View File
@@ -376,15 +376,3 @@ exit 0
assert.equal(otherRaea("0.1.16", "reading", false), undefined)
console.log("ok a box refuses a worker on another raea")
}
// a cut's titles and captions draw white on raea's dark plate, never in a brand's own text colour, which is dark for a
// light website (12-06, Dutch on 0.1.17-rc5: every hook black on the plate at 1.3:1, five floor errors)
{
const title = readFileSync(new URL("../image/Title.tsx", import.meta.url), "utf8")
const colour = title.match(/^\s*color: (.+),$/m)?.[1]
assert.equal(colour, '"#fff"', `Title's words are ${colour}`)
assert.match(title, /background: "rgba\(0,0,0,0\.6\)"/)
const brand = readFileSync(new URL("../image/brand.ts", import.meta.url), "utf8")
assert.match(brand, /export const CAPTION = \{[^}]*color: "#fff"/)
console.log("ok titles and captions draw white on their dark plate")
}
+9 -1
View File
@@ -132,6 +132,12 @@ fn insets(parts: &[Part]) -> Vec<Option<usize>> {
.collect()
}
/// Whether `inner` lies wholly in `outer`'s box (within a millimetre): what `outer` holds, never what it stands on.
fn holds(outer: &Part, inner: &Part) -> bool {
let e = Vec3::splat(0.001);
inner.lo.cmpge(outer.lo - e).all() && inner.hi.cmple(outer.hi + e).all()
}
fn rest_of(parts: &[Part], grid: &Grid, insets: &[Option<usize>], i: usize) -> Rest {
let p = &parts[i];
let height = p.hi.y - p.lo.y;
@@ -147,7 +153,9 @@ fn rest_of(parts: &[Part], grid: &Grid, insets: &[Option<usize>], i: usize) -> R
let mut col = grid.column(parts, f.x, f.z, i);
// a part and the wall it's set into don't stand on each other, nor do a wall's pieces (a corner, the wall over
// a window)
col.retain(|&(y, j, _)| y <= f.y + up && insets[i] != Some(j) && insets[j] != Some(i) && !(wall(p) && wall(&parts[j])));
// nor does a part stand on what it holds: coffee in its mug, soil in its pot, a box's contents (12-06, the 3D
// proof: "mug is sunk 12.0 mm into coffee", the coffee's top a floor's thickness above the mug's foot)
col.retain(|&(y, j, _)| y <= f.y + up && insets[i] != Some(j) && insets[j] != Some(i) && !(wall(p) && wall(&parts[j])) && !holds(p, &parts[j]));
let Some(&(y, j, k)) = col.iter().max_by(|a, b| a.0.total_cmp(&b.0)) else { continue };
let gap = f.y - y;
tested += 1;
+16
View File
@@ -170,3 +170,19 @@ fn a_thing_left_in_the_air_is_an_error_unless_it_glows_or_is_floating() {
let (_, level, _, errors) = air(json!({}), json!({"emissive": {"red": 2200.0, "green": 120.0, "blue": 80.0, "alpha": 1.0}}));
assert_eq!((level.as_str(), errors), ("note", 0));
}
#[test]
fn a_mug_stands_on_the_table_not_on_its_coffee() {
let floor = part("floor", Vec3::new(0.0, -0.05, 0.0), Vec3::new(4.0, 0.1, 4.0));
let mug = part("mug", Vec3::new(0.3, 0.05, 0.2), Vec3::new(0.08, 0.1, 0.08));
// the coffee in it: its top 12 mm above the mug's foot, wholly inside the mug's box
let coffee = part("coffee", Vec3::new(0.3, 0.007, 0.2), Vec3::new(0.06, 0.01, 0.06));
let parts = [floor, mug, coffee];
match rest(&parts, 1) {
Rest::On { under, gap, .. } => {
assert_eq!(parts[under].label, "floor");
assert!(gap.abs() <= TOUCH, "{gap}");
}
r => panic!("the mug should rest on the floor: {r:?}"),
}
}