public void validate_static_method_updatepolarangleFordirectionalsources() { var polAngle = SourceToolbox.UpdatePolarAngleForDirectionalSources( _outerRadius, _innerRadius, _polarAngle); Assert.Less(Math.Abs(polAngle - _tp[136]), ACCEPTABLE_PRECISION); }
/// <summary> /// Returns direction for a given position /// </summary> /// <param name="position">position</param> /// <returns>new direction</returns> protected override Direction GetFinalDirection(Position position) { if (_lineLength == 0.0) { return(SourceToolbox.GetDirectionForGivenPolarAzimuthalAngleRangeRandom( new DoubleRange(0.0, Math.Abs(_thetaConvOrDiv)), SourceDefaults.DefaultAzimuthalAngleRange.Clone(), Rng)); } // sign is negative for diverging and positive positive for converging var polarAngle = SourceToolbox.UpdatePolarAngleForDirectionalSources( 0.5 * _lineLength, position.X, _thetaConvOrDiv); return(SourceToolbox.GetDirectionForGiven2DPositionAndGivenPolarAngle(polarAngle, position)); }
/// <summary> /// Returns direction for a given position /// </summary> /// <param name="position">position</param> /// <returns>new direction</returns> protected override Direction GetFinalDirection(Position position) { if ((_rectLengthX == 0.0) && (_rectWidthY == 0.0)) { return(SourceToolbox.GetDirectionForGivenPolarAzimuthalAngleRangeRandom( new DoubleRange(0.0, Math.Abs(_thetaConvOrDiv)), SourceDefaults.DefaultAzimuthalAngleRange.Clone(), Rng)); } else { // sign is negative for diverging and positive positive for converging var polarAngle = SourceToolbox.UpdatePolarAngleForDirectionalSources( _rectLengthX, Math.Sqrt(position.X * position.X + position.Y * position.Y), _thetaConvOrDiv); return(SourceToolbox.GetDirectionForGiven2DPositionAndGivenPolarAngle(polarAngle, position)); } }