/// <summary> /// 7. Constructor for a projectile motion Quantities. Computes an elevation angle based on the length. /// </summary> /// <param name="v">An initial velocity.</param> /// <param name="l">The length.</param> /// <param name="h">An initial height.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(Length l, InitialVelocity v, InitialHeight h, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); V = v; H = h; G = g; Α = new ElevationAngle( GetResultWithComputeExpection( l.GetBasicVal() == 0 && H.GetBasicVal() == 0 ? double.NaN : EquationSolver.BisectionFindRoot( a => V.GetBasicVal() * Math.Cos(a) * ( V.GetBasicVal() * Math.Sin(a) + Math.Sqrt(Math.Pow(V.GetBasicVal() * Math.Sin(a), 2) + 2.0 * G.GetBasicVal() * H.GetBasicVal()) ) / G.GetBasicVal() - l.GetBasicVal(), 0, new ElevationAngle(ElevationAngle.ElevationAngleTypes.Right).Val, 1E-4 ) ), UnitAngle.Basic ).Convert(Units.Angle); UsedAssignmentType = AssignmentsTypes.ElevationAngleByLength; }
/// <summary> /// 13. Constructor for a projectile motion Quantities. Computes an elevation angle based on the duration and the length. /// </summary> /// <param name="v">An initial velocity.</param> /// <param name="l">The length.</param> /// <param name="dur">The duration.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(InitialVelocity v, Length l, Duration dur, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); G = g; V = v; Α = new ElevationAngle( GetResultWithComputeExpection( l.GetBasicVal() == 0 && dur.GetBasicVal() == 0 && V.GetBasicVal() > 0 ? 0 : Math.Acos(l.GetBasicVal() / (V.GetBasicVal() * dur.GetBasicVal())) ), UnitAngle.Basic ).Convert(Units.Angle); H = new InitialHeight( GetResultWithComputeExpection( 0.5 * G.GetBasicVal() * Math.Pow(dur.GetBasicVal(), 2.0) - Math.Sin(Α.GetBasicVal()) * V.GetBasicVal() * dur.GetBasicVal() ), UnitLength.Basic ).Convert(Units.Length); UsedAssignmentType = AssignmentsTypes.ElevationAngleByLengthAndDur; }
/// <summary> /// 11. Constructor for a projectile motion Quantities. Computes an elevation angle for motion with maximum range. /// </summary> /// <param name="v">An initial velocity.</param> /// <param name="h">An initial height.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(InitialVelocity v, InitialHeight h, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); V = v; H = h; G = g; Α = new ElevationAngle( GetResultWithComputeExpection( Math.Acos( Math.Sqrt( (2.0 * G.GetBasicVal() * H.GetBasicVal() + Math.Pow(V.GetBasicVal(), 2.0)) / (2.0 * G.GetBasicVal() * H.GetBasicVal() + 2.0 * Math.Pow(V.GetBasicVal(), 2.0)) ) ) ), UnitAngle.Basic ).Convert(Units.Angle); UsedAssignmentType = AssignmentsTypes.ElevationAngleGetMaxRange; }
/// <summary> /// 4. Constructor for a projectile motion Quantities. Computes an initial height based on the duration. /// </summary> /// <param name="α">An elevation angle.</param> /// <param name="dur">The duration.</param> /// <param name="v">An initial velocity.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(Duration dur, ElevationAngle α, InitialVelocity v, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); V = v; Α = α; G = g; H = new InitialHeight( GetResultWithComputeExpection( (Math.Pow(dur.GetBasicVal(), 2.0) * G.GetBasicVal() - 2.0 * Math.Sin(Α.GetBasicVal()) * dur.GetBasicVal() * V.GetBasicVal()) / 2.0 ), UnitLength.Basic).Convert(Units.Length); UsedAssignmentType = AssignmentsTypes.InitialHeightByDuration; }
/// <summary> /// 3. Constructor for a projectile motion Quantities. Computes an initial velocity based on the duration. /// </summary> /// <param name="α">An elevation angle.</param> /// <param name="dur">The duration.</param> /// <param name="h">An initial height.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(Duration dur, ElevationAngle α, InitialHeight h, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); Α = α; H = h; G = g; V = new InitialVelocity( GetResultWithComputeExpection( dur.GetBasicVal() == 0 && H.GetBasicVal() == 0 ? 0 : (Math.Pow(dur.GetBasicVal(), 2.0) * G.GetBasicVal() - 2 * H.GetBasicVal()) / (2.0 * Math.Sin(Α.GetBasicVal()) * dur.GetBasicVal()) ), UnitVelocity.Basic).Convert(Units.Velocity); UsedAssignmentType = AssignmentsTypes.InitialVelocityByDuration; }
/// <summary> /// 2. Constructor for a projectile motion Quantities. Computes an elevation angle based on the duration. /// </summary> /// <param name="v">An initial velocity.</param> /// <param name="dur">The duration.</param> /// <param name="h">An initial height.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(Duration dur, InitialVelocity v, InitialHeight h, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); V = v; H = h; G = g; Α = new ElevationAngle( GetResultWithComputeExpection( V.GetBasicVal() > 0 && H.GetBasicVal() == 0 && dur.GetBasicVal() == 0 ? 0 : Math.Asin( (Math.Pow(dur.GetBasicVal(), 2.0) * G.GetBasicVal() - 2 * H.GetBasicVal()) / (2.0 * V.GetBasicVal() * dur.GetBasicVal()) ) ), UnitAngle.Basic).Convert(Units.Angle); UsedAssignmentType = AssignmentsTypes.ElevationAngleByDuration; }
/// <summary> /// 10. Constructor for a projectile motion Quantities. Computes an elevation angle based on the maximal height. /// </summary> /// <param name="v">An initial velocity.</param> /// <param name="dur">The maximal height.</param> /// <param name="h">An initial height.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(MaximalHeight maxHeight, InitialVelocity v, InitialHeight h, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); V = v; H = h; G = g; Α = new ElevationAngle( GetResultWithComputeExpection( maxHeight.GetBasicVal() == 0 && H.GetBasicVal() == 0 ? double.NaN : Math.Asin(Math.Sqrt( 2.0 * G.GetBasicVal() * (maxHeight.GetBasicVal() - H.GetBasicVal()) / Math.Pow(V.GetBasicVal(), 2) )) ), UnitAngle.Basic ).Convert(Units.Angle); UsedAssignmentType = AssignmentsTypes.ElevationAngleByMaxHeight; }
/// <summary> /// 8. Constructor for a projectile motion Quantities. Computes an initial velocity based on the maximal height. /// </summary> /// <param name="α">An elevation angle.</param> /// <param name="maxHeight">The maximal height.</param> /// <param name="h">An initial height.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(MaximalHeight maxHeight, ElevationAngle α, InitialHeight h, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); Α = α; H = h; G = g; V = new InitialVelocity( GetResultWithComputeExpection( maxHeight.GetBasicVal() == 0 && H.GetBasicVal() == 0 ? Α.GetBasicVal() == 0 ? double.NaN : 0 : Math.Sqrt( 2.0 * G.GetBasicVal() * (maxHeight.GetBasicVal() - H.GetBasicVal()) / Math.Pow(Math.Sin(Α.GetBasicVal()), 2.0) ) ), UnitVelocity.Basic ).Convert(Units.Velocity); UsedAssignmentType = AssignmentsTypes.InitialVelocityByMaxHeight; }
/// <summary> /// 5. Constructor for a projectile motion Quantities. Computes an initial height based on the length. /// </summary> /// <param name="α">An elevation angle.</param> /// <param name="l">The length.</param> /// <param name="v">An initial velocity.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(Length l, ElevationAngle α, InitialVelocity v, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); V = v; Α = α; G = g; H = new InitialHeight( GetResultWithComputeExpection( Α.IsRight() ? double.NaN : ( Math.Pow(l.GetBasicVal(), 2.0) * G.GetBasicVal() / Math.Pow(Math.Cos(Α.GetBasicVal()), 2.0) - 2.0 * l.GetBasicVal() * Math.Pow(V.GetBasicVal(), 2.0) * Math.Tan(Α.GetBasicVal()) ) / (2.0 * Math.Pow(V.GetBasicVal(), 2.0)) ), UnitLength.Basic ).Convert(Units.Length); UsedAssignmentType = AssignmentsTypes.InitialHeightByLength; }
/// <summary> /// 6. Constructor for a projectile motion Quantities. Computes an initial velocity based on the length. /// </summary> /// <param name="α">An elevation angle.</param> /// <param name="l">The length.</param> /// <param name="h">An initial height.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(Length l, ElevationAngle α, InitialHeight h, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); Α = α; H = h; G = g; V = new InitialVelocity( GetResultWithComputeExpection( Α.IsRight() ? double.NaN : l.GetBasicVal() == 0 && H.GetBasicVal() == 0 && Α.GetBasicVal() > 0 ? 0 : l.GetBasicVal() * Math.Sqrt(G.GetBasicVal() / Math.Cos(Α.GetBasicVal())) / Math.Sqrt( 2.0 * l.GetBasicVal() * Math.Sin(Α.GetBasicVal()) + 2.0 * H.GetBasicVal() * Math.Cos(Α.GetBasicVal()) ) ), UnitVelocity.Basic ).Convert(Units.Velocity); UsedAssignmentType = AssignmentsTypes.InitialVelocityByLength; }
/// <summary> /// 9. Constructor for a projectile motion Quantities. Computes an initial height based on the maximal height. /// </summary> /// <param name="α">An elevation angle.</param> /// <param name="maxHeight">The maximal height.</param> /// <param name="v">An initial velocity.</param> /// <param name="g">A gravitation acceleration of the planet.</param> /// <param name="units">The units of Quantities. By default metre per second, radian, metre and metre per square second.</param> public ProjectileMotionQuantities(MaximalHeight maxHeight, ElevationAngle α, InitialVelocity v, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); V = v; Α = α; G = g; H = new InitialHeight( GetResultWithComputeExpection( maxHeight.GetBasicVal() - Math.Pow(V.GetBasicVal() * Math.Sin(Α.GetBasicVal()), 2.0) / (2.0 * G.GetBasicVal()) ), UnitLength.Basic ).Convert(Units.Length); UsedAssignmentType = AssignmentsTypes.InitialHeightByMaxHeight; }