コード例 #1
0
        public void TestCorrectResultsMotionWithResistanceHorizontal()
        {
            ProjectileMotionWithResistance motionHorizontal = new ProjectileMotionWithResistance(
                new ProjectileMotionWithResistanceSettings(
                    new ProjectileMotionWithResistanceQuantities(V,
                                                                 new ElevationAngle(ElevationAngle.ElevationAngleTypes.Horizontal),
                                                                 H, G, M, Ρ, A, C, Utilities.UnitsOfResults)
                    )
            {
                PointsForTrajectory = UsePoints
            }
                );

            Utilities.AlmostSame(motionHorizontal.GetTimeHighest(), new Time(0, UnitTime.Basic));
            Utilities.AlmostSame(motionHorizontal.GetTimeHighest(), motionHorizontal.Trajectory.GetInitialPoint().T);
            Utilities.AlmostSame(motionHorizontal.GetMaxDistance(), motionHorizontal.Trajectory.GetInitialPoint().GetDistanceFromPoint(motionHorizontal.Trajectory.GetFinalPoint()));
            Utilities.AlmostSame(motionHorizontal.Trajectory.GetHighestPoint().Y, motionHorizontal.GetMaxHeight());
            Utilities.AlmostSame(motionHorizontal.Trajectory.GetFarthestPoint().Y, motionHorizontal.Trajectory.GetFinalPoint().Y);
            Utilities.AlmostSame(motionHorizontal.Trajectory.GetFarthestPoint().X, motionHorizontal.Trajectory.GetFinalPoint().X);
            Utilities.AlmostSame(motionHorizontal.Trajectory.GetInitialPoint().X, motionHorizontal.Trajectory.GetHighestPoint().X);
            Utilities.AlmostSame(motionHorizontal.Trajectory.GetInitialPoint().Y, motionHorizontal.Trajectory.GetHighestPoint().Y);

            Utilities.AlmostSame(Utilities.GetTrajectoryLengthIteratively(motionHorizontal), motionHorizontal.Trajectory.GetArcLength());
            Utilities.AlmostSame(Utilities.GetAreaUnderTrajectoryIteratively(motionHorizontal), motionHorizontal.Trajectory.GetAreaUnderArc());
            Utilities.AlmostSame(Utilities.GetMaxHeightIteratively(motionHorizontal), motionHorizontal.GetMaxHeight());
            Utilities.AlmostSame(Utilities.GetMaxDistanceIteratively(motionHorizontal), motionHorizontal.GetMaxDistance());
        }
コード例 #2
0
        public void TestCorrectResultsMotionWithResistanceHigh()
        {
            ProjectileMotionWithResistance motion = new ProjectileMotionWithResistance(
                new ProjectileMotionWithResistanceSettings(
                    new ProjectileMotionWithResistanceQuantities(V, new ElevationAngle(82, UnitAngle.Degree), H, G, M, Ρ, A, C, Utilities.UnitsOfResults)
                    )
            {
                PointsForTrajectory = UsePoints
            }
                );

            Utilities.AlmostSame(Utilities.GetTrajectoryLengthIteratively(motion), motion.Trajectory.GetArcLength());
            Utilities.AlmostSame(Utilities.GetAreaUnderTrajectoryIteratively(motion), motion.Trajectory.GetAreaUnderArc());
            Utilities.AlmostSame(Utilities.GetMaxHeightIteratively(motion), motion.GetMaxHeight());
            Utilities.AlmostSame(Utilities.GetMaxDistanceIteratively(motion), motion.GetMaxDistance());

            Assert.IsTrue(motion.GetMaxDistance() > motion.Trajectory.GetFinalPoint().GetDistanceFromPoint(motion.Trajectory.GetInitialPoint()));
            Assert.IsTrue(motion.GetTimeFarthest() > motion.GetTimeHighest());
            Assert.IsTrue(motion.Trajectory.GetFarthestPoint().Y < motion.Trajectory.GetHighestPoint().Y);
        }