示例#1
0
        public void TestMassProperties()
        {
            Triangle3 testTriangle = new Triangle3(
                new Vector3(100.0f, 100.0f, 100.0f),
                new Vector3(110.0f, 100.0f, 110.0f),
                new Vector3(105.0f, 110.0f, 100.0f)
                );

            Assert.AreEqual(
                new Vector3(105.0f, 103.33333333333333f, 103.33333333333333f), testTriangle.CenterOfMass,
                "Center of mass is correctly positioned"
                );

            Assert.AreEqual(
                74.999999999999972f, testTriangle.Area,
                "Mass of triangle is exactly determined"
                );
            Assert.AreEqual(
                23.45207879911715f, testTriangle.CircumferenceLength,
                "Surface area of triangle is exactly determined"
                );
        }
示例#2
0
    public void TestMassProperties() {
      Triangle3 testTriangle = new Triangle3(
        new Vector3(100.0f, 100.0f, 100.0f),
        new Vector3(110.0f, 100.0f, 110.0f),
        new Vector3(105.0f, 110.0f, 100.0f)
      );

      Assert.AreEqual(
        new Vector3(105.0f, 103.33333333333333f, 103.33333333333333f), testTriangle.CenterOfMass,
        "Center of mass is correctly positioned"
      );

      Assert.AreEqual(
        74.999999999999972f, testTriangle.Area,
        "Mass of triangle is exactly determined"
      );
      Assert.AreEqual(
        23.45207879911715f, testTriangle.CircumferenceLength,
        "Surface area of triangle is exactly determined"
      );

    }
示例#3
0
 /// <summary>Determines where the range clips a triangle</summary>
 /// <param name="triangle">Triangle that will be checked for intersection</param>
 /// <returns>The times at which the range touches the triangle, if at all</returns>
 public LineContacts FindContacts(Triangle3 triangle) {
   LineContacts contacts = Collisions.Line3Triangle3Collider.FindContacts(
     Origin, Direction, triangle.A, triangle.B, triangle.C
   );
   limitContactToRay(ref contacts);
   return contacts;
 }
示例#4
0
    /// <summary>Determines where the range clips a triangle</summary>
    /// <param name="triangle">Triangle that will be checked for intersection</param>
    /// <returns>The times at which the range touches the triangle, if at all</returns>
    public LineContacts FindContacts(Triangle3 triangle) {
      LineContacts contacts = Collisions.Line3Triangle3Collider.FindContacts(
        Start, End - Start, triangle.A, triangle.B, triangle.C
      );
      limitContactToLineSegment(ref contacts);

      return contacts;
    }
示例#5
0
 /// <summary>Determines where the range clips a triangle</summary>
 /// <param name="triangle">Triangle that will be checked for intersection</param>
 /// <returns>The times at which the range touches the triangle, if at all</returns>
 public LineContacts FindContacts(Triangle3 triangle) {
   return Collisions.Line3Triangle3Collider.FindContacts(
     Offset, Direction, triangle.A, triangle.B, triangle.C
   );
 }