コード例 #1
0
ファイル: Surface.cs プロジェクト: realisim/realisim
        public Triangle(Point a, Point b, Point c)
        {
            _a = a;
              _b = b;
              _c = c;

              Vector tmp1 = new Vector(a, b);
              Vector tmp2 = new Vector(a, c);
              _polyNormal = tmp1.CrossProduct(tmp2);
              _polyNormal.Normalise();

              CalculatePolygonCenter();
        }
コード例 #2
0
ファイル: Surface.cs プロジェクト: realisim/realisim
        public bool IsFrontFacing(Triangle triangle)
        {
            // on prend en compte que les normales sont unitaires...
              double dot = _polyNormal.DotProduct(triangle._polyNormal);

              Vector vecProj = new Vector(_polyNormal);
              vecProj.MultiplyBy(dot);
              vecProj.Normalise();

              vecProj.AddVector(_polyNormal);
              vecProj.Normalise();

              if(vecProj.Norm >= -Definition.EPSILON && vecProj.Norm <= Definition.EPSILON)
            return false;
              else
            return true;
        }