Ejemplo n.º 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]);
            }
        }
Ejemplo n.º 2
0
 public override void DrawBegin(Graphics3D graphics)
 {
     foreach (Face face in Faces)
     {
         graphics.AddFace(face);
     }
 }
Ejemplo n.º 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);
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 public override void DrawEnd(Graphics3D graphics)
 {
     Face[] faces = Faces;
     for (int i = 0; i < 4; ++i)
     {
         graphics.AddFace(Faces[i]);
     }
 }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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]);
         }
     }
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 9
0
 public override void DrawEnd(Graphics3D graphics)
 {
     graphics.AddFace(Face);
 }
Ejemplo n.º 10
0
 public override void Draw(Graphics3D graphics)
 {
     foreach (Face face in Faces)
         graphics.AddFace(face);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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]); 
     }
 }
Ejemplo n.º 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);
                        }
                    }
                }
            }

        }