"use strict"; const StairGeometryDebug = (function(){ const StairGeometryDebug = function(hollow_bond){ const cache = {}; const floor_height = hollow_bond.room_height || 3; this.get = (width, depth) => { const key = `${width}_${floor_height}_${depth}`; if(!cache[key]){ const landing_thickness = 0.15, landing_length = Math.max(1, depth * 0.25), ramp_run = depth - (landing_length * 2), ramp_rise = floor_height, ramp_length = Math.sqrt(ramp_run * ramp_run + ramp_rise * ramp_rise); cache[key] = { landing_bottom : new THREE.BoxGeometry(width, landing_thickness, landing_length), landing_top : new THREE.BoxGeometry(width, landing_thickness, landing_length), ramp : new THREE.BoxGeometry(width, landing_thickness, ramp_length), specs : { landing_length, landing_thickness, ramp_run, ramp_rise, ramp_length, angle : Math.atan2(ramp_rise, ramp_run) } }; } return cache[key]; }; this.reset = () => { for(const key in cache){ if(cache[key]){ cache[key].landing_bottom.dispose(); cache[key].landing_top.dispose(); cache[key].ramp.dispose(); delete cache[key]; } } }; }; return StairGeometryDebug; })();