Example #1
0
 /// <summary>
 /// test if triangle contains point
 /// </summary>
 /// <param name="pt"></param>
 /// <returns></returns>
 public bool Contains(IVector3 pt)
 {
     try
     {
         GetSideVectors();
         IVector3 v0pt      = pt.Minus(vert[0]);
         IVector3 v1pt      = pt.Minus(vert[1]);
         IVector3 v2pt      = pt.Minus(vert[2]);
         double   testSide0 = v01.Cross(v0pt).Dot(Normal);
         double   testSide1 = v12.Cross(v1pt).Dot(Normal);
         double   testSide2 = v20.Cross(v2pt).Dot(Normal);
         return((testSide0 >= 0) && (testSide1 >= 0) && (testSide2 >= 0));
     }
     catch (Exception)
     {
         throw;
     }
 }