示例#1
0
        public void TestBoundingSphere()
        {
            Cylinder3 testCylinder = new Cylinder3(
                Matrix.CreateTranslation(new Vector3(100.0f, 200.0f, 300.0f)), 10.0f, 20.0f
                );
            Sphere3 boundingSphere = testCylinder.BoundingSphere;

            GeoAssertHelper.AreAlmostEqual(
                new Vector3(100.0f, 200.0f, 300.0f), boundingSphere.Center,
                Specifications.MaximumDeviation, "Center of bounding sphere correctly determined"
                );

            Assert.That(
                boundingSphere.Radius,
                Is.EqualTo(14.142135623730950488016887242097f).Within(
                    Specifications.MaximumDeviation
                    ).Ulps,
                "Radius of bounding sphere exactly encloses the box"
                );
        }
示例#2
0
    public void TestMassProperties() {
      Cylinder3 testCylinder = new Cylinder3(
        Matrix.CreateTranslation(new Vector3(100.0f, 200.0f, 300.0f)), 10.0f, 20.0f
      );

      Assert.AreEqual(
        new Vector3(100.0f, 200.0f, 300.0f), testCylinder.CenterOfMass,
        "Center of mass is correctly positioned"
      );

      // Formula for cylinder surface area: 2 * pi * (r ^ 2) + 2 * pi * r * h
      Assert.AreEqual(
        1884.9555921538759430775860299677f, testCylinder.SurfaceArea,
        Specifications.MaximumDeviation, "Surface area of cylinder is exactly determined"
      );

      // Formula for cylinder volume: pi * (r ^ 2) * h
      Assert.AreEqual(
        6283.185307179586476925286766559f, testCylinder.Mass,
        Specifications.MaximumDeviation, "Mass of cylinder is exactly determined"
      );
    }
示例#3
0
        public void TestMassProperties()
        {
            Cylinder3 testCylinder = new Cylinder3(
                Matrix.CreateTranslation(new Vector3(100.0f, 200.0f, 300.0f)), 10.0f, 20.0f
                );

            Assert.AreEqual(
                new Vector3(100.0f, 200.0f, 300.0f), testCylinder.CenterOfMass,
                "Center of mass is correctly positioned"
                );

            // Formula for cylinder surface area: 2 * pi * (r ^ 2) + 2 * pi * r * h
            Assert.AreEqual(
                1884.9555921538759430775860299677f, testCylinder.SurfaceArea,
                Specifications.MaximumDeviation, "Surface area of cylinder is exactly determined"
                );

            // Formula for cylinder volume: pi * (r ^ 2) * h
            Assert.AreEqual(
                6283.185307179586476925286766559f, testCylinder.Mass,
                Specifications.MaximumDeviation, "Mass of cylinder is exactly determined"
                );
        }
示例#4
0
 /// <summary>Visit a cylinder</summary>
 /// <param name="cylinder">Cylinder to visit</param>
 public abstract void Visit(Cylinder3 cylinder);
示例#5
0
 /// <summary>Visit a cylinder</summary>
 /// <param name="cylinder">Cylinder to visit</param>
 public abstract void Visit(Cylinder3 cylinder);
示例#6
0
文件: Cylinder3.cs 项目: minskowl/MY
 public Cylinder3(Cylinder3 other)
     : this(other.Transform, other.Radius, other.Height)
 {
 }
示例#7
0
 public Cylinder3(Cylinder3 other)
   : this(other.Transform, other.Radius, other.Height) { }
示例#8
0
    public void TestBoundingSphere() {
      Cylinder3 testCylinder = new Cylinder3(
        Matrix.CreateTranslation(new Vector3(100.0f, 200.0f, 300.0f)), 10.0f, 20.0f
      );
      Sphere3 boundingSphere = testCylinder.BoundingSphere;

      GeoAssertHelper.AreAlmostEqual(
        new Vector3(100.0f, 200.0f, 300.0f), boundingSphere.Center,
        Specifications.MaximumDeviation, "Center of bounding sphere correctly determined"
      );

      Assert.That(
        boundingSphere.Radius,
        Is.EqualTo(14.142135623730950488016887242097f).Within(
          Specifications.MaximumDeviation
        ).Ulps,
        "Radius of bounding sphere exactly encloses the box"
      );
    }