Exemple #1
0
        public override void DrawEnd(Graphics3D graphics)
        {
            // sanity check
            if (_height <= 1.0E-3)
            {
                return;
            }

            Face[] faces = Faces;
            if (Vector3D.DotProduct(faces[0].Normal, graphics.ViewDirection) <= 0.0)
            {
                for (int i = 0; i < 4; ++i)
                {
                    graphics.AddFace(faces[i]);
                }
            }
            if (Vector3D.DotProduct(faces[4].Normal, graphics.ViewDirection) <= 0.0)
            {
                for (int i = 4; i < 8; ++i)
                {
                    graphics.AddFace(faces[i]);
                }
            }
            if (Math.Abs(Vector3D.DotProduct(faces[0].Normal, graphics.ViewDirection)) < 1.0E-3)
            {
                graphics.AddFace(faces[3]);
            }

            if (Math.Abs(Vector3D.DotProduct(faces[4].Normal, graphics.ViewDirection)) < 1.0E-3)
            {
                graphics.AddFace(faces[7]);
            }
        }
Exemple #2
0
 public override void DrawBegin(Graphics3D graphics)
 {
     foreach (Face face in Faces)
     {
         graphics.AddFace(face);
     }
 }
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);
                 }
             }
         }
     }
 }
Exemple #4
0
 public override void DrawEnd(Graphics3D graphics)
 {
     Face[] faces = Faces;
     for (int i = 0; i < 4; ++i)
     {
         graphics.AddFace(Faces[i]);
     }
 }
Exemple #5
0
        private void AddFace(Graphics3D graphics, Vector3D p0, Vector3D p1)
        {
            var pt0 = p0 + 0.5 * Width * Axis;
            var pt1 = p0 - 0.5 * Width * Axis;
            var pt2 = p1 - 0.5 * Width * Axis;
            var pt3 = p1 + 0.5 * Width * Axis;

            graphics.AddFace(new Face(0, new Vector3D[] { pt0, pt1, pt2, pt3 }, Color, Color.Black, "STRAPPER"));
        }
Exemple #6
0
 public override void DrawEnd(Graphics3D graphics)
 {
     Face[] faces = Faces;
     if (Vector3D.DotProduct(faces[0].Normal, graphics.ViewDirection) <= 0.0)
     {
         for (int i = 0; i < 4; ++i)
         {
             graphics.AddFace(faces[i]);
         }
     }
     if (Vector3D.DotProduct(faces[4].Normal, graphics.ViewDirection) <= 0.0)
     {
         for (int i = 4; i < 8; ++i)
         {
             graphics.AddFace(faces[i]);
         }
     }
 }
Exemple #7
0
 public void DrawInside(Graphics3D graphics, Transform3D transform)
 {
     Face[] faces = InsideFaces;
     for (int i = 0; i < 6; ++i)
     {
         faces[i].IsSolid = false;
     }
     foreach (Face face in faces)
     {
         graphics.AddFace(face.Transform(transform));
     }
 }
Exemple #8
0
 public void DrawInside(Graphics3D graphics)
 {
     Face[] faces = Faces;
     for (int i = 0; i < 6; ++i)
     {
         faces[i].IsSolid = false;
     }
     foreach (Face face in faces)
     {
         graphics.AddFace(face);
     }
 }
Exemple #9
0
 public override void DrawEnd(Graphics3D graphics)
 {
     graphics.AddFace(Face);
 }
Exemple #10
0
 public override void Draw(Graphics3D graphics)
 {
     foreach (Face face in Faces)
         graphics.AddFace(face);
 }
Exemple #11
0
 public void DrawInside(Graphics3D graphics)
 {
     Face[] faces = Faces;
     for (int i = 0; i < 6; ++i)
         faces[i].IsSolid = false;
     foreach (Face face in faces)
         graphics.AddFace(face);
 }
Exemple #12
0
 public override void DrawEnd(Graphics3D graphics)
 {
     Face[] faces = Faces;
     if (Vector3D.DotProduct(faces[0].Normal, graphics.ViewDirection) <= 0.0)
     {
         for (int i = 0; i < 4; ++i)
         {
             graphics.AddFace(faces[i]);
         }
     }
     if (Vector3D.DotProduct(faces[4].Normal, graphics.ViewDirection) <= 0.0)
     {
         for (int i = 4; i < 8; ++i)
             graphics.AddFace(faces[i]); 
     }
 }
Exemple #13
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);
                        }
                    }
                }
            }

        }