diff options
author | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-02-07 17:10:23 -0500 |
---|---|---|
committer | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-02-07 17:10:23 -0500 |
commit | d757d90c4c5a5609c3c8bca874414e8a5171556c (patch) | |
tree | 3b4b076d64b4f5f33afe577d2cdf8781d719924d /src/client/views/nodes/PhysicsSimulationApp.tsx | |
parent | 2387225f18bd63f70569df7039af445064738836 (diff) |
pendulum works
Diffstat (limited to 'src/client/views/nodes/PhysicsSimulationApp.tsx')
-rw-r--r-- | src/client/views/nodes/PhysicsSimulationApp.tsx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/client/views/nodes/PhysicsSimulationApp.tsx b/src/client/views/nodes/PhysicsSimulationApp.tsx index f31d92db2..6a3ab28a0 100644 --- a/src/client/views/nodes/PhysicsSimulationApp.tsx +++ b/src/client/views/nodes/PhysicsSimulationApp.tsx @@ -146,16 +146,15 @@ export default class App extends React.Component<{}, IState> { this.setState({weight: true}) this.setState({wedge: false}) this.setState({pendulum: true}) - let length = 300; - let angle = 50; + let length = this.xMax*0.7; + let angle = 40; let x = length * Math.cos(((90 - angle) * Math.PI) / 180); let y = length * Math.sin(((90 - angle) * Math.PI) / 180); - let xPos = this.xMax / 2 - x - 50; - let yPos = y - 50 - 5; - this.addPendulum(); + let xPos = this.xMax / 2 - x - this.radius; + let yPos = y - this.radius; this.setState({startPosX: xPos}) this.setState({startPosY: yPos}) - let mag = 9.81 * Math.cos((50 * Math.PI) / 180); + let mag = 9.81 * Math.cos((angle * Math.PI) / 180); let forceOfTension: IForce = { description: "Tension", magnitude: mag, @@ -163,9 +162,9 @@ export default class App extends React.Component<{}, IState> { }; this.setState({updatedForces: [this.forceOfGravity, forceOfTension]}) this.setState({startForces: [this.forceOfGravity, forceOfTension]}) - this.setState({pendulumAngle: 50}) - this.setState({pendulumLength: 300}) - this.setState({adjustPendulumAngle: {angle: 50, length: 300}}) + this.setState({pendulumAngle: 40}) + this.setState({pendulumLength: 100}) + this.setState({adjustPendulumAngle: {angle: 40, length: 100}}) this.removeWalls(); }; @@ -289,7 +288,7 @@ export default class App extends React.Component<{}, IState> { componentDidMount() { // Add weight - this.addWedge() + this.addPendulum() // Add listener for SHIFT key, which determines if sketch force arrow will be edited or deleted on click document.addEventListener("keydown", (e) => { |