PlateChargeNode¶
Overview¶
Base class for representation of plate charge. Plate charge is represented as an integer number of '+' or '-' symbols. These symbols are distributed across some portion of the plate's top face.
All model coordinates are relative to the capacitor's local coordinate frame.
@author Chris Malley (PixelZoom, Inc.) @author Jesse Greenberg (PhET Interactive Simulations) @author Sam Reid (PhET Interactive Simulations) @author Andrew Adare (PhET Interactive Simulations)
Class PlateChargeNode¶
Constructor¶
new PlateChargeNode( capacitor, modelViewTransform, options )¶
Instance Methods¶
getGridSize( numberOfObjects, width, height )¶
@param {number} numberOfObjects @param {number} width @param {number} height @private
@returns {Dimension2}
getPlateCharge()¶
Get plate charge from capacitor in the model @public
@returns {number} charge
getContactXOrigin()¶
Gets the x offset (relative to the plate origin) of the portion of the plate that is facing the vacuum gap @public
@returns {number} offset
getContactWidth()¶
Gets the width of the portion of the plate that is in contact with air. @public
@returns {number}
isPositivelyCharged()¶
Returns true if plate is positively charged
paintCanvas( context )¶
Updates the view to match the model. Charges are arranged in a grid.
@param {CanvasRenderingContext2D} context @public
getNumberOfCharges( plateCharge, maxPlateCharge )¶
Computes number of charges, linearly proportional to plate charge. If plate charge is less than half of an electron charge, number of charges is zero. @public
@param {number} plateCharge @param {number} maxPlateCharge @returns {number}
Source Code¶
See the source for PlateChargeNode.js in the scenery-phet repository.