Skip to content

Commit

Permalink
delete MoveHandlesKeyboardHelpSection, phetsims/gas-properties#215
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Apr 22, 2024
1 parent a8c4514 commit e1adcf0
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions js/common/view/PickupCoilAreaNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,16 @@ export default class PickupCoilAreaNode extends Node {
// Position of samplePoint in global coordinates (without allocating anything).
const samplePointPosition = this.reusablePosition.set( pickupCoilPosition ).add( samplePoint );

let chordLength;
const R = pickupCoil.coil.loopRadiusProperty.value;
const d = samplePoint.y; // distance from center of the circle to the chord
let chordLength = 2 * Math.sqrt( Math.abs( R * R - d * d ) );

if ( pickupCoil.magnet.isInside( samplePointPosition ) ) {

// The sample point is inside the magnet. Use the magnet's thickness (depth) so that we do not
// exaggerate the EMF contribution by using the entire cross-section of the coil. The field outside
// the magnet is relatively weak, so ignore its contribution.
chordLength = pickupCoil.magnet.size.depth;
}
else {

// The sample point is outside the magnet. Use the algorithm for distance from center of circle to a
// chord to compute the length of the chord that is perpendicular to the vertical line that goes through
// the sample points. If you're unfamiliar with this algorithm, then see for example
// https://youtu.be/81jh931BkL0?si=2JR-xWRUwjeuagmf.
const R = pickupCoil.coil.loopRadiusProperty.value;
const d = samplePoint.y; // distance from center of the circle to the chord
chordLength = 2 * Math.sqrt( Math.abs( R * R - d * d ) );
chordLength = Math.min( pickupCoil.magnet.size.depth, chordLength );
}

shape.moveTo( -chordLength / 2, samplePoint.y );
Expand Down

0 comments on commit e1adcf0

Please sign in to comment.