using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Windows.Input;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using Earthblend.Tts.Common.Core;
using Earthblend.Tts.Common.Core.MeshGenerators.Base;
using Earthblend.DynamicCompile;
using Earthblend.Nts.Common.MeshGenerators.Base;

namespace Earthblend.Tts.Common.Core.Commands { }
namespace Earthblend.Tts.Common.Core.MeshGenerators
{

    public class WedgeMeshEventArgs : EventArgs { public WedgeMeshEventArgs(MeshGeometry3D mesh) { Mesh = mesh; } public MeshGeometry3D Mesh { get; set; } }


    public class WedgeMeshGenerator : MeshGeneratorBase
    {
        public WedgeMeshGenerator()
        {
            PropertyChanged(new DependencyPropertyChangedEventArgs());
        }

        public event EventHandler<WedgeMeshEventArgs> WedgeMeshChanged;

        protected virtual void OnMeshChanged(WedgeMeshEventArgs e)
        {
            EventHandler<WedgeMeshEventArgs> handler = WedgeMeshChanged;
            if (handler != null)
            {
                handler(this, e);
            }
        }

        public static IList<String> Properties = new List<String>() { "Wedge" };
        public static readonly DependencyProperty WedgeProperty = DependencyProperty.Register("Wedge", typeof(Double), typeof(WedgeMeshGenerator), new PropertyMetadata(1.0D, PropertyChanged));
        public Double Wedge { set { SetValue(WedgeProperty, value); } get { return (Double)GetValue(WedgeProperty); } }


        public WedgeMeshGenerator Duplicate()
        {
            WedgeMeshGenerator WedgeMeshGenerator = new WedgeMeshGenerator();
            WedgeMeshGenerator.Radius = Radius;
            WedgeMeshGenerator.Width = Width;
            WedgeMeshGenerator.Height = Height;
            WedgeMeshGenerator.Depth = Depth;
            WedgeMeshGenerator.TopBottom = TopBottom;
            WedgeMeshGenerator.LeftRight = LeftRight;
            WedgeMeshGenerator.OutIn = OutIn;
            WedgeMeshGenerator.WedgeLength = WedgeLength;
            WedgeMeshGenerator.PointThickness = PointThickness;
            return WedgeMeshGenerator;
        }

        #region Methods

        private void RefreshVariables()
        {
            NotifyPropertyChanged("Radius");
            NotifyPropertyChanged("Width");
            NotifyPropertyChanged("Height");
            NotifyPropertyChanged("Depth");
            NotifyPropertyChanged("TQ1X");
            NotifyPropertyChanged("TQ2X");
            NotifyPropertyChanged("TQ3X");
            NotifyPropertyChanged("TQ4X");
            NotifyPropertyChanged("TQ1Y");
            NotifyPropertyChanged("TQ2Y");
            NotifyPropertyChanged("TQ3Y");
            NotifyPropertyChanged("TQ4Y");
            NotifyPropertyChanged("TQ1Z");
            NotifyPropertyChanged("TQ2Z");
            NotifyPropertyChanged("TQ3Z");
            NotifyPropertyChanged("TQ4Z");
            NotifyPropertyChanged("LQ1X");
            NotifyPropertyChanged("LQ2X");
            NotifyPropertyChanged("LQ3X");
            NotifyPropertyChanged("LQ4X");
            NotifyPropertyChanged("LQ1Y");
            NotifyPropertyChanged("LQ2Y");
            NotifyPropertyChanged("LQ3Y");
            NotifyPropertyChanged("LQ4Y");
            NotifyPropertyChanged("LQ1Z");
            NotifyPropertyChanged("LQ2Z");
            NotifyPropertyChanged("LQ3Z");
            NotifyPropertyChanged("LQ4Z");
            NotifyPropertyChanged("RQ1X");
            NotifyPropertyChanged("RQ1Y");
            NotifyPropertyChanged("RQ1Z");
            NotifyPropertyChanged("RQ2X");
            NotifyPropertyChanged("RQ3X");
            NotifyPropertyChanged("RQ4X");
            NotifyPropertyChanged("RQ2Y");
            NotifyPropertyChanged("RQ3Y");
            NotifyPropertyChanged("RQ4Y");
            NotifyPropertyChanged("RQ2Z");
            NotifyPropertyChanged("RQ3Z");
            NotifyPropertyChanged("RQ4Z");
            NotifyPropertyChanged("BQ1X");
            NotifyPropertyChanged("BQ2X");
            NotifyPropertyChanged("BQ3X");
            NotifyPropertyChanged("BQ4X");
            NotifyPropertyChanged("BQ1Y");
            NotifyPropertyChanged("BQ2Y");
            NotifyPropertyChanged("BQ3Y");
            NotifyPropertyChanged("BQ4Y");
            NotifyPropertyChanged("BQ1Z");
            NotifyPropertyChanged("BQ2Z");
            NotifyPropertyChanged("BQ3Z");
            NotifyPropertyChanged("BQ4Z");
            NotifyPropertyChanged("IQ1X");
            NotifyPropertyChanged("IQ2X");
            NotifyPropertyChanged("IQ3X");
            NotifyPropertyChanged("IQ4X");
            NotifyPropertyChanged("IQ1Y");
            NotifyPropertyChanged("IQ2Y");
            NotifyPropertyChanged("IQ3Y");
            NotifyPropertyChanged("IQ4Y");
            NotifyPropertyChanged("IQ1Z");
            NotifyPropertyChanged("IQ2Z");
            NotifyPropertyChanged("IQ3Z");
            NotifyPropertyChanged("IQ4Z");
            NotifyPropertyChanged("OQ1X");
            NotifyPropertyChanged("OQ2X");
            NotifyPropertyChanged("OQ3X");
            NotifyPropertyChanged("OQ4X");
            NotifyPropertyChanged("OQ1Y");
            NotifyPropertyChanged("OQ2Y");
            NotifyPropertyChanged("OQ3Y");
            NotifyPropertyChanged("OQ4Y");
            NotifyPropertyChanged("OQ1Z");
            NotifyPropertyChanged("OQ2Z");
            NotifyPropertyChanged("OQ3Z");
            NotifyPropertyChanged("OQ4Z");
            NotifyPropertyChanged("TopBottom");
            NotifyPropertyChanged("LeftRight");
            NotifyPropertyChanged("OutIn");
            NotifyPropertyChanged("EQ1X");
            NotifyPropertyChanged("EQ2X");
            NotifyPropertyChanged("EQ3X");
            NotifyPropertyChanged("EQ4X");
            NotifyPropertyChanged("EQ1Y");
            NotifyPropertyChanged("EQ2Y");
            NotifyPropertyChanged("EQ3Y");
            NotifyPropertyChanged("EQ4Y");
            NotifyPropertyChanged("EQ1Z");
            NotifyPropertyChanged("EQ2Z");
            NotifyPropertyChanged("EQ3Z");
            NotifyPropertyChanged("EQ4Z");
            NotifyPropertyChanged("WedgeLength");
            NotifyPropertyChanged("PointThickness");
        }
        #endregion


        private Double _radius = 0.5;
        private ICommand _decreaseRadiusCommandIc = null;[XmlIgnore] public ICommand DecreaseRadiusCommandIc => _decreaseRadiusCommandIc ?? (_decreaseRadiusCommandIc = new RelayCommand<Object>(DecreaseRadiusCommandIcExecuted)); public void DecreaseRadiusCommandIcExecuted(Object obj) { Radius -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseRadiusCommandIc = null;[XmlIgnore] public ICommand IncreaseRadiusCommandIc => _increaseRadiusCommandIc ?? (_increaseRadiusCommandIc = new RelayCommand<Object>(IncreaseRadiusCommandIcExecuted)); public void IncreaseRadiusCommandIcExecuted(Object obj) { Radius += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double Radius { get { return _radius; } set { _radius = value; RefreshVariables(); } }
        private Double _width = 4;
        private ICommand _decreaseWidthCommandIc = null;[XmlIgnore] public ICommand DecreaseWidthCommandIc => _decreaseWidthCommandIc ?? (_decreaseWidthCommandIc = new RelayCommand<Object>(DecreaseWidthCommandIcExecuted)); public void DecreaseWidthCommandIcExecuted(Object obj) { Width -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseWidthCommandIc = null;[XmlIgnore] public ICommand IncreaseWidthCommandIc => _increaseWidthCommandIc ?? (_increaseWidthCommandIc = new RelayCommand<Object>(IncreaseWidthCommandIcExecuted)); public void IncreaseWidthCommandIcExecuted(Object obj) { Width += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double Width { get { return _width; } set { _width = value; RefreshVariables(); } }
        private Double _height = 4;
        private ICommand _decreaseHeightCommandIc = null;[XmlIgnore] public ICommand DecreaseHeightCommandIc => _decreaseHeightCommandIc ?? (_decreaseHeightCommandIc = new RelayCommand<Object>(DecreaseHeightCommandIcExecuted)); public void DecreaseHeightCommandIcExecuted(Object obj) { Height -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseHeightCommandIc = null;[XmlIgnore] public ICommand IncreaseHeightCommandIc => _increaseHeightCommandIc ?? (_increaseHeightCommandIc = new RelayCommand<Object>(IncreaseHeightCommandIcExecuted)); public void IncreaseHeightCommandIcExecuted(Object obj) { Height += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double Height { get { return _height; } set { _height = value; RefreshVariables(); } }
        private Double _depth = 4;
        private ICommand _decreaseDepthCommandIc = null;[XmlIgnore] public ICommand DecreaseDepthCommandIc => _decreaseDepthCommandIc ?? (_decreaseDepthCommandIc = new RelayCommand<Object>(DecreaseDepthCommandIcExecuted)); public void DecreaseDepthCommandIcExecuted(Object obj) { Depth -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseDepthCommandIc = null;[XmlIgnore] public ICommand IncreaseDepthCommandIc => _increaseDepthCommandIc ?? (_increaseDepthCommandIc = new RelayCommand<Object>(IncreaseDepthCommandIcExecuted)); public void IncreaseDepthCommandIcExecuted(Object obj) { Depth += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double Depth { get { return _depth; } set { _depth = value; RefreshVariables(); } }
        public Double TQ1X { get { return +(Width / 2) + 0; } }
        public Double TQ2X { get { return -(Width / 2) + 0; } }
        public Double TQ3X { get { return -(Width / 2) + 0; } }
        public Double TQ4X { get { return +(Width / 2) + 0; } }
        public Double TQ1Y { get { return -(Height / 2) + 0; } }
        public Double TQ2Y { get { return -(Height / 2) + 0; } }
        public Double TQ3Y { get { return +(Height / 2) + 0; } }
        public Double TQ4Y { get { return +(Height / 2) + 0; } }
        public Double TQ1Z { get { return +(Depth / 2) + TopBottom; } }
        public Double TQ2Z { get { return +(Depth / 2) + TopBottom; } }
        public Double TQ3Z { get { return +(Depth / 2) + TopBottom; } }
        public Double TQ4Z { get { return +(Depth / 2) + TopBottom; } }
        public Double LQ1X { get { return +(Width / 2) + LeftRight; } }
        public Double LQ2X { get { return +(Width / 2) + LeftRight; } }
        public Double LQ3X { get { return +(Width / 2) + LeftRight; } }
        public Double LQ4X { get { return +(Width / 2) + LeftRight; } }
        public Double LQ1Y { get { return -(Height / 2) + 0; } }
        public Double LQ2Y { get { return +(Height / 2) + 0; } }
        public Double LQ3Y { get { return +(Height / 2) + 0; } }
        public Double LQ4Y { get { return -(Height / 2) + 0; } }
        public Double LQ1Z { get { return +(Depth / 2) + 0; } }
        public Double LQ2Z { get { return +(Depth / 2) + 0; } }
        public Double LQ3Z { get { return -(Depth / 2) + 0; } }
        public Double LQ4Z { get { return -(Depth / 2) + 0; } }
        public Double RQ1X { get { return -(Width / 2) - LeftRight; } }
        public Double RQ1Y { get { return -(Height / 2) + 0; } }
        public Double RQ1Z { get { return +(Depth / 2) + 0; } }
        public Double RQ2X { get { return -(Width / 2) - LeftRight; } }
        public Double RQ3X { get { return -(Width / 2) - LeftRight; } }
        public Double RQ4X { get { return -(Width / 2) - LeftRight; } }
        public Double RQ2Y { get { return +(Height / 2) + 0; } }
        public Double RQ3Y { get { return +(Height / 2) + 0; } }
        public Double RQ4Y { get { return -(Height / 2) + 0; } }
        public Double RQ2Z { get { return +(Depth / 2) + 0; } }
        public Double RQ3Z { get { return -(Depth / 2) + 0; } }
        public Double RQ4Z { get { return -(Depth / 2) + 0; } }
        public Double BQ1X { get { return +(Width / 2) + 0; } }
        public Double BQ2X { get { return -(Width / 2) + 0; } }
        public Double BQ3X { get { return -(Width / 2) + 0; } }
        public Double BQ4X { get { return +(Width / 2) + 0; } }
        public Double BQ1Y { get { return -(Height / 2) + 0; } }
        public Double BQ2Y { get { return -(Height / 2) + 0; } }
        public Double BQ3Y { get { return +(Height / 2) + 0; } }
        public Double BQ4Y { get { return +(Height / 2) + 0; } }
        public Double BQ1Z { get { return -(Depth / 2) - TopBottom; } }
        public Double BQ2Z { get { return -(Depth / 2) - TopBottom; } }
        public Double BQ3Z { get { return -(Depth / 2) - TopBottom; } }
        public Double BQ4Z { get { return -(Depth / 2) - TopBottom; } }
        public Double IQ1X { get { return -(Width / 2) + 0; } }
        public Double IQ2X { get { return +(Width / 2) + 0; } }
        public Double IQ3X { get { return +(Width / 2) + 0; } }
        public Double IQ4X { get { return -(Width / 2) + 0; } }
        public Double IQ1Y { get { return +(Height / 2) + OutIn; } }
        public Double IQ2Y { get { return +(Height / 2) + OutIn; } }
        public Double IQ3Y { get { return +(Height / 2) + OutIn; } }
        public Double IQ4Y { get { return +(Height / 2) + OutIn; } }
        public Double IQ1Z { get { return +(Depth / 2) - 0; } }
        public Double IQ2Z { get { return +(Depth / 2) - 0; } }
        public Double IQ3Z { get { return -(Depth / 2) + 0; } }
        public Double IQ4Z { get { return -(Depth / 2) + 0; } }
        public Double OQ1X { get { return -(Width / 2) + 0; } }
        public Double OQ2X { get { return +(Width / 2) + 0; } }
        public Double OQ3X { get { return +(Width / 2) + 0; } }
        public Double OQ4X { get { return -(Width / 2) + 0; } }
        public Double OQ1Y { get { return -(Height / 2) - OutIn - 0; } }
        public Double OQ2Y { get { return -(Height / 2) - OutIn - 0; } }
        public Double OQ3Y { get { return -(Height / 2) - OutIn - 0; } }
        public Double OQ4Y { get { return -(Height / 2) - OutIn - 0; } }
        public Double OQ1Z { get { return +(Depth / 2) + 0; } }
        public Double OQ2Z { get { return +(Depth / 2) + 0; } }
        public Double OQ3Z { get { return -(Depth / 2) + 0; } }
        public Double OQ4Z { get { return -(Depth / 2) + 0; } }
        private Double _topBottom = 0;
        private ICommand _decreaseTopBottomCommandIc = null;[XmlIgnore] public ICommand DecreaseTopBottomCommandIc => _decreaseTopBottomCommandIc ?? (_decreaseTopBottomCommandIc = new RelayCommand<Object>(DecreaseTopBottomCommandIcExecuted)); public void DecreaseTopBottomCommandIcExecuted(Object obj) { TopBottom -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseTopBottomCommandIc = null;[XmlIgnore] public ICommand IncreaseTopBottomCommandIc => _increaseTopBottomCommandIc ?? (_increaseTopBottomCommandIc = new RelayCommand<Object>(IncreaseTopBottomCommandIcExecuted)); public void IncreaseTopBottomCommandIcExecuted(Object obj) { TopBottom += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double TopBottom { get { return _topBottom; } set { _topBottom = value; RefreshVariables(); } }
        private Double _leftRight = 0;
        private ICommand _decreaseLeftRightCommandIc = null;[XmlIgnore] public ICommand DecreaseLeftRightCommandIc => _decreaseLeftRightCommandIc ?? (_decreaseLeftRightCommandIc = new RelayCommand<Object>(DecreaseLeftRightCommandIcExecuted)); public void DecreaseLeftRightCommandIcExecuted(Object obj) { LeftRight -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseLeftRightCommandIc = null;[XmlIgnore] public ICommand IncreaseLeftRightCommandIc => _increaseLeftRightCommandIc ?? (_increaseLeftRightCommandIc = new RelayCommand<Object>(IncreaseLeftRightCommandIcExecuted)); public void IncreaseLeftRightCommandIcExecuted(Object obj) { LeftRight += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double LeftRight { get { return _leftRight; } set { _leftRight = value; RefreshVariables(); } }
        private Double _outIn = 0;
        private ICommand _decreaseOutInCommandIc = null;[XmlIgnore] public ICommand DecreaseOutInCommandIc => _decreaseOutInCommandIc ?? (_decreaseOutInCommandIc = new RelayCommand<Object>(DecreaseOutInCommandIcExecuted)); public void DecreaseOutInCommandIcExecuted(Object obj) { OutIn -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseOutInCommandIc = null;[XmlIgnore] public ICommand IncreaseOutInCommandIc => _increaseOutInCommandIc ?? (_increaseOutInCommandIc = new RelayCommand<Object>(IncreaseOutInCommandIcExecuted)); public void IncreaseOutInCommandIcExecuted(Object obj) { OutIn += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double OutIn { get { return _outIn; } set { _outIn = value; RefreshVariables(); } }
        public Double EQ1X { get { return -(PointThickness / 2); } }
        public Double EQ2X { get { return +(PointThickness / 2); } }
        public Double EQ3X { get { return +(PointThickness / 2); } }
        public Double EQ4X { get { return -(PointThickness / 2); } }
        public Double EQ1Y { get { return -(Height / 2) - OutIn - WedgeLength; } }
        public Double EQ2Y { get { return -(Height / 2) - OutIn - WedgeLength; } }
        public Double EQ3Y { get { return -(Height / 2) - OutIn - WedgeLength; } }
        public Double EQ4Y { get { return -(Height / 2) - OutIn - WedgeLength; } }
        public Double EQ1Z { get { return +(Depth / 2) + 0; } }
        public Double EQ2Z { get { return +(Depth / 2) + 0; } }
        public Double EQ3Z { get { return -(Depth / 2) + 0; } }
        public Double EQ4Z { get { return -(Depth / 2) + 0; } }
        private Double _wedgeLength = 9;
        private ICommand _decreaseWedgeLengthCommandIc = null;[XmlIgnore] public ICommand DecreaseWedgeLengthCommandIc => _decreaseWedgeLengthCommandIc ?? (_decreaseWedgeLengthCommandIc = new RelayCommand<Object>(DecreaseWedgeLengthCommandIcExecuted)); public void DecreaseWedgeLengthCommandIcExecuted(Object obj) { WedgeLength -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increaseWedgeLengthCommandIc = null;[XmlIgnore] public ICommand IncreaseWedgeLengthCommandIc => _increaseWedgeLengthCommandIc ?? (_increaseWedgeLengthCommandIc = new RelayCommand<Object>(IncreaseWedgeLengthCommandIcExecuted)); public void IncreaseWedgeLengthCommandIcExecuted(Object obj) { WedgeLength += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double WedgeLength { get { return _wedgeLength; } set { _wedgeLength = value; RefreshVariables(); } }
        private Double _pointThickness = 0.1;
        private ICommand _decreasePointThicknessCommandIc = null;[XmlIgnore] public ICommand DecreasePointThicknessCommandIc => _decreasePointThicknessCommandIc ?? (_decreasePointThicknessCommandIc = new RelayCommand<Object>(DecreasePointThicknessCommandIcExecuted)); public void DecreasePointThicknessCommandIcExecuted(Object obj) { PointThickness -= MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        private ICommand _increasePointThicknessCommandIc = null;[XmlIgnore] public ICommand IncreasePointThicknessCommandIc => _increasePointThicknessCommandIc ?? (_increasePointThicknessCommandIc = new RelayCommand<Object>(IncreasePointThicknessCommandIcExecuted)); public void IncreasePointThicknessCommandIcExecuted(Object obj) { PointThickness += MovementValue; Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }
        public Double PointThickness { get { return _pointThickness; } set { _pointThickness = value; RefreshVariables(); } }

        protected override void Triangulate(DependencyPropertyChangedEventArgs args, Point3DCollection vertices, Vector3DCollection normals, Int32Collection indices, PointCollection textures)
        {
            vertices.Clear();
            normals.Clear();
            indices.Clear();
            textures.Clear();


            MeshGeometry3D mesh = new MeshGeometry3D();
            mesh.Positions = new Point3DCollection()
                    {
                          new Point3D(TQ1X /* 2 */,TQ1Y /* -2 */,TQ1Z /* 2 */),new Point3D(TQ4X /* 2 */,TQ4Y /* 2 */,TQ4Z /* 2 */),new Point3D(TQ3X /* -2 */,TQ3Y /* 2 */,TQ3Z /* 2 */)
                         ,new Point3D(TQ1X /* 2 */,TQ1Y /* -2 */,TQ1Z /* 2 */),new Point3D(TQ3X /* -2 */,TQ3Y /* 2 */,TQ3Z /* 2 */),new Point3D(TQ2X /* -2 */,TQ2Y /* -2 */,TQ2Z /* 2 */)
                         ,new Point3D(BQ4X /* 2 */,BQ4Y /* 2 */,BQ4Z /* -2 */),new Point3D(BQ1X /* 2 */,BQ1Y /* -2 */,BQ1Z /* -2 */),new Point3D(BQ2X /* -2 */,BQ2Y /* -2 */,BQ2Z /* -2 */)
                         ,new Point3D(BQ4X /* 2 */,BQ4Y /* 2 */,BQ4Z /* -2 */),new Point3D(BQ2X /* -2 */,BQ2Y /* -2 */,BQ2Z /* -2 */),new Point3D(BQ3X /* -2 */,BQ3Y /* 2 */,BQ3Z /* -2 */)
                         ,new Point3D(LQ1X /* 2 */,LQ1Y /* -2 */,LQ1Z /* 2 */),new Point3D(LQ4X /* 2 */,LQ4Y /* -2 */,LQ4Z /* -2 */),new Point3D(LQ3X /* 2 */,LQ3Y /* 2 */,LQ3Z /* -2 */)
                         ,new Point3D(LQ1X /* 2 */,LQ1Y /* -2 */,LQ1Z /* 2 */),new Point3D(LQ3X /* 2 */,LQ3Y /* 2 */,LQ3Z /* -2 */),new Point3D(LQ2X /* 2 */,LQ2Y /* 2 */,LQ2Z /* 2 */)
                         ,new Point3D(RQ2X /* -2 */,RQ2Y /* 2 */,RQ1Z /* 2 */),new Point3D(RQ3X /* -2 */,RQ3Y /* 2 */,RQ4Z /* -2 */),new Point3D(RQ4X /* -2 */,RQ4Y /* -2 */,RQ3Z /* -2 */)
                         ,new Point3D(RQ2X /* -2 */,RQ2Y /* 2 */,RQ1Z /* 2 */),new Point3D(RQ4X /* -2 */,RQ4Y /* -2 */,RQ3Z /* -2 */),new Point3D(RQ1X /* -2 */,RQ1Y /* -2 */,RQ2Z /* 2 */)
                         ,new Point3D(IQ2X /* 2 */,IQ1Y /* 2 */,IQ1Z /* 2 */),new Point3D(IQ3X /* 2 */,IQ4Y /* 2 */,IQ4Z /* -2 */),new Point3D(IQ4X /* -2 */,IQ3Y /* 2 */,IQ3Z /* -2 */)
                         ,new Point3D(IQ2X /* 2 */,IQ1Y /* 2 */,IQ1Z /* 2 */),new Point3D(IQ4X /* -2 */,IQ3Y /* 2 */,IQ3Z /* -2 */),new Point3D(IQ1X /* -2 */,IQ2Y /* 2 */,IQ2Z /* 2 */)
                         ,new Point3D(EQ1X /* -0.05 */,EQ1Y /* -11 */,EQ1Z /* 2 */),new Point3D(EQ4X /* -0.05 */,EQ4Y /* -11 */,EQ4Z /* -2 */),new Point3D(EQ3X /* 0.05 */,EQ3Y /* -11 */,EQ3Z /* -2 */)
                         ,new Point3D(EQ1X /* -0.05 */,EQ1Y /* -11 */,EQ1Z /* 2 */),new Point3D(EQ3X /* 0.05 */,EQ3Y /* -11 */,EQ3Z /* -2 */),new Point3D(EQ2X /* 0.05 */,EQ2Y /* -11 */,EQ2Z /* 2 */)
                         ,new Point3D(EQ2X /* 0.05 */,EQ2Y /* -11 */,EQ2Z /* 2 */),new Point3D(EQ3X /* 0.05 */,EQ3Y /* -11 */,EQ3Z /* -2 */),new Point3D(OQ3X /* 2 */,OQ3Y /* -2 */,OQ3Z /* -2 */)
                         ,new Point3D(EQ2X /* 0.05 */,EQ2Y /* -11 */,EQ2Z /* 2 */),new Point3D(OQ3X /* 2 */,OQ3Y /* -2 */,OQ3Z /* -2 */),new Point3D(OQ2X /* 2 */,OQ2Y /* -2 */,OQ2Z /* 2 */)
                         ,new Point3D(OQ1X /* -2 */,OQ1Y /* -2 */,OQ1Z /* 2 */),new Point3D(OQ4X /* -2 */,OQ4Y /* -2 */,OQ4Z /* -2 */),new Point3D(EQ4X /* -0.05 */,EQ4Y /* -11 */,EQ4Z /* -2 */)
                         ,new Point3D(OQ1X /* -2 */,OQ1Y /* -2 */,OQ1Z /* 2 */),new Point3D(EQ4X /* -0.05 */,EQ4Y /* -11 */,EQ4Z /* -2 */),new Point3D(EQ1X /* -0.05 */,EQ1Y /* -11 */,EQ1Z /* 2 */)
                         ,new Point3D(OQ2X /* 2 */,OQ2Y /* -2 */,OQ2Z /* 2 */),new Point3D(OQ1X /* -2 */,OQ1Y /* -2 */,OQ1Z /* 2 */),new Point3D(EQ1X /* -0.05 */,EQ1Y /* -11 */,EQ1Z /* 2 */)
                         ,new Point3D(OQ2X /* 2 */,OQ2Y /* -2 */,OQ2Z /* 2 */),new Point3D(EQ1X /* -0.05 */,EQ1Y /* -11 */,EQ1Z /* 2 */),new Point3D(EQ2X /* 0.05 */,EQ2Y /* -11 */,EQ2Z /* 2 */)
                         ,new Point3D(EQ3X /* 0.05 */,EQ3Y /* -11 */,EQ3Z /* -2 */),new Point3D(EQ4X /* -0.05 */,EQ4Y /* -11 */,EQ4Z /* -2 */),new Point3D(OQ4X /* -2 */,OQ4Y /* -2 */,OQ4Z /* -2 */)
                         ,new Point3D(EQ3X /* 0.05 */,EQ3Y /* -11 */,EQ3Z /* -2 */),new Point3D(OQ4X /* -2 */,OQ4Y /* -2 */,OQ4Z /* -2 */),new Point3D(OQ3X /* 2 */,OQ3Y /* -2 */,OQ3Z /* -2 */)
                    };

            mesh.TriangleIndices = new Int32Collection()
                    {
                         0,1,2,0,2,5,6,7,8,6,8,11,12,13,14,12,14,17,18,19,20,18,20,23,24,25,26,24,26,29,30,31,32,30,32,35,35,32,38,35,38,41,42,43,31,42,31,30,41,42,30,41,30,35,32,31,43,32,43,38
                    };
            mesh.TextureCoordinates = new PointCollection()
                    {
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),
                         new Point(0,0),new Point(0,1),new Point(1,1),
                         new Point(0,0),new Point(1,1),new Point(1,0),

                    };
            mesh.Normals = new Vector3DCollection()
            {

            };


            Geometry = new MeshGeometry3D() { Positions = mesh.Positions, TriangleIndices = mesh.TriangleIndices, TextureCoordinates = mesh.TextureCoordinates, Normals = mesh.Normals };

            OnMeshChanged(new WedgeMeshEventArgs(Geometry as MeshGeometry3D));
        }
    }
}

