From 6c1143b27293f22ef4c21ac53c6bdbda381ee09d Mon Sep 17 00:00:00 2001 From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> Date: Thu, 4 May 2023 10:39:00 -0400 Subject: debugging change size --- .../nodes/PhysicsBox/PhysicsSimulationBox.tsx | 95 +++++++--------------- 1 file changed, 31 insertions(+), 64 deletions(-) (limited to 'src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index 7efb8b73a..53e1cd15f 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -111,7 +111,6 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { @@ -237,10 +237,10 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { - return this.yMax - yPos - 2 * this.radius + 5; + return this.yMax - yPos - 2 * (0.08*this.layoutDoc._height) + 5; }; getYPosFromDisplay = (yDisplay: number) => { - return this.yMax - yDisplay - 2 * this.radius + 5; + return this.yMax - yDisplay - 2 * (0.08*this.layoutDoc._height) + 5; }; // Update forces when coefficient of static friction changes in freeform mode @@ -492,49 +492,14 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { - let width = 0; - let height = 0; - if (angle < 50) { - width = 400; - height = Math.tan((angle * Math.PI) / 180) * 400; - this.dataDoc.wedgeWidth = width; - this.dataDoc.wedgeHeight = height; - } else if (angle < 70) { - width = 200; - height = Math.tan((angle * Math.PI) / 180) * 200; - this.dataDoc.wedgeWidth = width; - this.dataDoc.wedgeHeight = height; - } else { - width = 100; - height = Math.tan((angle * Math.PI) / 180) * 100; - this.dataDoc.wedgeWidth = width; - this.dataDoc.wedgeHeight = height; - } + this.dataDoc.wedgeWidth = this.xMax*0.5; + this.dataDoc.wedgeHeight = Math.tan((angle * Math.PI) / 180) * this.xMax*0.5; // update weight position based on updated wedge width/height - let yPos = (width - this.radius) * Math.tan((angle * Math.PI) / 180); - if (angle < 40) { - yPos += Math.sqrt(angle); - } else if (angle < 58) { - yPos += angle / 2; - } else if (angle < 68) { - yPos += angle; - } else if (angle < 70) { - yPos += angle * 1.3; - } else if (angle < 75) { - yPos += angle * 1.5; - } else if (angle < 78) { - yPos += angle * 2; - } else if (angle < 79) { - yPos += angle * 2.25; - } else if (angle < 80) { - yPos += angle * 2.6; - } else { - yPos += angle * 3; - } - + let yPos = this.yMax - (0.08*this.layoutDoc._height) - Math.tan((angle * Math.PI) / 180) * this.xMax*0.5; + this.dataDoc.startPosX = Math.round((this.xMax * 0.5 - 200) * 10) / 10; - this.dataDoc.startPosY = this.getDisplayYPos(yPos); + this.dataDoc.startPosY = yPos; if (this.dataDoc.mode == "Freeform") { this.updateForcesWithFriction( Number(this.dataDoc.coefficientOfStaticFriction), @@ -1032,8 +997,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { - let xPos = (this.xMax + this.xMin) / 2 - this.radius; + let xPos = (this.xMax + this.xMin) / 2 - (0.08*this.layoutDoc._height); let yPos = this.yMin + 200; this.dataDoc.startPosY = (yPos); this.dataDoc.startPosX = (xPos); @@ -1199,6 +1164,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent