-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial beam splitter, flesh out Photons model a bit more
- Loading branch information
Showing
3 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright 2024, University of Colorado Boulder | ||
|
||
/** | ||
* PolarizingBeamSplitter is a model element that represents a device that splits a beam of photons into two beams based | ||
* on the polarization of the photons. | ||
* | ||
* @author John Blanco, PhET Interactive Simulations | ||
*/ | ||
|
||
import NumberProperty from '../../../../axon/js/NumberProperty.js'; | ||
import Property from '../../../../axon/js/Property.js'; | ||
import Vector2 from '../../../../dot/js/Vector2.js'; | ||
import { Line } from '../../../../kite/js/imports.js'; | ||
import { EmptySelfOptions } from '../../../../phet-core/js/optionize.js'; | ||
import PickRequired from '../../../../phet-core/js/types/PickRequired.js'; | ||
import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js'; | ||
import quantumMeasurement from '../../quantumMeasurement.js'; | ||
|
||
type SelfOptions = EmptySelfOptions; | ||
type PolarizingBeamSplitterOptions = SelfOptions & PickRequired<PhetioObjectOptions, 'tandem'>; | ||
|
||
export type PresetPolarizationDirections = ( [ 'vertical', 'horizontal', 'fortyFiveDegrees', 'custom' ] )[number]; | ||
|
||
// constants | ||
const WIDTH = 0.1; // the width, in meters, of the beam splitter | ||
const ROTATIONAL_ANGLE = Math.PI / 4; // the angle at which the beam splitter is rotated, in radians, zero is horizontal | ||
|
||
export default class PolarizingBeamSplitter { | ||
|
||
// The position of the center of the beam splitter in two-dimensional space. Units are in meters. | ||
public readonly centerPosition: Vector2; | ||
|
||
// A line in model space that represents the position of the beam splitter. | ||
public readonly positionalLine: Line; | ||
|
||
// The direction of polarization that the beam splitter is set to. This can be one of the preset directions or a | ||
// custom angle. | ||
public readonly presetPolarizationDirectionProperty: Property<PresetPolarizationDirections>; | ||
|
||
// The custom angle at which the beam splitter is set, in degrees. This is only used when the preset direction is | ||
// "custom". | ||
public readonly customPolarizationAngleProperty: NumberProperty; | ||
|
||
public constructor( centerPosition: Vector2, providedOptions: PolarizingBeamSplitterOptions ) { | ||
this.centerPosition = centerPosition; | ||
|
||
// Initialize the line that represents the position of the beam splitter in the model. | ||
const endpoint1 = centerPosition.plusXY( WIDTH / 2, 0 ).rotated( ROTATIONAL_ANGLE ); | ||
const endpoint2 = centerPosition.plusXY( -WIDTH / 2, 0 ).rotated( ROTATIONAL_ANGLE ); | ||
this.positionalLine = new Line( endpoint1, endpoint2 ); | ||
|
||
this.presetPolarizationDirectionProperty = new Property<PresetPolarizationDirections>( 'fortyFiveDegrees', { | ||
tandem: providedOptions.tandem.createTandem( 'presetPolarizationDirectionProperty' ) | ||
} ); | ||
this.customPolarizationAngleProperty = new NumberProperty( 45, { | ||
tandem: providedOptions.tandem.createTandem( 'customPolarizationAngleProperty' ) | ||
} ); | ||
} | ||
} | ||
|
||
quantumMeasurement.register( 'PolarizingBeamSplitter', PolarizingBeamSplitter ); |