Exemple #1
0
        public override void DrawEnd(Graphics3D graphics)
        {
            Vector3D viewDir = graphics.ViewDirection;
            int[] seg0=null, seg1= null, seg2=null;

            if (viewDir.X < 0.0 && viewDir.Y >= 0.0)
            {
                seg0 = new int[2] { 4, 5 };
                seg1 = new int[2] { 5, 6 };
                seg2 = new int[2] { 1, 5 };
            }
            else if (viewDir.X < 0.0 && viewDir.Y < 0.0)
            {
                seg0 = new int[2] { 5, 6 };
                seg1 = new int[2] { 6, 7 };
                seg2 = new int[2] { 2, 6 };
            }
            else if (viewDir.X >= 0.0 && viewDir.Y < 0.0)
            {
                seg0 = new int[2] { 6, 7 };
                seg1 = new int[2] { 7, 4 };
                seg2 = new int[2] { 3, 7 };
            }
            else if (viewDir.X >= 0.0 && viewDir.Y >= 0.0)
            {
                seg0 = new int[2] { 7, 4 };
                seg1 = new int[2] { 4, 5 };
                seg2 = new int[2] { 0, 4 };
            }
            graphics.AddSegment(new Segment(Points[seg0[0]], Points[seg0[1]], _colorPath) );
            graphics.AddSegment(new Segment(Points[seg1[0]], Points[seg1[1]], _colorPath));
            graphics.AddSegment(new Segment(Points[seg2[0]], Points[seg2[1]], _colorPath));
        }
Exemple #2
0
        public override void DrawEnd(Graphics3D graphics)
        {
            Vector3D viewDir = graphics.ViewDirection;

            int[] seg0 = null, seg1 = null, seg2 = null;

            if (viewDir.X < 0.0 && viewDir.Y >= 0.0)
            {
                seg0 = new int[2] {
                    4, 5
                };
                seg1 = new int[2] {
                    5, 6
                };
                seg2 = new int[2] {
                    1, 5
                };
            }
            else if (viewDir.X < 0.0 && viewDir.Y < 0.0)
            {
                seg0 = new int[2] {
                    5, 6
                };
                seg1 = new int[2] {
                    6, 7
                };
                seg2 = new int[2] {
                    2, 6
                };
            }
            else if (viewDir.X >= 0.0 && viewDir.Y < 0.0)
            {
                seg0 = new int[2] {
                    6, 7
                };
                seg1 = new int[2] {
                    7, 4
                };
                seg2 = new int[2] {
                    3, 7
                };
            }
            else if (viewDir.X >= 0.0 && viewDir.Y >= 0.0)
            {
                seg0 = new int[2] {
                    7, 4
                };
                seg1 = new int[2] {
                    4, 5
                };
                seg2 = new int[2] {
                    0, 4
                };
            }
            graphics.AddSegment(new Segment(Points[seg0[0]], Points[seg0[1]], ColorPath));
            graphics.AddSegment(new Segment(Points[seg1[0]], Points[seg1[1]], ColorPath));
            graphics.AddSegment(new Segment(Points[seg2[0]], Points[seg2[1]], ColorPath));
        }
Exemple #3
0
 public override void DrawEnd(Graphics3D graph)
 {
     foreach (FilmRectangle rectangle in _rectangles)
     {
         double cosA  = System.Math.Abs(Vector3D.DotProduct(rectangle.Normal, graph.ViewDirection));
         Color  color = Color.FromArgb(
             255
             , (int)(rectangle.Color.R * cosA)
             , (int)(rectangle.Color.G * cosA)
             , (int)(rectangle.Color.B * cosA));
         if (Vector3D.DotProduct(rectangle.Normal, graph.ViewDirection) < 0)
         {
             // transparency
             if (HasTransparency)
             {
                 foreach (Face face in rectangle.Faces)
                 {
                     graph.AddFace(face);
                 }
             }
             // hatching
             if (HasHatching)
             {
                 Segment[] segments = rectangle.Segments;
                 foreach (Segment s in segments)
                 {
                     s.Color = color;
                     graph.AddSegment(s);
                 }
             }
         }
     }
 }
        private void DrawLayerBoundingBox(Graphics3D graphics, BBox3D bbox)
        {
            Vector3D ptMin = bbox.PtMin;
            Vector3D ptMax = bbox.PtMax;

            Vector3D[] vertices =
            {
                new Vector3D(ptMin.X, ptMin.Y,              ptMin.Z)          // 0
                ,                     new Vector3D(ptMax.X, ptMin.Y, ptMin.Z) // 1
                ,                     new Vector3D(ptMax.X, ptMax.Y, ptMin.Z) // 2
                ,                     new Vector3D(ptMin.X, ptMax.Y, ptMin.Z) // 3
                ,                     new Vector3D(ptMin.X, ptMin.Y, ptMax.Z) // 4
                ,                     new Vector3D(ptMax.X, ptMin.Y, ptMax.Z) // 5
                ,                     new Vector3D(ptMax.X, ptMax.Y, ptMax.Z) // 6
                ,                     new Vector3D(ptMin.X, ptMax.Y, ptMax.Z) // 7
            };
            Face[] faces =
            {
                new Face(0, vertices[0], vertices[1], vertices[5], vertices[4], false),
                new Face(0, vertices[1], vertices[2], vertices[6], vertices[5], false),
                new Face(0, vertices[2], vertices[3], vertices[7], vertices[6], false),
                new Face(0, vertices[3], vertices[0], vertices[4], vertices[7], false),
            };

            foreach (Face f in faces)
            {
                if (f.IsVisible(ViewDir))
                {
                    Vector3D[] points = f.Points;
                    graphics.AddSegment(new Segment(points[0], points[1], Color.Red));
                    graphics.AddSegment(new Segment(points[1], points[2], Color.Red));
                    graphics.AddSegment(new Segment(points[2], points[3], Color.Red));
                    graphics.AddSegment(new Segment(points[3], points[0], Color.Red));
                }
            }
        }
        private void DrawLayerBoundingBox(Graphics3D graphics, BBox3D bbox)
        {
            Vector3D ptMin = bbox.PtMin;
            Vector3D ptMax = bbox.PtMax;

            Vector3D[] vertices = {
                            new Vector3D(ptMin.X, ptMin.Y, ptMin.Z)       // 0
                            , new Vector3D(ptMax.X, ptMin.Y, ptMin.Z)     // 1
                            , new Vector3D(ptMax.X, ptMax.Y, ptMin.Z)     // 2
                            , new Vector3D(ptMin.X, ptMax.Y, ptMin.Z)     // 3
                            , new Vector3D(ptMin.X, ptMin.Y, ptMax.Z)     // 4
                            , new Vector3D(ptMax.X, ptMin.Y, ptMax.Z)     // 5
                            , new Vector3D(ptMax.X, ptMax.Y, ptMax.Z)     // 6
                            , new Vector3D(ptMin.X, ptMax.Y, ptMax.Z)     // 7
                        };
            Face[] faces = {
                            new Face(0, vertices[0], vertices[1], vertices[5], vertices[4], false),
                            new Face(0, vertices[1], vertices[2], vertices[6], vertices[5], false),
                            new Face(0, vertices[2], vertices[3], vertices[7], vertices[6], false),
                            new Face(0, vertices[3], vertices[0], vertices[4], vertices[7], false),
                        };

            foreach (Face f in faces)
            {
                if (f.IsVisible(ViewDir))
                {
                    Vector3D[] points = f.Points;
                    graphics.AddSegment(new Segment(points[0], points[1], Color.Red));
                    graphics.AddSegment(new Segment(points[1], points[2], Color.Red));
                    graphics.AddSegment(new Segment(points[2], points[3], Color.Red));
                    graphics.AddSegment(new Segment(points[3], points[0], Color.Red));
                }
            }
        }
Exemple #6
0
        public override void DrawEnd(Graphics3D graph)
        {
            foreach (FilmRectangle rectangle in _rectangles)
            {
                double cosA = System.Math.Abs(Vector3D.DotProduct(rectangle.Normal, graph.ViewDirection));
                Color color = Color.FromArgb(
                    255
                    , (int)(rectangle.Color.R * cosA)
                    , (int)(rectangle.Color.G * cosA)
                    , (int)(rectangle.Color.B * cosA));
                if (Vector3D.DotProduct(rectangle.Normal, graph.ViewDirection) < 0)
                {
                    // transparency
                    if (HasTransparency)
                    {
                        foreach (Face face in rectangle.Faces)
                            graph.AddFace(face);
                    }
                    // hatching
                    if (HasHatching)
                    {
                        Segment[] segments = rectangle.Segments;
                        foreach (Segment s in segments)
                        {
                            s.Color = color;
                            graph.AddSegment(s);
                        }
                    }
                }
            }

        }