예제 #1
0
        public void Visit(Box3D box)
        {
            Shape3DComposite composite = new Shape3DComposite();
            composite.CoordinateSystem = box.CoordinateSystem;

            float dx = box.Width / 2;
            float dy = box.Height / 2;
            float dz = box.Depth / 2;

            var top = new Rectangle3D {
                A = new Vector3D(-dx, -dy, -dz),
                B = new Vector3D(-dx, -dy, +dz),
                C = new Vector3D(+dx, -dy, -dz),
                Material = box.Material
            };

            var bottom = new Rectangle3D {
                A = new Vector3D(-dx, +dy, -dz),
                B = new Vector3D(-dx, +dy, +dz),
                C = new Vector3D(+dx, +dy, -dz),
                Material = box.Material
            };

            var left = new Rectangle3D {
                A = new Vector3D(-dx, -dy, -dz),
                B = new Vector3D(-dx, +dy, -dz),
                C = new Vector3D(-dx, -dy, +dz),
                Material = box.Material
            };

            var right = new Rectangle3D {
                A = new Vector3D(+dx, -dy, -dz),
                B = new Vector3D(+dx, +dy, -dz),
                C = new Vector3D(+dx, -dy, +dz),
                Material = box.Material
            };

            var front = new Rectangle3D {
                A = new Vector3D(-dx, -dy, -dz),
                B = new Vector3D(-dx, +dy, -dz),
                C = new Vector3D(+dx, -dy, -dz),
                Material = box.Material
            };

            var back = new Rectangle3D {
                A = new Vector3D(-dx, -dy, +dz),
                B = new Vector3D(-dx, +dy, +dz),
                C = new Vector3D(+dx, -dy, +dz),
                Material = box.Material
            };

            composite.Add(top);
            composite.Add(bottom);
            composite.Add(left);
            composite.Add(right);
            composite.Add(front);
            composite.Add(back);

            Visit(composite);
        }
예제 #2
0
        public SensitiveMatrix(Canvas canvas)
            : base(null) {
            this.canvas = canvas;
            Rectangle3D origin = new Rectangle3D();

            // TODO: set rectangle's params

            //rectangle = new RERectangle(origin);

        }
예제 #3
0
 public void Visit(Rectangle3D rect)
 {
     var globalRectangle = new Rectangle3D {
         A = ToAbsolute(rect.A),
         B = ToAbsolute(rect.B),
         C = ToAbsolute(rect.C),
         Material = rect.Material
     };
     _decoratedShape = new RERectangle(globalRectangle);
 }
예제 #4
0
 public RERectangle(Rectangle3D rect)
     : base(rect, rect.A, rect.B - rect.A, rect.C - rect.A)
 {
 }