using Earthblend.Tts.Common.Core.MeshGenerators.Base;
using HelixToolkit.Wpf;
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.DynamicCompile;
using VirtualCanvasTestCode.Extensions;
using Earthblend.Tts.Common.Core.Extentions;
using Earthblend.Nts.Common.MeshGenerators.Base;

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

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


    public partial class SkewBoxMeshGenerator : MeshGeneratorBase
    {
        public struct Fields
        {
            public const String Front = "Front";
            public const String Back = "Back";
            public const String Left = "Left";
            public const String Right = "Right";
            public const String Top = "Top";
            public const String Bottom = "Bottom";

            public const String SkewP1X = "SkewP1X";
            public const String SkewP1Y = "SkewP1Y";
            public const String SkewP1Z = "SkewP1Z";

            public const String SkewP2X = "SkewP2X";
            public const String SkewP2Y = "SkewP2Y";
            public const String SkewP2Z = "SkewP2Z";

            public const String SkewP3X = "SkewP3X";
            public const String SkewP3Y = "SkewP3Y";
            public const String SkewP3Z = "SkewP3Z";

            public const String SkewP4X = "SkewP4X";
            public const String SkewP4Y = "SkewP4Y";
            public const String SkewP4Z = "SkewP4Z";

            public const String SkewP5X = "SkewP5X";
            public const String SkewP5Y = "SkewP5Y";
            public const String SkewP5Z = "SkewP5Z";

            public const String SkewP6X = "SkewP6X";
            public const String SkewP6Y = "SkewP6Y";
            public const String SkewP6Z = "SkewP6Z";

            public const String SkewP7X = "SkewP7X";
            public const String SkewP7Y = "SkewP7Y";
            public const String SkewP7Z = "SkewP7Z";

            public const String SkewP8X = "SkewP8X";
            public const String SkewP8Y = "SkewP8Y";
            public const String SkewP8Z = "SkewP8Z";

            public const String TQ1X = "TQ1X";
            public const String TQ2X = "TQ2X";
            public const String TQ3X = "TQ3X";
            public const String TQ4X = "TQ4X";

            public const String TQ1Y = "TQ1Y";
            public const String TQ2Y = "TQ2Y";
            public const String TQ3Y = "TQ3Y";
            public const String TQ4Y = "TQ4Y";

            public const String TQ1Z = "TQ1Z";
            public const String TQ2Z = "TQ2Z";
            public const String TQ3Z = "TQ3Z";
            public const String TQ4Z = "TQ4Z";


            public const String LQ1X = "LQ1X";
            public const String LQ2X = "LQ2X";
            public const String LQ3X = "LQ3X";
            public const String LQ4X = "LQ4X";

            public const String LQ1Y = "LQ1Y";
            public const String LQ2Y = "LQ2Y";
            public const String LQ3Y = "LQ3Y";
            public const String LQ4Y = "LQ4Y";

            public const String LQ1Z = "LQ1Z";
            public const String LQ2Z = "LQ2Z";
            public const String LQ3Z = "LQ3Z";
            public const String LQ4Z = "LQ4Z";


            public const String RQ1X = "RQ1X";
            public const String RQ2X = "RQ2X";
            public const String RQ3X = "RQ3X";
            public const String RQ4X = "RQ4X";

            public const String RQ1Y = "RQ1Y";
            public const String RQ2Y = "RQ2Y";
            public const String RQ3Y = "RQ3Y";
            public const String RQ4Y = "RQ4Y";

            public const String RQ1Z = "RQ1Z";
            public const String RQ2Z = "RQ2Z";
            public const String RQ3Z = "RQ3Z";
            public const String RQ4Z = "RQ4Z";


            public const String BQ1X = "BQ1X";
            public const String BQ2X = "BQ2X";
            public const String BQ3X = "BQ3X";
            public const String BQ4X = "BQ4X";

            public const String BQ1Y = "BQ1Y";
            public const String BQ2Y = "BQ2Y";
            public const String BQ3Y = "BQ3Y";
            public const String BQ4Y = "BQ4Y";

            public const String BQ1Z = "BQ1Z";
            public const String BQ2Z = "BQ2Z";
            public const String BQ3Z = "BQ3Z";
            public const String BQ4Z = "BQ4Z";


            public const String IQ1X = "IQ1X";
            public const String IQ2X = "IQ2X";
            public const String IQ3X = "IQ3X";
            public const String IQ4X = "IQ4X";

            public const String IQ1Y = "IQ1Y";
            public const String IQ2Y = "IQ2Y";
            public const String IQ3Y = "IQ3Y";
            public const String IQ4Y = "IQ4Y";

            public const String IQ1Z = "IQ1Z";
            public const String IQ2Z = "IQ2Z";
            public const String IQ3Z = "IQ3Z";
            public const String IQ4Z = "IQ4Z";


            public const String OQ1X = "OQ1X";
            public const String OQ2X = "OQ2X";
            public const String OQ3X = "OQ3X";
            public const String OQ4X = "OQ4X";

            public const String OQ1Y = "OQ1Y";
            public const String OQ2Y = "OQ2Y";
            public const String OQ3Y = "OQ3Y";
            public const String OQ4Y = "OQ4Y";

            public const String OQ1Z = "OQ1Z";
            public const String OQ2Z = "OQ2Z";
            public const String OQ3Z = "OQ3Z";
            public const String OQ4Z = "OQ4Z";
        }

        //public Double TQ1X { set { SetValue(TQ1XProperty, value); } get { return (Double)GetValue(TQ1XProperty); } }
        //public Double TQ2X { set { SetValue(TQ1XProperty, value); } get { return (Double)GetValue(TQ2XProperty); } }
        //public Double TQ3X { set { SetValue(TQ1XProperty, value); } get { return (Double)GetValue(TQ3XProperty); } }
        //public Double TQ4X { set { SetValue(TQ1XProperty, value); } get { return (Double)GetValue(TQ4XProperty); } }

        //public Double TQ1Y { set { SetValue(TQ1YProperty, value); } get { return (Double)GetValue(TQ1YProperty); } }
        //public Double TQ2Y { set { SetValue(TQ1YProperty, value); } get { return (Double)GetValue(TQ2YProperty); } }
        //public Double TQ3Y { set { SetValue(TQ1YProperty, value); } get { return (Double)GetValue(TQ3YProperty); } }
        //public Double TQ4Y { set { SetValue(TQ1YProperty, value); } get { return (Double)GetValue(TQ4YProperty); } }

        //public Double TQ1Z { set { SetValue(TQ1ZProperty, value); } get { return (Double)GetValue(TQ1ZProperty); } }
        //public Double TQ2Z { set { SetValue(TQ1ZProperty, value); } get { return (Double)GetValue(TQ2ZProperty); } }
        //public Double TQ3Z { set { SetValue(TQ1ZProperty, value); } get { return (Double)GetValue(TQ3ZProperty); } }
        //public Double TQ4Z { set { SetValue(TQ1ZProperty, value); } get { return (Double)GetValue(TQ4ZProperty); } }


        //public Double BQ1X { set { SetValue(BQ1XProperty, value); } get { return (Double)GetValue(BQ1XProperty); } }
        //public Double BQ2X { set { SetValue(BQ1XProperty, value); } get { return (Double)GetValue(BQ2XProperty); } }
        //public Double BQ3X { set { SetValue(BQ1XProperty, value); } get { return (Double)GetValue(BQ3XProperty); } }
        //public Double BQ4X { set { SetValue(BQ1XProperty, value); } get { return (Double)GetValue(BQ4XProperty); } }

        //public Double BQ1Y { set { SetValue(BQ1YProperty, value); } get { return (Double)GetValue(BQ1YProperty); } }
        //public Double BQ2Y { set { SetValue(BQ1YProperty, value); } get { return (Double)GetValue(BQ2YProperty); } }
        //public Double BQ3Y { set { SetValue(BQ1YProperty, value); } get { return (Double)GetValue(BQ3YProperty); } }
        //public Double BQ4Y { set { SetValue(BQ1YProperty, value); } get { return (Double)GetValue(BQ4YProperty); } }

        //public Double BQ1Z { set { SetValue(BQ1ZProperty, value); } get { return (Double)GetValue(BQ1ZProperty); } }
        //public Double BQ2Z { set { SetValue(BQ1ZProperty, value); } get { return (Double)GetValue(BQ2ZProperty); } }
        //public Double BQ3Z { set { SetValue(BQ1ZProperty, value); } get { return (Double)GetValue(BQ3ZProperty); } }
        //public Double BQ4Z { set { SetValue(BQ1ZProperty, value); } get { return (Double)GetValue(BQ4ZProperty); } }


        //public Double RQ1X { set { SetValue(RQ1XProperty, value); } get { return (Double)GetValue(RQ1XProperty); } }
        //public Double RQ2X { set { SetValue(RQ1XProperty, value); } get { return (Double)GetValue(RQ2XProperty); } }
        //public Double RQ3X { set { SetValue(RQ1XProperty, value); } get { return (Double)GetValue(RQ3XProperty); } }
        //public Double RQ4X { set { SetValue(RQ1XProperty, value); } get { return (Double)GetValue(RQ4XProperty); } }

        //public Double RQ1Y { set { SetValue(RQ1YProperty, value); } get { return (Double)GetValue(RQ1YProperty); } }
        //public Double RQ2Y { set { SetValue(RQ1YProperty, value); } get { return (Double)GetValue(RQ2YProperty); } }
        //public Double RQ3Y { set { SetValue(RQ1YProperty, value); } get { return (Double)GetValue(RQ3YProperty); } }
        //public Double RQ4Y { set { SetValue(RQ1YProperty, value); } get { return (Double)GetValue(RQ4YProperty); } }

        //public Double RQ1Z { set { SetValue(RQ1ZProperty, value); } get { return (Double)GetValue(RQ1ZProperty); } }
        //public Double RQ2Z { set { SetValue(RQ1ZProperty, value); } get { return (Double)GetValue(RQ2ZProperty); } }
        //public Double RQ3Z { set { SetValue(RQ1ZProperty, value); } get { return (Double)GetValue(RQ3ZProperty); } }
        //public Double RQ4Z { set { SetValue(RQ1ZProperty, value); } get { return (Double)GetValue(RQ4ZProperty); } }


        //public Double LQ1X { set { SetValue(LQ1XProperty, value); } get { return (Double)GetValue(LQ1XProperty); } }
        //public Double LQ2X { set { SetValue(LQ1XProperty, value); } get { return (Double)GetValue(LQ2XProperty); } }
        //public Double LQ3X { set { SetValue(LQ1XProperty, value); } get { return (Double)GetValue(LQ3XProperty); } }
        //public Double LQ4X { set { SetValue(LQ1XProperty, value); } get { return (Double)GetValue(LQ4XProperty); } }

        //public Double LQ1Y { set { SetValue(LQ1YProperty, value); } get { return (Double)GetValue(LQ1YProperty); } }
        //public Double LQ2Y { set { SetValue(LQ1YProperty, value); } get { return (Double)GetValue(LQ2YProperty); } }
        //public Double LQ3Y { set { SetValue(LQ1YProperty, value); } get { return (Double)GetValue(LQ3YProperty); } }
        //public Double LQ4Y { set { SetValue(LQ1YProperty, value); } get { return (Double)GetValue(LQ4YProperty); } }

        //public Double LQ1Z { set { SetValue(LQ1ZProperty, value); } get { return (Double)GetValue(LQ1ZProperty); } }
        //public Double LQ2Z { set { SetValue(LQ1ZProperty, value); } get { return (Double)GetValue(LQ2ZProperty); } }
        //public Double LQ3Z { set { SetValue(LQ1ZProperty, value); } get { return (Double)GetValue(LQ3ZProperty); } }
        //public Double LQ4Z { set { SetValue(LQ1ZProperty, value); } get { return (Double)GetValue(LQ4ZProperty); } }



        //public Double IQ1X { set { SetValue(IQ1XProperty, value); } get { return (Double)GetValue(IQ1XProperty); } }
        //public Double IQ2X { set { SetValue(IQ1XProperty, value); } get { return (Double)GetValue(IQ2XProperty); } }
        //public Double IQ3X { set { SetValue(IQ1XProperty, value); } get { return (Double)GetValue(IQ3XProperty); } }
        //public Double IQ4X { set { SetValue(IQ1XProperty, value); } get { return (Double)GetValue(IQ4XProperty); } }

        //public Double IQ1Y { set { SetValue(IQ1YProperty, value); } get { return (Double)GetValue(IQ1YProperty); } }
        //public Double IQ2Y { set { SetValue(IQ1YProperty, value); } get { return (Double)GetValue(IQ2YProperty); } }
        //public Double IQ3Y { set { SetValue(IQ1YProperty, value); } get { return (Double)GetValue(IQ3YProperty); } }
        //public Double IQ4Y { set { SetValue(IQ1YProperty, value); } get { return (Double)GetValue(IQ4YProperty); } }

        //public Double IQ1Z { set { SetValue(IQ1ZProperty, value); } get { return (Double)GetValue(IQ1ZProperty); } }
        //public Double IQ2Z { set { SetValue(IQ1ZProperty, value); } get { return (Double)GetValue(IQ2ZProperty); } }
        //public Double IQ3Z { set { SetValue(IQ1ZProperty, value); } get { return (Double)GetValue(IQ3ZProperty); } }
        //public Double IQ4Z { set { SetValue(IQ1ZProperty, value); } get { return (Double)GetValue(IQ4ZProperty); } }



        //public Double OQ1X { set { SetValue(OQ1XProperty, value); } get { return (Double)GetValue(OQ1XProperty); } }
        //public Double OQ2X { set { SetValue(OQ1XProperty, value); } get { return (Double)GetValue(OQ2XProperty); } }
        //public Double OQ3X { set { SetValue(OQ1XProperty, value); } get { return (Double)GetValue(OQ3XProperty); } }
        //public Double OQ4X { set { SetValue(OQ1XProperty, value); } get { return (Double)GetValue(OQ4XProperty); } }

        //public Double OQ1Y { set { SetValue(OQ1YProperty, value); } get { return (Double)GetValue(OQ1YProperty); } }
        //public Double OQ2Y { set { SetValue(OQ1YProperty, value); } get { return (Double)GetValue(OQ2YProperty); } }
        //public Double OQ3Y { set { SetValue(OQ1YProperty, value); } get { return (Double)GetValue(OQ3YProperty); } }
        //public Double OQ4Y { set { SetValue(OQ1YProperty, value); } get { return (Double)GetValue(OQ4YProperty); } }

        //public Double OQ1Z { set { SetValue(OQ1ZProperty, value); } get { return (Double)GetValue(OQ1ZProperty); } }
        //public Double OQ2Z { set { SetValue(OQ1ZProperty, value); } get { return (Double)GetValue(OQ2ZProperty); } }
        //public Double OQ3Z { set { SetValue(OQ1ZProperty, value); } get { return (Double)GetValue(OQ3ZProperty); } }
        //public Double OQ4Z { set { SetValue(OQ1ZProperty, value); } get { return (Double)GetValue(OQ4ZProperty); } }


        //private static Object CoerceTQ1X(DependencyObject d, Object basevalue)
        //{
        //    d.CoerceValue(TQ1XProperty);


        //    return basevalue;
        //}


        private static object CoerceTQ1X(DependencyObject arg1, object arg2)
        {
            //arg1.CoerceValue(TQ1XProperty);

            return arg2;
        }

        //public static readonly DependencyProperty TQ1XProperty = DependencyProperty.Register(Fields.TQ1X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));  //new CoerceValueCallBack(CoerceTQ1X)
        //public static readonly DependencyProperty TQ2XProperty = DependencyProperty.Register(Fields.TQ2X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ3XProperty = DependencyProperty.Register(Fields.TQ3X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ4XProperty = DependencyProperty.Register(Fields.TQ4X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty TQ1YProperty = DependencyProperty.Register(Fields.TQ1Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ2YProperty = DependencyProperty.Register(Fields.TQ2Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ3YProperty = DependencyProperty.Register(Fields.TQ3Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ4YProperty = DependencyProperty.Register(Fields.TQ4Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty TQ1ZProperty = DependencyProperty.Register(Fields.TQ1Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ2ZProperty = DependencyProperty.Register(Fields.TQ2Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ3ZProperty = DependencyProperty.Register(Fields.TQ3Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty TQ4ZProperty = DependencyProperty.Register(Fields.TQ4Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty LQ1XProperty = DependencyProperty.Register(Fields.LQ1X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ2XProperty = DependencyProperty.Register(Fields.LQ2X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ3XProperty = DependencyProperty.Register(Fields.LQ3X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ4XProperty = DependencyProperty.Register(Fields.LQ4X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty LQ1YProperty = DependencyProperty.Register(Fields.LQ1Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ2YProperty = DependencyProperty.Register(Fields.LQ2Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ3YProperty = DependencyProperty.Register(Fields.LQ3Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ4YProperty = DependencyProperty.Register(Fields.LQ4Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty LQ1ZProperty = DependencyProperty.Register(Fields.LQ1Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ2ZProperty = DependencyProperty.Register(Fields.LQ2Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ3ZProperty = DependencyProperty.Register(Fields.LQ3Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty LQ4ZProperty = DependencyProperty.Register(Fields.LQ4Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty RQ1XProperty = DependencyProperty.Register(Fields.RQ1X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ2XProperty = DependencyProperty.Register(Fields.RQ2X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ3XProperty = DependencyProperty.Register(Fields.RQ3X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ4XProperty = DependencyProperty.Register(Fields.RQ4X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty RQ1YProperty = DependencyProperty.Register(Fields.RQ1Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ2YProperty = DependencyProperty.Register(Fields.RQ2Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ3YProperty = DependencyProperty.Register(Fields.RQ3Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ4YProperty = DependencyProperty.Register(Fields.RQ4Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty RQ1ZProperty = DependencyProperty.Register(Fields.RQ1Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ2ZProperty = DependencyProperty.Register(Fields.RQ2Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ3ZProperty = DependencyProperty.Register(Fields.RQ3Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty RQ4ZProperty = DependencyProperty.Register(Fields.RQ4Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty BQ1XProperty = DependencyProperty.Register(Fields.BQ1X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ2XProperty = DependencyProperty.Register(Fields.BQ2X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ3XProperty = DependencyProperty.Register(Fields.BQ3X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ4XProperty = DependencyProperty.Register(Fields.BQ4X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty BQ1YProperty = DependencyProperty.Register(Fields.BQ1Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ2YProperty = DependencyProperty.Register(Fields.BQ2Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ3YProperty = DependencyProperty.Register(Fields.BQ3Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ4YProperty = DependencyProperty.Register(Fields.BQ4Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty BQ1ZProperty = DependencyProperty.Register(Fields.BQ1Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ2ZProperty = DependencyProperty.Register(Fields.BQ2Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ3ZProperty = DependencyProperty.Register(Fields.BQ3Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty BQ4ZProperty = DependencyProperty.Register(Fields.BQ4Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));



        //public static readonly DependencyProperty IQ1XProperty = DependencyProperty.Register(Fields.IQ1X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ2XProperty = DependencyProperty.Register(Fields.IQ2X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ3XProperty = DependencyProperty.Register(Fields.IQ3X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ4XProperty = DependencyProperty.Register(Fields.IQ4X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty IQ1YProperty = DependencyProperty.Register(Fields.IQ1Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ2YProperty = DependencyProperty.Register(Fields.IQ2Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ3YProperty = DependencyProperty.Register(Fields.IQ3Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ4YProperty = DependencyProperty.Register(Fields.IQ4Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty IQ1ZProperty = DependencyProperty.Register(Fields.IQ1Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ2ZProperty = DependencyProperty.Register(Fields.IQ2Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ3ZProperty = DependencyProperty.Register(Fields.IQ3Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty IQ4ZProperty = DependencyProperty.Register(Fields.IQ4Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));



        //public static readonly DependencyProperty OQ1XProperty = DependencyProperty.Register(Fields.OQ1X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ2XProperty = DependencyProperty.Register(Fields.OQ2X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ3XProperty = DependencyProperty.Register(Fields.OQ3X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ4XProperty = DependencyProperty.Register(Fields.OQ4X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty OQ1YProperty = DependencyProperty.Register(Fields.OQ1Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ2YProperty = DependencyProperty.Register(Fields.OQ2Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ3YProperty = DependencyProperty.Register(Fields.OQ3Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ4YProperty = DependencyProperty.Register(Fields.OQ4Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        //public static readonly DependencyProperty OQ1ZProperty = DependencyProperty.Register(Fields.OQ1Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ2ZProperty = DependencyProperty.Register(Fields.OQ2Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ3ZProperty = DependencyProperty.Register(Fields.OQ3Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        //public static readonly DependencyProperty OQ4ZProperty = DependencyProperty.Register(Fields.OQ4Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));



        public void RebuildMesh() { Triangulate(new DependencyPropertyChangedEventArgs(), new Point3DCollection(), new Vector3DCollection(), new Int32Collection(), new PointCollection()); }

        public SkewBoxMeshGenerator()
        {
            PropertyChanged(new DependencyPropertyChangedEventArgs());
            RebuildMesh();
        }

        public event EventHandler<SkewBoxMeshGeneratorMeshEventArgs> SkewBoxMeshGeneratorMeshChanged;

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

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

        public static readonly DependencyProperty FrontProperty = DependencyProperty.Register(Fields.Front, typeof(Boolean), typeof(SkewBoxMeshGenerator), new PropertyMetadata(true, PropertyChanged));
        public static readonly DependencyProperty BackProperty = DependencyProperty.Register(Fields.Back, typeof(Boolean), typeof(SkewBoxMeshGenerator), new PropertyMetadata(true, PropertyChanged));
        public static readonly DependencyProperty LeftProperty = DependencyProperty.Register(Fields.Left, typeof(Boolean), typeof(SkewBoxMeshGenerator), new PropertyMetadata(true, PropertyChanged));
        public static readonly DependencyProperty RightProperty = DependencyProperty.Register(Fields.Right, typeof(Boolean), typeof(SkewBoxMeshGenerator), new PropertyMetadata(true, PropertyChanged));
        public static readonly DependencyProperty TopProperty = DependencyProperty.Register(Fields.Top, typeof(Boolean), typeof(SkewBoxMeshGenerator), new PropertyMetadata(true, PropertyChanged));
        public static readonly DependencyProperty BottomProperty = DependencyProperty.Register(Fields.Bottom, typeof(Boolean), typeof(SkewBoxMeshGenerator), new PropertyMetadata(true, PropertyChanged));

        public static readonly DependencyProperty SkewP1XProperty = DependencyProperty.Register(Fields.SkewP1X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP1YProperty = DependencyProperty.Register(Fields.SkewP1Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP1ZProperty = DependencyProperty.Register(Fields.SkewP1Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        public static readonly DependencyProperty SkewP2XProperty = DependencyProperty.Register(Fields.SkewP2X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP2YProperty = DependencyProperty.Register(Fields.SkewP2Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP2ZProperty = DependencyProperty.Register(Fields.SkewP2Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        public static readonly DependencyProperty SkewP3XProperty = DependencyProperty.Register(Fields.SkewP3X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP3YProperty = DependencyProperty.Register(Fields.SkewP3Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP3ZProperty = DependencyProperty.Register(Fields.SkewP3Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        public static readonly DependencyProperty SkewP4XProperty = DependencyProperty.Register(Fields.SkewP4X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP4YProperty = DependencyProperty.Register(Fields.SkewP4Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP4ZProperty = DependencyProperty.Register(Fields.SkewP4Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        public static readonly DependencyProperty SkewP5XProperty = DependencyProperty.Register(Fields.SkewP5X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP5YProperty = DependencyProperty.Register(Fields.SkewP5Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP5ZProperty = DependencyProperty.Register(Fields.SkewP5Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        public static readonly DependencyProperty SkewP6XProperty = DependencyProperty.Register(Fields.SkewP6X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP6YProperty = DependencyProperty.Register(Fields.SkewP6Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP6ZProperty = DependencyProperty.Register(Fields.SkewP6Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        public static readonly DependencyProperty SkewP7XProperty = DependencyProperty.Register(Fields.SkewP7X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP7YProperty = DependencyProperty.Register(Fields.SkewP7Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP7ZProperty = DependencyProperty.Register(Fields.SkewP7Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));

        public static readonly DependencyProperty SkewP8XProperty = DependencyProperty.Register(Fields.SkewP8X, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP8YProperty = DependencyProperty.Register(Fields.SkewP8Y, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));
        public static readonly DependencyProperty SkewP8ZProperty = DependencyProperty.Register(Fields.SkewP8Z, typeof(Double), typeof(SkewBoxMeshGenerator), new PropertyMetadata(0.0D, PropertyChanged));


        public Boolean Front { set { SetValue(FrontProperty, value); } get { return (Boolean)GetValue(FrontProperty); } }
        public Boolean Back { set { SetValue(BackProperty, value); } get { return (Boolean)GetValue(BackProperty); } }
        public Boolean Left { set { SetValue(LeftProperty, value); } get { return (Boolean)GetValue(LeftProperty); } }
        public Boolean Right { set { SetValue(RightProperty, value); } get { return (Boolean)GetValue(RightProperty); } }
        public Boolean Top { set { SetValue(TopProperty, value); } get { return (Boolean)GetValue(TopProperty); } }
        public Boolean Bottom { set { SetValue(BottomProperty, value); } get { return (Boolean)GetValue(BottomProperty); } }

        public SkewBoxMeshGenerator Duplicate()
        {
            SkewBoxMeshGenerator skewBoxMeshGenerator = new SkewBoxMeshGenerator();
            skewBoxMeshGenerator.Radius = Radius;
            skewBoxMeshGenerator.Width = Width;
            skewBoxMeshGenerator.Height = Height;
            skewBoxMeshGenerator.Depth = Depth;
            skewBoxMeshGenerator.TopBottom = TopBottom;
            skewBoxMeshGenerator.LeftRight = LeftRight;

            skewBoxMeshGenerator.Front = Front;
            skewBoxMeshGenerator.Back = Back;
            skewBoxMeshGenerator.Top = Top;
            skewBoxMeshGenerator.Bottom = Bottom;
            skewBoxMeshGenerator.Left = Left;
            skewBoxMeshGenerator.Right = Right;


            skewBoxMeshGenerator.OutIn = OutIn;
            skewBoxMeshGenerator.SkewP1X = SkewP1X;
            skewBoxMeshGenerator.SkewP1Y = SkewP1Y;
            skewBoxMeshGenerator.SkewP1Z = SkewP1Z;
            skewBoxMeshGenerator.SkewP2X = SkewP2X;
            skewBoxMeshGenerator.SkewP2Y = SkewP2Y;
            skewBoxMeshGenerator.SkewP2Z = SkewP2Z;
            skewBoxMeshGenerator.SkewP3X = SkewP3X;
            skewBoxMeshGenerator.SkewP3Y = SkewP3Y;
            skewBoxMeshGenerator.SkewP3Z = SkewP3Z;
            skewBoxMeshGenerator.SkewP4X = SkewP4X;
            skewBoxMeshGenerator.SkewP4Y = SkewP4Y;
            skewBoxMeshGenerator.SkewP4Z = SkewP4Z;
            skewBoxMeshGenerator.SkewP5X = SkewP5X;
            skewBoxMeshGenerator.SkewP5Y = SkewP5Y;
            skewBoxMeshGenerator.SkewP5Z = SkewP5Z;
            skewBoxMeshGenerator.SkewP6X = SkewP6X;
            skewBoxMeshGenerator.SkewP6Y = SkewP6Y;
            skewBoxMeshGenerator.SkewP6Z = SkewP6Z;
            skewBoxMeshGenerator.SkewP7X = SkewP7X;
            skewBoxMeshGenerator.SkewP7Y = SkewP7Y;
            skewBoxMeshGenerator.SkewP7Z = SkewP7Z;
            skewBoxMeshGenerator.SkewP8X = SkewP8X;
            skewBoxMeshGenerator.SkewP8Y = SkewP8Y;
            skewBoxMeshGenerator.SkewP8Z = SkewP8Z;
            return skewBoxMeshGenerator;
        }

        #region Methods-RefreshVariables

        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("SkewP1X");
            NotifyPropertyChanged("SkewP1Y");
            NotifyPropertyChanged("SkewP1Z");
            NotifyPropertyChanged("SkewP2X");
            NotifyPropertyChanged("SkewP2Y");
            NotifyPropertyChanged("SkewP2Z");
            NotifyPropertyChanged("SkewP3X");
            NotifyPropertyChanged("SkewP3Y");
            NotifyPropertyChanged("SkewP3Z");
            NotifyPropertyChanged("SkewP4X");
            NotifyPropertyChanged("SkewP4Y");
            NotifyPropertyChanged("SkewP4Z");
            NotifyPropertyChanged("SkewP5X");
            NotifyPropertyChanged("SkewP5Y");
            NotifyPropertyChanged("SkewP5Z");
            NotifyPropertyChanged("SkewP6X");
            NotifyPropertyChanged("SkewP6Y");
            NotifyPropertyChanged("SkewP6Z");
            NotifyPropertyChanged("SkewP7X");
            NotifyPropertyChanged("SkewP7Y");
            NotifyPropertyChanged("SkewP7Z");
            NotifyPropertyChanged("SkewP8X");
            NotifyPropertyChanged("SkewP8Y");
            NotifyPropertyChanged("SkewP8Z");
            NotifyPropertyChanged("Inch");
        }

        #endregion

        #region Private Variables

        private Double _radius = 0.5;
        private Double _width = 4;
        private Double _height = 4;
        private Double _depth = 4;
        private Double _topBottom = 0;
        private Double _leftRight = 0;
        private Double _outIn = 0;


        #endregion

        #region Public Properties

        public Double Radius { get { return _radius; } set { SetProperty(ref _radius, value); } }
        public Double Width { get { return _width; } set { SetProperty(ref _width, value); } }
        public Double Height { get { return _height; } set { SetProperty(ref _height, value); } }
        public Double Depth { get { return _depth; } set { SetProperty(ref _depth, value); } }
        public Double TopBottom { get { return _topBottom; } set { SetProperty(ref _topBottom, value); } }
        public Double LeftRight { get { return _leftRight; } set { SetProperty(ref _leftRight, value); } }
        public Double OutIn { get { return _outIn; } set { SetProperty(ref _outIn, value); } }

        public Double SkewP1X { set { SetValue(SkewP1XProperty, value); } get { return (Double)GetValue(SkewP1XProperty); } }
        public Double SkewP1Y { set { SetValue(SkewP1YProperty, value); } get { return (Double)GetValue(SkewP1YProperty); } }
        public Double SkewP1Z { set { SetValue(SkewP1ZProperty, value); } get { return (Double)GetValue(SkewP1ZProperty); } }
        public Double SkewP2X { set { SetValue(SkewP2XProperty, value); } get { return (Double)GetValue(SkewP2XProperty); } }
        public Double SkewP2Y { set { SetValue(SkewP2YProperty, value); } get { return (Double)GetValue(SkewP2YProperty); } }
        public Double SkewP2Z { set { SetValue(SkewP2ZProperty, value); } get { return (Double)GetValue(SkewP2ZProperty); } }
        public Double SkewP3X { set { SetValue(SkewP3XProperty, value); } get { return (Double)GetValue(SkewP3XProperty); } }
        public Double SkewP3Y { set { SetValue(SkewP3YProperty, value); } get { return (Double)GetValue(SkewP3YProperty); } }
        public Double SkewP3Z { set { SetValue(SkewP3ZProperty, value); } get { return (Double)GetValue(SkewP3ZProperty); } }
        public Double SkewP4X { set { SetValue(SkewP4XProperty, value); } get { return (Double)GetValue(SkewP4XProperty); } }
        public Double SkewP4Y { set { SetValue(SkewP4YProperty, value); } get { return (Double)GetValue(SkewP4YProperty); } }
        public Double SkewP4Z { set { SetValue(SkewP4ZProperty, value); } get { return (Double)GetValue(SkewP4ZProperty); } }
        public Double SkewP5X { set { SetValue(SkewP5XProperty, value); } get { return (Double)GetValue(SkewP5XProperty); } }
        public Double SkewP5Y { set { SetValue(SkewP5YProperty, value); } get { return (Double)GetValue(SkewP5YProperty); } }
        public Double SkewP5Z { set { SetValue(SkewP5ZProperty, value); } get { return (Double)GetValue(SkewP5ZProperty); } }
        public Double SkewP6X { set { SetValue(SkewP6XProperty, value); } get { return (Double)GetValue(SkewP6XProperty); } }
        public Double SkewP6Y { set { SetValue(SkewP6YProperty, value); } get { return (Double)GetValue(SkewP6YProperty); } }
        public Double SkewP6Z { set { SetValue(SkewP6ZProperty, value); } get { return (Double)GetValue(SkewP6ZProperty); } }
        public Double SkewP7X { set { SetValue(SkewP7XProperty, value); } get { return (Double)GetValue(SkewP7XProperty); } }
        public Double SkewP7Y { set { SetValue(SkewP7YProperty, value); } get { return (Double)GetValue(SkewP7YProperty); } }
        public Double SkewP7Z { set { SetValue(SkewP7ZProperty, value); } get { return (Double)GetValue(SkewP7ZProperty);} }
        public Double SkewP8X { set { SetValue(SkewP8XProperty, value); } get { return (Double)GetValue(SkewP8XProperty); } }
        public Double SkewP8Y { set { SetValue(SkewP8YProperty, value); } get { return (Double)GetValue(SkewP8YProperty); } }
        public Double SkewP8Z { set { SetValue(SkewP8ZProperty, value); } get { return (Double)GetValue(SkewP8ZProperty); } }

        #endregion

        #region Public Readonly Properties

        public Double TQ1X { get { return +(Width / 2) + 0 + SkewP1X; } }

        public Double TQ2X { get { return -(Width / 2) + 0 + SkewP2X; } }

        public Double TQ3X { get { return -(Width / 2) + 0 + SkewP3X; } }

        public Double TQ4X { get { return +(Width / 2) + 0 + SkewP4X; } }

        public Double TQ1Y { get { return -(Height / 2) + 0 + SkewP1Y; } }

        public Double TQ2Y { get { return -(Height / 2) + 0 + SkewP2Y; } }

        public Double TQ3Y { get { return +(Height / 2) + 0 + SkewP3Y; } }

        public Double TQ4Y { get { return +(Height / 2) + 0 + SkewP4Y; } }

        public Double TQ1Z { get { return +(Depth / 2) + TopBottom + SkewP1Z; } }

        public Double TQ2Z { get { return +(Depth / 2) + TopBottom + SkewP2Z; } }

        public Double TQ3Z { get { return +(Depth / 2) + TopBottom + SkewP3Z; } }

        public Double TQ4Z { get { return +(Depth / 2) + TopBottom + SkewP4Z; } }

        public Double LQ1X { get { return +(Width / 2) + LeftRight + SkewP1X; } }

        public Double LQ2X { get { return +(Width / 2) + LeftRight + SkewP4X; } }

        public Double LQ3X { get { return +(Width / 2) + LeftRight + SkewP5X; } }

        public Double LQ4X { get { return +(Width / 2) + LeftRight + SkewP8X; } }

        public Double LQ1Y { get { return -(Height / 2) + 0 + SkewP1Y; } }

        public Double LQ2Y { get { return +(Height / 2) + 0 + SkewP4Y; } }

        public Double LQ3Y { get { return +(Height / 2) + 0 + SkewP5Y; } }

        public Double LQ4Y { get { return -(Height / 2) + 0 + SkewP8Y; } }

        public Double LQ1Z { get { return +(Depth / 2) + 0 + SkewP1Z; } }

        public Double LQ2Z { get { return +(Depth / 2) + 0 + SkewP4Z; } }

        public Double LQ3Z { get { return -(Depth / 2) + 0 + SkewP5Z; } }

        public Double LQ4Z { get { return -(Depth / 2) + 0 + SkewP8Z; } }

        public Double RQ1X { get { return -(Width / 2) - LeftRight + SkewP2X; } }

        public Double RQ1Y { get { return -(Height / 2) + 0 + SkewP2Y; } }

        public Double RQ1Z { get { return +(Depth / 2) + 0 + SkewP3Z; } }

        public Double RQ2X { get { return -(Width / 2) - LeftRight + SkewP3X; } }

        public Double RQ3X { get { return -(Width / 2) - LeftRight + SkewP6X; } }

        public Double RQ4X { get { return -(Width / 2) - LeftRight + SkewP7X; } }

        public Double RQ2Y { get { return +(Height / 2) + 0 + SkewP3Y; } }

        public Double RQ3Y { get { return +(Height / 2) + 0 + SkewP6Y; } }

        public Double RQ4Y { get { return -(Height / 2) + 0 + SkewP7Y; } }

        public Double RQ2Z { get { return +(Depth / 2) + 0 + SkewP2Z; } }

        public Double RQ3Z { get { return -(Depth / 2) + 0 + SkewP7Z; } }

        public Double RQ4Z { get { return -(Depth / 2) + 0 + SkewP6Z; } }

        public Double BQ1X { get { return +(Width / 2) + 0 + SkewP8X; } }

        public Double BQ2X { get { return -(Width / 2) + 0 + SkewP7X; } }

        public Double BQ3X { get { return -(Width / 2) + 0 + SkewP6X; } }

        public Double BQ4X { get { return +(Width / 2) + 0 + SkewP5X; } }

        public Double BQ1Y { get { return -(Height / 2) + 0 + SkewP8Y; } }

        public Double BQ2Y { get { return -(Height / 2) + 0 + SkewP7Y; } }

        public Double BQ3Y { get { return +(Height / 2) + 0 + SkewP6Y; } }

        public Double BQ4Y { get { return +(Height / 2) + 0 + SkewP5Y; } }

        public Double BQ1Z { get { return -(Depth / 2) - TopBottom + SkewP8Z; } }

        public Double BQ2Z { get { return -(Depth / 2) - TopBottom + SkewP7Z; } }

        public Double BQ3Z { get { return -(Depth / 2) - TopBottom + SkewP6Z; } }

        public Double BQ4Z { get { return -(Depth / 2) - TopBottom + SkewP5Z; } }

        public Double IQ1X { get { return -(Width / 2) + 0 + SkewP3X; } }

        public Double IQ2X { get { return +(Width / 2) + 0 + SkewP4X; } }

        public Double IQ3X { get { return +(Width / 2) + 0 + SkewP5X; } }

        public Double IQ4X { get { return -(Width / 2) + 0 + SkewP6X; } }

        public Double IQ1Y { get { return +(Height / 2) + OutIn + SkewP4Y; } }

        public Double IQ2Y { get { return +(Height / 2) + OutIn + SkewP3Y; } }

        public Double IQ3Y { get { return +(Height / 2) + OutIn + SkewP6Y; } }

        public Double IQ4Y { get { return +(Height / 2) + OutIn + SkewP5Y; } }

        public Double IQ1Z { get { return +(Depth / 2) - 0 + SkewP4Z; } }

        public Double IQ2Z { get { return +(Depth / 2) - 0 + SkewP3Z; } }

        public Double IQ3Z { get { return -(Depth / 2) + 0 + SkewP6Z; } }

        public Double IQ4Z { get { return -(Depth / 2) + 0 + SkewP5Z; } }

        public Double OQ1X { get { return -(Width / 2) + 0 + SkewP2X; } }

        public Double OQ2X { get { return +(Width / 2) + 0 + SkewP1X; } }

        public Double OQ3X { get { return +(Width / 2) + 0 + SkewP8X; } }

        public Double OQ4X { get { return -(Width / 2) + 0 + SkewP7X; } }

        public Double OQ1Y { get { return -(Height / 2) - OutIn + SkewP2Y; } }

        public Double OQ2Y { get { return -(Height / 2) - OutIn + SkewP1Y; } }

        public Double OQ3Y { get { return -(Height / 2) - OutIn + SkewP7Y; } }

        public Double OQ4Y { get { return -(Height / 2) - OutIn + SkewP8Y; } }

        public Double OQ1Z { get { return +(Depth / 2) + 0 + SkewP2Z; } }

        public Double OQ2Z { get { return +(Depth / 2) + 0 + SkewP1Z; } }

        public Double OQ3Z { get { return -(Depth / 2) + 0 + SkewP8Z; } }

        public Double OQ4Z { get { return -(Depth / 2) + 0 + SkewP7Z; } }

        public Double Inch { get { return 1 / 12; } }


        #endregion

        #region Private Commands

        private ICommand _decreaseRadiusCommandIc = null;[XmlIgnore] public ICommand DecreaseRadiusCommandIc => _decreaseRadiusCommandIc ?? (_decreaseRadiusCommandIc = new RelayCommand<Object>(DecreaseRadiusCommandIcExecuted)); public void DecreaseRadiusCommandIcExecuted(Object obj) { Radius -= MovementValue; RebuildMesh(); }
        private ICommand _increaseRadiusCommandIc = null;[XmlIgnore] public ICommand IncreaseRadiusCommandIc => _increaseRadiusCommandIc ?? (_increaseRadiusCommandIc = new RelayCommand<Object>(IncreaseRadiusCommandIcExecuted)); public void IncreaseRadiusCommandIcExecuted(Object obj) { Radius += MovementValue; RebuildMesh(); }
        private ICommand _decreaseWidthCommandIc = null;[XmlIgnore] public ICommand DecreaseWidthCommandIc => _decreaseWidthCommandIc ?? (_decreaseWidthCommandIc = new RelayCommand<Object>(DecreaseWidthCommandIcExecuted)); public void DecreaseWidthCommandIcExecuted(Object obj) { Width -= MovementValue; RebuildMesh(); }
        private ICommand _increaseWidthCommandIc = null;[XmlIgnore] public ICommand IncreaseWidthCommandIc => _increaseWidthCommandIc ?? (_increaseWidthCommandIc = new RelayCommand<Object>(IncreaseWidthCommandIcExecuted)); public void IncreaseWidthCommandIcExecuted(Object obj) { Width += MovementValue; RebuildMesh(); }
        private ICommand _decreaseHeightCommandIc = null;[XmlIgnore] public ICommand DecreaseHeightCommandIc => _decreaseHeightCommandIc ?? (_decreaseHeightCommandIc = new RelayCommand<Object>(DecreaseHeightCommandIcExecuted)); public void DecreaseHeightCommandIcExecuted(Object obj) { Height -= MovementValue; RebuildMesh(); }
        private ICommand _increaseHeightCommandIc = null;[XmlIgnore] public ICommand IncreaseHeightCommandIc => _increaseHeightCommandIc ?? (_increaseHeightCommandIc = new RelayCommand<Object>(IncreaseHeightCommandIcExecuted)); public void IncreaseHeightCommandIcExecuted(Object obj) { Height += MovementValue; RebuildMesh(); }
        private ICommand _decreaseDepthCommandIc = null;[XmlIgnore] public ICommand DecreaseDepthCommandIc => _decreaseDepthCommandIc ?? (_decreaseDepthCommandIc = new RelayCommand<Object>(DecreaseDepthCommandIcExecuted)); public void DecreaseDepthCommandIcExecuted(Object obj) { Depth -= MovementValue; RebuildMesh(); }
        private ICommand _increaseDepthCommandIc = null;[XmlIgnore] public ICommand IncreaseDepthCommandIc => _increaseDepthCommandIc ?? (_increaseDepthCommandIc = new RelayCommand<Object>(IncreaseDepthCommandIcExecuted)); public void IncreaseDepthCommandIcExecuted(Object obj) { Depth += MovementValue; RebuildMesh(); }
        private ICommand _decreaseTopBottomCommandIc = null;[XmlIgnore] public ICommand DecreaseTopBottomCommandIc => _decreaseTopBottomCommandIc ?? (_decreaseTopBottomCommandIc = new RelayCommand<Object>(DecreaseTopBottomCommandIcExecuted)); public void DecreaseTopBottomCommandIcExecuted(Object obj) { TopBottom -= MovementValue; RebuildMesh(); }
        private ICommand _increaseTopBottomCommandIc = null;[XmlIgnore] public ICommand IncreaseTopBottomCommandIc => _increaseTopBottomCommandIc ?? (_increaseTopBottomCommandIc = new RelayCommand<Object>(IncreaseTopBottomCommandIcExecuted)); public void IncreaseTopBottomCommandIcExecuted(Object obj) { TopBottom += MovementValue; RebuildMesh(); }
        private ICommand _decreaseLeftRightCommandIc = null;[XmlIgnore] public ICommand DecreaseLeftRightCommandIc => _decreaseLeftRightCommandIc ?? (_decreaseLeftRightCommandIc = new RelayCommand<Object>(DecreaseLeftRightCommandIcExecuted)); public void DecreaseLeftRightCommandIcExecuted(Object obj) { LeftRight -= MovementValue; RebuildMesh(); }
        private ICommand _increaseLeftRightCommandIc = null;[XmlIgnore] public ICommand IncreaseLeftRightCommandIc => _increaseLeftRightCommandIc ?? (_increaseLeftRightCommandIc = new RelayCommand<Object>(IncreaseLeftRightCommandIcExecuted)); public void IncreaseLeftRightCommandIcExecuted(Object obj) { LeftRight += MovementValue; RebuildMesh(); }
        private ICommand _decreaseOutInCommandIc = null;[XmlIgnore] public ICommand DecreaseOutInCommandIc => _decreaseOutInCommandIc ?? (_decreaseOutInCommandIc = new RelayCommand<Object>(DecreaseOutInCommandIcExecuted)); public void DecreaseOutInCommandIcExecuted(Object obj) { OutIn -= MovementValue; RebuildMesh(); }
        private ICommand _increaseOutInCommandIc = null;[XmlIgnore] public ICommand IncreaseOutInCommandIc => _increaseOutInCommandIc ?? (_increaseOutInCommandIc = new RelayCommand<Object>(IncreaseOutInCommandIcExecuted)); public void IncreaseOutInCommandIcExecuted(Object obj) { OutIn += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP1XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP1XCommandIc => _decreaseSkewP1XCommandIc ?? (_decreaseSkewP1XCommandIc = new RelayCommand<Object>(DecreaseSkewP1XCommandIcExecuted)); public void DecreaseSkewP1XCommandIcExecuted(Object obj) { SkewP1X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP1XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP1XCommandIc => _increaseSkewP1XCommandIc ?? (_increaseSkewP1XCommandIc = new RelayCommand<Object>(IncreaseSkewP1XCommandIcExecuted)); public void IncreaseSkewP1XCommandIcExecuted(Object obj) { SkewP1X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP1YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP1YCommandIc => _decreaseSkewP1YCommandIc ?? (_decreaseSkewP1YCommandIc = new RelayCommand<Object>(DecreaseSkewP1YCommandIcExecuted)); public void DecreaseSkewP1YCommandIcExecuted(Object obj) { SkewP1Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP1YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP1YCommandIc => _increaseSkewP1YCommandIc ?? (_increaseSkewP1YCommandIc = new RelayCommand<Object>(IncreaseSkewP1YCommandIcExecuted)); public void IncreaseSkewP1YCommandIcExecuted(Object obj) { SkewP1Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP1ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP1ZCommandIc => _decreaseSkewP1ZCommandIc ?? (_decreaseSkewP1ZCommandIc = new RelayCommand<Object>(DecreaseSkewP1ZCommandIcExecuted)); public void DecreaseSkewP1ZCommandIcExecuted(Object obj) { SkewP1Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP1ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP1ZCommandIc => _increaseSkewP1ZCommandIc ?? (_increaseSkewP1ZCommandIc = new RelayCommand<Object>(IncreaseSkewP1ZCommandIcExecuted)); public void IncreaseSkewP1ZCommandIcExecuted(Object obj) { SkewP1Z += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP2XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP2XCommandIc => _decreaseSkewP2XCommandIc ?? (_decreaseSkewP2XCommandIc = new RelayCommand<Object>(DecreaseSkewP2XCommandIcExecuted)); public void DecreaseSkewP2XCommandIcExecuted(Object obj) { SkewP2X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP2XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP2XCommandIc => _increaseSkewP2XCommandIc ?? (_increaseSkewP2XCommandIc = new RelayCommand<Object>(IncreaseSkewP2XCommandIcExecuted)); public void IncreaseSkewP2XCommandIcExecuted(Object obj) { SkewP2X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP2YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP2YCommandIc => _decreaseSkewP2YCommandIc ?? (_decreaseSkewP2YCommandIc = new RelayCommand<Object>(DecreaseSkewP2YCommandIcExecuted)); public void DecreaseSkewP2YCommandIcExecuted(Object obj) { SkewP2Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP2YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP2YCommandIc => _increaseSkewP2YCommandIc ?? (_increaseSkewP2YCommandIc = new RelayCommand<Object>(IncreaseSkewP2YCommandIcExecuted)); public void IncreaseSkewP2YCommandIcExecuted(Object obj) { SkewP2Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP2ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP2ZCommandIc => _decreaseSkewP2ZCommandIc ?? (_decreaseSkewP2ZCommandIc = new RelayCommand<Object>(DecreaseSkewP2ZCommandIcExecuted)); public void DecreaseSkewP2ZCommandIcExecuted(Object obj) { SkewP2Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP2ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP2ZCommandIc => _increaseSkewP2ZCommandIc ?? (_increaseSkewP2ZCommandIc = new RelayCommand<Object>(IncreaseSkewP2ZCommandIcExecuted)); public void IncreaseSkewP2ZCommandIcExecuted(Object obj) { SkewP2Z += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP3XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP3XCommandIc => _decreaseSkewP3XCommandIc ?? (_decreaseSkewP3XCommandIc = new RelayCommand<Object>(DecreaseSkewP3XCommandIcExecuted)); public void DecreaseSkewP3XCommandIcExecuted(Object obj) { SkewP3X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP3XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP3XCommandIc => _increaseSkewP3XCommandIc ?? (_increaseSkewP3XCommandIc = new RelayCommand<Object>(IncreaseSkewP3XCommandIcExecuted)); public void IncreaseSkewP3XCommandIcExecuted(Object obj) { SkewP3X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP3YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP3YCommandIc => _decreaseSkewP3YCommandIc ?? (_decreaseSkewP3YCommandIc = new RelayCommand<Object>(DecreaseSkewP3YCommandIcExecuted)); public void DecreaseSkewP3YCommandIcExecuted(Object obj) { SkewP3Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP3YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP3YCommandIc => _increaseSkewP3YCommandIc ?? (_increaseSkewP3YCommandIc = new RelayCommand<Object>(IncreaseSkewP3YCommandIcExecuted)); public void IncreaseSkewP3YCommandIcExecuted(Object obj) { SkewP3Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP3ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP3ZCommandIc => _decreaseSkewP3ZCommandIc ?? (_decreaseSkewP3ZCommandIc = new RelayCommand<Object>(DecreaseSkewP3ZCommandIcExecuted)); public void DecreaseSkewP3ZCommandIcExecuted(Object obj) { SkewP3Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP3ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP3ZCommandIc => _increaseSkewP3ZCommandIc ?? (_increaseSkewP3ZCommandIc = new RelayCommand<Object>(IncreaseSkewP3ZCommandIcExecuted)); public void IncreaseSkewP3ZCommandIcExecuted(Object obj) { SkewP3Z += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP4XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP4XCommandIc => _decreaseSkewP4XCommandIc ?? (_decreaseSkewP4XCommandIc = new RelayCommand<Object>(DecreaseSkewP4XCommandIcExecuted)); public void DecreaseSkewP4XCommandIcExecuted(Object obj) { SkewP4X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP4XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP4XCommandIc => _increaseSkewP4XCommandIc ?? (_increaseSkewP4XCommandIc = new RelayCommand<Object>(IncreaseSkewP4XCommandIcExecuted)); public void IncreaseSkewP4XCommandIcExecuted(Object obj) { SkewP4X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP4YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP4YCommandIc => _decreaseSkewP4YCommandIc ?? (_decreaseSkewP4YCommandIc = new RelayCommand<Object>(DecreaseSkewP4YCommandIcExecuted)); public void DecreaseSkewP4YCommandIcExecuted(Object obj) { SkewP4Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP4YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP4YCommandIc => _increaseSkewP4YCommandIc ?? (_increaseSkewP4YCommandIc = new RelayCommand<Object>(IncreaseSkewP4YCommandIcExecuted)); public void IncreaseSkewP4YCommandIcExecuted(Object obj) { SkewP4Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP4ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP4ZCommandIc => _decreaseSkewP4ZCommandIc ?? (_decreaseSkewP4ZCommandIc = new RelayCommand<Object>(DecreaseSkewP4ZCommandIcExecuted)); public void DecreaseSkewP4ZCommandIcExecuted(Object obj) { SkewP4Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP4ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP4ZCommandIc => _increaseSkewP4ZCommandIc ?? (_increaseSkewP4ZCommandIc = new RelayCommand<Object>(IncreaseSkewP4ZCommandIcExecuted)); public void IncreaseSkewP4ZCommandIcExecuted(Object obj) { SkewP4Z += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP5XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP5XCommandIc => _decreaseSkewP5XCommandIc ?? (_decreaseSkewP5XCommandIc = new RelayCommand<Object>(DecreaseSkewP5XCommandIcExecuted)); public void DecreaseSkewP5XCommandIcExecuted(Object obj) { SkewP5X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP5XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP5XCommandIc => _increaseSkewP5XCommandIc ?? (_increaseSkewP5XCommandIc = new RelayCommand<Object>(IncreaseSkewP5XCommandIcExecuted)); public void IncreaseSkewP5XCommandIcExecuted(Object obj) { SkewP5X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP5YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP5YCommandIc => _decreaseSkewP5YCommandIc ?? (_decreaseSkewP5YCommandIc = new RelayCommand<Object>(DecreaseSkewP5YCommandIcExecuted)); public void DecreaseSkewP5YCommandIcExecuted(Object obj) { SkewP5Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP5YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP5YCommandIc => _increaseSkewP5YCommandIc ?? (_increaseSkewP5YCommandIc = new RelayCommand<Object>(IncreaseSkewP5YCommandIcExecuted)); public void IncreaseSkewP5YCommandIcExecuted(Object obj) { SkewP5Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP5ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP5ZCommandIc => _decreaseSkewP5ZCommandIc ?? (_decreaseSkewP5ZCommandIc = new RelayCommand<Object>(DecreaseSkewP5ZCommandIcExecuted)); public void DecreaseSkewP5ZCommandIcExecuted(Object obj) { SkewP5Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP5ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP5ZCommandIc => _increaseSkewP5ZCommandIc ?? (_increaseSkewP5ZCommandIc = new RelayCommand<Object>(IncreaseSkewP5ZCommandIcExecuted)); public void IncreaseSkewP5ZCommandIcExecuted(Object obj) { SkewP5Z += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP6XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP6XCommandIc => _decreaseSkewP6XCommandIc ?? (_decreaseSkewP6XCommandIc = new RelayCommand<Object>(DecreaseSkewP6XCommandIcExecuted)); public void DecreaseSkewP6XCommandIcExecuted(Object obj) { SkewP6X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP6XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP6XCommandIc => _increaseSkewP6XCommandIc ?? (_increaseSkewP6XCommandIc = new RelayCommand<Object>(IncreaseSkewP6XCommandIcExecuted)); public void IncreaseSkewP6XCommandIcExecuted(Object obj) { SkewP6X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP6YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP6YCommandIc => _decreaseSkewP6YCommandIc ?? (_decreaseSkewP6YCommandIc = new RelayCommand<Object>(DecreaseSkewP6YCommandIcExecuted)); public void DecreaseSkewP6YCommandIcExecuted(Object obj) { SkewP6Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP6YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP6YCommandIc => _increaseSkewP6YCommandIc ?? (_increaseSkewP6YCommandIc = new RelayCommand<Object>(IncreaseSkewP6YCommandIcExecuted)); public void IncreaseSkewP6YCommandIcExecuted(Object obj) { SkewP6Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP6ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP6ZCommandIc => _decreaseSkewP6ZCommandIc ?? (_decreaseSkewP6ZCommandIc = new RelayCommand<Object>(DecreaseSkewP6ZCommandIcExecuted)); public void DecreaseSkewP6ZCommandIcExecuted(Object obj) { SkewP6Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP6ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP6ZCommandIc => _increaseSkewP6ZCommandIc ?? (_increaseSkewP6ZCommandIc = new RelayCommand<Object>(IncreaseSkewP6ZCommandIcExecuted)); public void IncreaseSkewP6ZCommandIcExecuted(Object obj) { SkewP6Z += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP7XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP7XCommandIc => _decreaseSkewP7XCommandIc ?? (_decreaseSkewP7XCommandIc = new RelayCommand<Object>(DecreaseSkewP7XCommandIcExecuted)); public void DecreaseSkewP7XCommandIcExecuted(Object obj) { SkewP7X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP7XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP7XCommandIc => _increaseSkewP7XCommandIc ?? (_increaseSkewP7XCommandIc = new RelayCommand<Object>(IncreaseSkewP7XCommandIcExecuted)); public void IncreaseSkewP7XCommandIcExecuted(Object obj) { SkewP7X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP7YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP7YCommandIc => _decreaseSkewP7YCommandIc ?? (_decreaseSkewP7YCommandIc = new RelayCommand<Object>(DecreaseSkewP7YCommandIcExecuted)); public void DecreaseSkewP7YCommandIcExecuted(Object obj) { SkewP7Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP7YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP7YCommandIc => _increaseSkewP7YCommandIc ?? (_increaseSkewP7YCommandIc = new RelayCommand<Object>(IncreaseSkewP7YCommandIcExecuted)); public void IncreaseSkewP7YCommandIcExecuted(Object obj) { SkewP7Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP7ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP7ZCommandIc => _decreaseSkewP7ZCommandIc ?? (_decreaseSkewP7ZCommandIc = new RelayCommand<Object>(DecreaseSkewP7ZCommandIcExecuted)); public void DecreaseSkewP7ZCommandIcExecuted(Object obj) { SkewP7Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP7ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP7ZCommandIc => _increaseSkewP7ZCommandIc ?? (_increaseSkewP7ZCommandIc = new RelayCommand<Object>(IncreaseSkewP7ZCommandIcExecuted)); public void IncreaseSkewP7ZCommandIcExecuted(Object obj) { SkewP7Z += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP8XCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP8XCommandIc => _decreaseSkewP8XCommandIc ?? (_decreaseSkewP8XCommandIc = new RelayCommand<Object>(DecreaseSkewP8XCommandIcExecuted)); public void DecreaseSkewP8XCommandIcExecuted(Object obj) { SkewP8X -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP8XCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP8XCommandIc => _increaseSkewP8XCommandIc ?? (_increaseSkewP8XCommandIc = new RelayCommand<Object>(IncreaseSkewP8XCommandIcExecuted)); public void IncreaseSkewP8XCommandIcExecuted(Object obj) { SkewP8X += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP8YCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP8YCommandIc => _decreaseSkewP8YCommandIc ?? (_decreaseSkewP8YCommandIc = new RelayCommand<Object>(DecreaseSkewP8YCommandIcExecuted)); public void DecreaseSkewP8YCommandIcExecuted(Object obj) { SkewP8Y -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP8YCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP8YCommandIc => _increaseSkewP8YCommandIc ?? (_increaseSkewP8YCommandIc = new RelayCommand<Object>(IncreaseSkewP8YCommandIcExecuted)); public void IncreaseSkewP8YCommandIcExecuted(Object obj) { SkewP8Y += MovementValue; RebuildMesh(); }
        private ICommand _decreaseSkewP8ZCommandIc = null;[XmlIgnore] public ICommand DecreaseSkewP8ZCommandIc => _decreaseSkewP8ZCommandIc ?? (_decreaseSkewP8ZCommandIc = new RelayCommand<Object>(DecreaseSkewP8ZCommandIcExecuted)); public void DecreaseSkewP8ZCommandIcExecuted(Object obj) { SkewP8Z -= MovementValue; RebuildMesh(); }
        private ICommand _increaseSkewP8ZCommandIc = null;[XmlIgnore] public ICommand IncreaseSkewP8ZCommandIc => _increaseSkewP8ZCommandIc ?? (_increaseSkewP8ZCommandIc = new RelayCommand<Object>(IncreaseSkewP8ZCommandIcExecuted)); public void IncreaseSkewP8ZCommandIcExecuted(Object obj) { SkewP8Z += MovementValue; RebuildMesh(); }

        #endregion

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

            BoxFaces? boxFaces = null;
            if (Front) { if (boxFaces == null) boxFaces = BoxFaces.Front; else boxFaces = boxFaces.Add(BoxFaces.Front); } else if (boxFaces.Has(BoxFaces.Front)) { boxFaces.Remove(BoxFaces.Front); }
            if (Back) { if (boxFaces == null) boxFaces = BoxFaces.Back; else boxFaces = boxFaces.Add(BoxFaces.Back); } else if (boxFaces.Has(BoxFaces.Back)) { boxFaces.Remove(BoxFaces.Back); }
            if (Left) { if (boxFaces == null) boxFaces = BoxFaces.Left; else boxFaces = boxFaces.Add(BoxFaces.Left); } else if (boxFaces.Has(BoxFaces.Left)) { boxFaces.Remove(BoxFaces.Left); }
            if (Right) { if (boxFaces == null) boxFaces = BoxFaces.Right; else boxFaces = boxFaces.Add(BoxFaces.Right); } else if (boxFaces.Has(BoxFaces.Right)) { boxFaces.Remove(BoxFaces.Right); }
            if (Top) { if (boxFaces == null) boxFaces = BoxFaces.Top; else boxFaces = boxFaces.Add(BoxFaces.Top); } else if (boxFaces.Has(BoxFaces.Top)) { boxFaces.Remove(BoxFaces.Top); }
            if (Bottom) { if (boxFaces == null) boxFaces = BoxFaces.Bottom; else boxFaces = boxFaces.Add(BoxFaces.Bottom); } else if (boxFaces.Has(BoxFaces.Bottom)) { boxFaces.Remove(BoxFaces.Bottom); }

            if (boxFaces == null) boxFaces = BoxFaces.All;


            MeshGeometry3D mesh = new MeshGeometry3D();
            mesh.Positions = new Point3DCollection()
                    {
                         // new Point3D(TQ1X + 2 + SkewP1X,TQ1Y + -2 + SkewP1Y,TQ1Z + 2 + SkewP1Z),new Point3D(TQ4X + 2,TQ4Y + 2 ,TQ4Z + 2),new Point3D(TQ3X + -2,TQ3Y + 2,TQ3Z + 2)
                         //,new Point3D(TQ1X + 2 + SkewP1X,TQ1Y + -2 + SkewP1Y,TQ1Z + 2 + SkewP1Z),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(OQ1X + -2,OQ1Y + -2,OQ1Z + 2),new Point3D(OQ4X + -2,OQ3Y + -2 ,OQ4Z + -2),new Point3D(OQ3X + 2,OQ4Y + -2,OQ3Z + -2)
                         //,new Point3D(OQ1X + -2,OQ1Y + -2,OQ1Z + 2),new Point3D(OQ3X + 2,OQ4Y + -2 ,OQ3Z + -2),new Point3D(OQ2X + 2,OQ2Y + -2,OQ2Z + 2)

                          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(OQ1X /* -2 */,OQ1Y /* -2 */,OQ1Z /* 2 */),new Point3D(OQ4X /* -2 */,OQ3Y /* -2 */,OQ4Z /* -2 */),new Point3D(OQ3X /* 2 */,OQ4Y /* -2 */,OQ3Z /* -2 */)
                         ,new Point3D(OQ1X /* -2 */,OQ1Y /* -2 */,OQ1Z /* 2 */),new Point3D(OQ3X /* 2 */,OQ4Y /* -2 */,OQ3Z /* -2 */),new Point3D(OQ2X /* 2 */,OQ2Y /* -2 */,OQ2Z /* 2 */)
                    };

            mesh.TriangleIndices = new Int32Collection();

            if (Top) { mesh.TriangleIndices.AddRange(new Int32Collection() { 0, 1, 2, 0, 2, 5 }); }
            if (Bottom) { mesh.TriangleIndices.AddRange(new Int32Collection() { 6, 7, 8, 6, 8, 11 }); }
            if (Front) { mesh.TriangleIndices.AddRange(new Int32Collection() { 12, 13, 14, 12, 14, 17 }); }
            if (Back) { mesh.TriangleIndices.AddRange(new Int32Collection() { 18, 19, 20, 18, 20, 23 }); }
            if (Left) { mesh.TriangleIndices.AddRange(new Int32Collection() { 24, 25, 26, 24, 26, 29 }); }
            if (Right) { mesh.TriangleIndices.AddRange(new Int32Collection() { 30, 31, 32, 30, 32, 35 }); }

            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),
            };

            mesh.Normals = new Vector3DCollection()
            {

            };


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

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

