Example #1
0
        void DrawPolygon(Base3D.Polygon pol, List <Base3D.Point> points, Pen pen)
        {
            if (pol.indexes.Length < 3)
            {
                return;
            }

            var polyPoints = pol.Points(points);

            if (hideInvisible)
            {
                if (polyPoints.Any(p => !context.BeforeScreen(p.X)))
                {
                    return;
                }
                var v1   = polyPoints[1] - polyPoints[0];
                var v2   = polyPoints[2] - polyPoints[0];
                var prod = new Base3D.Point
                {
                    X = v1.Y * v2.Z - v2.Y * v1.Z,
                    Y = v1.Z * v2.X - v2.Z * v1.X,
                    Z = v1.X * v2.Y - v2.X * v1.Y
                };

                if (prod.X > 0)
                {
                    return;
                }
                if (prod.Length() == 0)
                {
                    return;
                }
            }
            var end = polyPoints.Aggregate((p1, p2) => { DrawLine(p1, p2, pen); return(p2); });

            DrawLine(end, polyPoints.First(), pen);
        }
Example #2
0
 void DrawPolygon(Base3D.Polygon pol, List <Base3D.Point> points,
                  List <Base3D.Point> normals, List <(double X, double Y)> textures, BaseMaterial material)