mirrash7 commited on
Commit
5b67679
·
verified ·
1 Parent(s): 70d4be0

Default attack -X (left); GOAL label smaller + above the offside wall

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. pipeline/threed.py +5 -2
app.py CHANGED
@@ -316,7 +316,7 @@ with gr.Blocks(title="VAR Offside Visualizer") as demo:
316
  defenders = gr.CheckboxGroup(choices=[], label="6. Defenders (incl. GK) — sets the offside line")
317
  with gr.Row():
318
  flip = gr.Checkbox(False, label="flip up (if players are upside-down)")
319
- attack = gr.Radio(["+X ", "X "], value="+X ",
320
  label="Attacking direction")
321
  build_btn = gr.Button("7. Build 3D scene + offside line", variant="primary")
322
 
 
316
  defenders = gr.CheckboxGroup(choices=[], label="6. Defenders (incl. GK) — sets the offside line")
317
  with gr.Row():
318
  flip = gr.Checkbox(False, label="flip up (if players are upside-down)")
319
+ attack = gr.Radio(["X ", "+X "], value="X ",
320
  label="Attacking direction")
321
  build_btn = gr.Button("7. Build 3D scene + offside line", variant="primary")
322
 
pipeline/threed.py CHANGED
@@ -107,8 +107,11 @@ ctx.textAlign = "center"; ctx.textBaseline = "middle";
107
  ctx.lineWidth = 6; ctx.strokeStyle = "rgba(0,0,0,0.5)";
108
  ctx.strokeText("GOAL", 128, 36); ctx.fillText("GOAL", 128, 36);
109
  const sp = new THREE.Sprite(new THREE.SpriteMaterial({map:new THREE.CanvasTexture(cv), transparent:true}));
110
- sp.position.copy(aOrig.clone().add(aDir.clone().multiplyScalar(aLen)).add(new THREE.Vector3(0,0,1.1)));
111
- sp.scale.set(4, 1.1, 1); scene.add(sp);
 
 
 
112
  document.getElementById("png").onclick = () => {
113
  const a = document.createElement("a");
114
  a.href = renderer.domElement.toDataURL("image/png");
 
107
  ctx.lineWidth = 6; ctx.strokeStyle = "rgba(0,0,0,0.5)";
108
  ctx.strokeText("GOAL", 128, 36); ctx.fillText("GOAL", 128, 36);
109
  const sp = new THREE.Sprite(new THREE.SpriteMaterial({map:new THREE.CanvasTexture(cv), transparent:true}));
110
+ const goalPos = (D.plane_x !== null)
111
+ ? new THREE.Vector3(D.plane_x, cy, 3.7) // just above the red offside wall (z up to 3)
112
+ : aOrig.clone().add(aDir.clone().multiplyScalar(aLen)).add(new THREE.Vector3(0,0,1.1));
113
+ sp.position.copy(goalPos);
114
+ sp.scale.set(3, 0.8, 1); scene.add(sp);
115
  document.getElementById("png").onclick = () => {
116
  const a = document.createElement("a");
117
  a.href = renderer.domElement.toDataURL("image/png");