From 18e458603d1c672b412c18237be73f6581d58137 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 23 May 2023 12:49:24 -0400 Subject: more physics fixes --- .../nodes/PhysicsBox/PhysicsSimulationBox.tsx | 66 +++++++++++++--------- 1 file changed, 40 insertions(+), 26 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 9d75944f4..35e9c189f 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -19,7 +19,7 @@ import Weight from './PhysicsSimulationWeight'; import React = require('react'); import { BoolCast, NumCast, StrCast } from '../../../../fields/Types'; import { List } from '../../../../fields/List'; -import { computed } from 'mobx'; +import { computed, trace } from 'mobx'; interface IWallProps { length: number; @@ -920,8 +920,8 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent {this.dataDoc.simulation_mode == 'Review' && this.dataDoc.simulation_type != 'Inclined Plane' && (
-

{this.dataDoc.simulation_type} review problems in progress!

+

+ <>{this.dataDoc.simulation_type} review problems in progress! +


)} @@ -1437,7 +1439,7 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent - Speed} lowerBound={1} dataDoc={this.dataDoc} prop="simulation_speed" step={1} unit={'x'} upperBound={10} value={this.dataDoc.simulation_speed ?? 2} labelWidth={'5em'} /> + Speed} lowerBound={1} dataDoc={this.dataDoc} prop="simulation_speed" step={1} unit={'x'} upperBound={10} value={NumCast(this.dataDoc.simulation_speed, 2)} labelWidth={'5em'} /> {this.dataDoc.simulation_paused && this.dataDoc.simulation_type != 'Circular Motion' && ( Gravity} @@ -1639,11 +1641,13 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent - θ: {Math.round(NumCast(this.dataDoc.wedge_angle) * 100) / 100}° ≈ {Math.round(((NumCast(this.dataDoc.wedge_angle) * Math.PI) / 180) * 100) / 100} rad -
- μ s: {this.dataDoc.coefficientOfStaticFriction} -
- μ k: {this.dataDoc.coefficientOfKineticFriction} + <> + θ: {Math.round(NumCast(this.dataDoc.wedge_angle) * 100) / 100}° ≈ {Math.round(((NumCast(this.dataDoc.wedge_angle) * Math.PI) / 180) * 100) / 100} rad +
+ μ s: {this.dataDoc.coefficientOfStaticFriction} +
+ μ k: {this.dataDoc.coefficientOfKineticFriction} + )} {this.dataDoc.simulation_type == 'Pendulum' && !this.dataDoc.simulation_paused && ( @@ -1774,7 +1778,9 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponentPosition {(!this.dataDoc.simulation_paused || this.dataDoc.simulation_type == 'Inclined Plane' || this.dataDoc.simulation_type == 'Circular Motion' || this.dataDoc.simulation_type == 'Pulley') && ( - {this.dataDoc.mass1_positionX} m + + <>{this.dataDoc.mass1_positionX} m + )}{' '} {this.dataDoc.simulation_paused && this.dataDoc.simulation_type != 'Inclined Plane' && this.dataDoc.simulation_type != 'Circular Motion' && this.dataDoc.simulation_type != 'Pulley' && ( { this.dataDoc.mass1_xChange = value; - this.dataDoc.mass1_yChange = this.dataDoc.mass1_positionY; if (this.dataDoc.simulation_type == 'Suspension') { let x1rod = (this.xMax + this.xMin) / 2 - this.radius - this.yMin - 200; let x2rod = (this.xMax + this.xMin) / 2 + this.yMin + 200 + this.radius; @@ -1822,7 +1827,7 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { - this.dataDoc.mass1_xChange = NumCast(this.dataDoc.mass1_positionX); this.dataDoc.mass1_yChange = value; if (this.dataDoc.simulation_type == 'Suspension') { let x1rod = (this.xMax + this.xMin) / 2 - this.radius - this.yMin - 200; @@ -1879,7 +1883,7 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.mass1_velocityXstart = value; this.dataDoc.simulation_reset = !this.dataDoc.simulation_reset; @@ -1924,7 +1928,11 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent )}{' '} - {(!this.dataDoc.simulation_paused || this.dataDoc.simulation_type != 'One Weight') && {this.dataDoc.mass1_velocityY} m/s}{' '} + {(!this.dataDoc.simulation_paused || this.dataDoc.simulation_type != 'One Weight') && ( + + <>{this.dataDoc.mass1_velocityY} m/s + + )}{' '} {this.dataDoc.simulation_paused && this.dataDoc.simulation_type == 'One Weight' && ( { this.dataDoc.mass1_velocityYstart = -value; - this.dataDoc.mass1_xChange = this.dataDoc.mass1_positionX; - this.dataDoc.mass1_yChange = this.dataDoc.mass1_positionY; }} small={true} mode={'Freeform'} @@ -1961,10 +1967,14 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponentAcceleration - {this.dataDoc.mass1_accelerationX} m/s2 + <> + {this.dataDoc.mass1_accelerationX} m/s2 + - {this.dataDoc.mass1_accelerationY} m/s2 + <> + {this.dataDoc.mass1_accelerationY} m/s2 + @@ -2004,10 +2014,14 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponentAcceleration - {this.dataDoc.mass2_accelerationX} m/s2 + <> + {this.dataDoc.mass2_accelerationX} m/s2 + - {this.dataDoc.mass2_accelerationY} m/s2 + <> + {this.dataDoc.mass2_accelerationY} m/s2 + -- cgit v1.2.3-70-g09d2