/// <summary> /// 12. Constructor for a projectile motion Quantities. Computes an initial velocity based on the duration and the length. /// </summary> /// <param name="α">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(ElevationAngle α, Length l, Duration dur, GravAcceleration g, ProjectileMotionResultsUnits units = null) { Units = units ?? new ProjectileMotionResultsUnits(); Α = α; G = g; V = new InitialVelocity( GetResultWithComputeExpection( l.GetBasicVal() == 0 && dur.GetBasicVal() == 0 && Α.GetBasicVal() > 0 ? 0 : l.GetBasicVal() / (Math.Cos(Α.GetBasicVal()) * dur.GetBasicVal()) ), UnitVelocity.Basic ).Convert(Units.Velocity); 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.InitialVelocityByLengthAndDur; }
/// <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> /// 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; }
/// <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> /// 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; }