Number of Walls
[
["0","0"],
["1","1"],
["2","2"],
["3","3"],
["4","4"]
]
Room Width
Room Height
Reflection
Outside Room
Time Averaging
[
["0","NONE"],
["0.1","0.1 ms"],
["1","1 ms"],
["5","5 ms"],
["10","10 ms"]
]
Source
1st Order
2nd Order
3rd Order
color.add("wavefront","black")
color.add("wall","var(--theme-dull-dark-8)","var(--theme-dull-dark-3)")
const wallWeight = 8
const plotSize = this.height - 300
const space = this.newPlot({
position: [this.left+100,-plotSize/2],
size: [plotSize, plotSize],
rangeX: [-10,10],
rangeY: [-10,10],
labelX: "Position x [m]",
labelY: "Position y [m]",
strongZeroX: false,
})
const spaceContent = space.group.group()
const spaceCover = space.group.group()
const o = 10
const wall = spaceCover.line(
()=>{
const w = reg.roomWidth.value/2
switch (reg.wallCount.value){
case ("0"):
return []
break
case ("1"):
return [-w,-w]
break
case ("2"):
return [-w,-w,o]
break
case ("3"):
return [-w,-w,w,w]
break
case ("4"):
return [-w,-w,w,w,-w]
break
}
},
()=>{
const h = reg.roomHeight.value/2
switch (reg.wallCount.value){
case ("0"):
return []
break
case ("1"):
return [o,-o]
break
case ("2"):
return [o,-h,-h]
break
case ("3"):
return [o,-h,-h,o]
break
case ("4"):
return [h,-h,-h,h,h]
break
}
},
{
stroke: color.wall,
strokeWidth: wallWeight,
strokeLinecap: "square",
}
)
const cover = spaceCover.line(
()=>{
const w = reg.roomWidth.value/2
switch (reg.wallCount.value){
case ("0"):
return []
break
case ("1"):
return [-o,-w,-w,-o]
break
case ("2"):
return [-o,-w,-w,o,o,-o]
break
case ("3"):
return [-o,-w,-w,w,w,o,o,-o]
break
case ("4"):
return [-o,-w,-w,w,w,-w,-w,o,o,-o]
break
}
},
()=>{
const h = reg.roomHeight.value/2
switch (reg.wallCount.value){
case ("0"):
return []
break
case ("1"):
return [o,o,-o,-o]
break
case ("2"):
return [o,o,-h,-h,-o,-o]
break
case ("3"):
return [o,o,-h,-h,o,o,-o,-o]
break
case ("4"):
return [o,o,-h,-h,h,h,o,o,-o,-o]
break
}
},
{
stroke: "none",
fill: color.wall
}
)
reg.coverVis.onUpdate((v)=>{
cover.style.opacity = v?1:0.15
})
reg.coverVis.value = false
reg.roomWidth.onUpdate(()=>{
wall.update()
cover.update()
})
reg.roomHeight.onUpdate(()=>{
wall.update()
cover.update()
})
reg.wallCount.onUpdate(()=>{
wall.update()
cover.update()
})
const timePlotHeight = this.height - 400
const timePlotWidth = this.right - 125 - 25
const time = this.newPlot({
position: [ 125, -timePlotHeight/2 ],
size: [timePlotWidth,timePlotHeight],
rangeX: [0,160],
rangeY: [0,1],
labelX: "Time s [ms]",
labelY: "Relative Amplitude",
tickStepX: 20,
tickStepY: 0.1,
// typeY: "log",
// tickArrayY:[{value:0.01,label:"1%"},{value:0.025,label:"2.5%"},{value:0.05,label:"5%"},0.1,0.25,0.5]
// tickArrayY:[0.025,0.05,0.1,0.25,0.5]
})
const tm = time.group
function calcImages(){
}
function plotSignal(){
}
function plotWavefronts(){
}