Skip to content

Commit

Permalink
draw rectangles associated with each sample point, #156
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Apr 25, 2024
1 parent 5afdbfb commit bfac75a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions js/common/model/PickupCoil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default class PickupCoil extends FELMovable {

// B-field sample points along the vertical axis of the coil
public readonly samplePointsProperty: TReadOnlyProperty<Vector2[]>;
public readonly samplePointSpacing: number;

// DEBUG: Writeable via developer controls only, when running with &dev query parameter. Dividing the coil's EMF by
// this number will give us the coil's normalized current (see Coil.normalizedCurrentProperty), which determines the
Expand Down Expand Up @@ -196,6 +197,7 @@ export default class PickupCoil extends FELMovable {

this.samplePointsProperty = new DerivedProperty( [ this.coil.loopRadiusProperty ],
loopRadius => createSamplePoints( loopRadius, options.samplePointsSpacing ) );
this.samplePointSpacing = options.samplePointsSpacing;

this.transitionSmoothingScaleProperty = new NumberProperty( options.transitionSmoothingScale, {
range: new Range( 0.1, 1 )
Expand Down
5 changes: 3 additions & 2 deletions js/common/view/PickupCoilAreaNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ export default class PickupCoilAreaNode extends Node {
}
}

shape.moveTo( -chordLength / 2, samplePoint.y );
shape.lineTo( chordLength / 2, samplePoint.y );
// Draw the rectangle for the portion of the coil's area that is associated with this sample point.
shape.rect( -chordLength / 2, samplePoint.y - pickupCoil.samplePointSpacing / 2,
chordLength, pickupCoil.samplePointSpacing );
} );
path.shape = shape;
}
Expand Down

0 comments on commit bfac75a

Please sign in to comment.