From 64216d20862e22638585e426717b92e90c2f0ad4 Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Sun, 11 Jul 2021 06:30:06 +0200 Subject: [PATCH] Wrapped the distance between a point and a line calculation in a Helper function. --- .../@MOTSimulator/calculateLocalSaturationIntensity.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/MOT Capture Process Simulation/@MOTSimulator/calculateLocalSaturationIntensity.m b/MOT Capture Process Simulation/@MOTSimulator/calculateLocalSaturationIntensity.m index d10ffa8..5bc099a 100644 --- a/MOT Capture Process Simulation/@MOTSimulator/calculateLocalSaturationIntensity.m +++ b/MOT Capture Process Simulation/@MOTSimulator/calculateLocalSaturationIntensity.m @@ -1,12 +1,6 @@ function ret = calculateLocalSaturationIntensity(~, PeakIntensity, PositionVector, WaveVectorOrigin, WaveVectorEndPoint, BeamRadius, BeamWaist) - WaveVector = WaveVectorEndPoint - WaveVectorOrigin; % Line - PositionVectorFromWaveVectorOrigin = PositionVector - WaveVectorOrigin; % Point = PositionVector - %Height of parallelogram (Distance between point and line) = Area of parallelogram / Base - %One side of parallelogram = PositionVectorFromWaveVectorOrigin - %Base = Wavevector - %Area = One side of parallelogram X Base - DistanceBetweenAtomAndLaserBeamAxis = norm(cross(PositionVectorFromWaveVectorOrigin, WaveVector))./ norm(WaveVector); + DistanceBetweenAtomAndLaserBeamAxis = Helper.calculateDistanceFromPointToLine(PositionVector, WaveVectorOrigin, WaveVectorEndPoint); if DistanceBetweenAtomAndLaserBeamAxis <= BeamRadius ret = PeakIntensity * exp(-2*DistanceBetweenAtomAndLaserBeamAxis^2 / BeamWaist^2);