Beispiel #1
0
        protected override MutableObject Mutate(MutableObject mutable)
        {
            QuaternionTarget.SetValue(new Quaternion(
                                          XValue.GetFirstValue(mutable),
                                          YValue.GetFirstValue(mutable),
                                          ZValue.GetFirstValue(mutable),
                                          WValue.GetFirstValue(mutable)), mutable);

            return(mutable);
        }
Beispiel #2
0
        public VectorSlider(PropertyInfo prop, object owner, float min = 0, float max = 1, NodeType type = NodeType.Float4, bool isInt = false)
        {
            InitializeComponent();
            property      = prop;
            propertyOwner = owner;
            this.min      = min;
            this.max      = max;

            switch (type)
            {
            case NodeType.Float2:
                ZView.Visibility = Visibility.Collapsed;
                WView.Visibility = Visibility.Collapsed;
                break;

            case NodeType.Float3:
                ZView.Visibility = Visibility.Visible;
                WView.Visibility = Visibility.Collapsed;
                break;

            case NodeType.Float4:
                ZView.Visibility = Visibility.Visible;
                WView.Visibility = Visibility.Visible;
                break;
            }

            object b = prop.GetValue(owner);

            if (b == null)
            {
                pc = new VectorPropertyContainer(new MVector());
            }
            else
            {
                MVector vec = (MVector)b;
                pc = new VectorPropertyContainer(vec);
            }

            pc.OnUpdate += Pc_OnUpdate;

            var xprop = pc.GetType().GetProperty("XProp");
            var yprop = pc.GetType().GetProperty("YProp");
            var zprop = pc.GetType().GetProperty("ZProp");
            var wprop = pc.GetType().GetProperty("WProp");

            XValue.IsInt = isInt;
            YValue.IsInt = isInt;
            ZValue.IsInt = isInt;
            WValue.IsInt = isInt;

            XValue.Set(min, max, xprop, pc);
            YValue.Set(min, max, yprop, pc);
            ZValue.Set(min, max, zprop, pc);
            WValue.Set(min, max, wprop, pc);
        }
 protected override MutableObject Mutate(MutableObject mutable)
 {
     foreach (var entry in VectorScope.GetEntries(mutable))
     {
         Vector3Target.SetValue(new Vector3(
                                    XValue.GetFirstValueBelowArrity(entry),
                                    YValue.GetFirstValueBelowArrity(entry),
                                    ZValue.GetFirstValueBelowArrity(entry)), entry);
     }
     return(mutable);
 }
Beispiel #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = XValue.GetHashCode();
         hashCode = (hashCode * 397) ^ YValue.GetHashCode();
         hashCode = (hashCode * 397) ^ ZValue.GetHashCode();
         hashCode = (hashCode * 397) ^ Timestamp.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #5
0
        protected override MutableObject Mutate(MutableObject mutable)
        {
            foreach (var entry in Vector.GetEntries(mutable))
            {
                var vector = Vector.GetValue(entry);

                XValue.SetValue(vector.x, entry);
                YValue.SetValue(vector.y, entry);
                ZValue.SetValue(vector.z, entry);
            }

            return(mutable);
        }
        protected override async Task OnParametersSetAsync()
        {
            series.Name           = Name;
            series.ShowDataLabels = ShowDataLabels;
            series.Stroke         = Stroke;
            var xCompiled = XValue.Compile();
            IEnumerable <DataPoint <TItem> > datalist;

            if (YAggregate == null)
            {
                var yCompiled = YValue.Compile();
                datalist = Items.Select(e => new DataPoint <TItem> {
                    X = xCompiled.Invoke(e), Y = yCompiled.Invoke(e), Items = new List <TItem> {
                        e
                    }
                });
            }
            else
            {
                var yAggCompiled = YAggregate.Compile();
                datalist = Items.GroupBy(e => xCompiled.Invoke(e)).Select(d => new DataPoint <TItem> {
                    X = d.Key, Y = yAggCompiled.Invoke(d), Items = d.ToList()
                });
            }

            if (OrderBy != null)
            {
                datalist = datalist.OrderBy(o => OrderBy.Compile().Invoke(o));
            }
            else if (OrderByDescending != null)
            {
                datalist = datalist.OrderByDescending(o => OrderByDescending.Compile().Invoke(o));
            }

            datalist    = datalist.ToList();
            series.Data = datalist;

            if (!Chart.ManualRender && Chart.ForceRender == false && currentDatalist != null && !currentDatalist.SequenceEqual(datalist, new DataPointComparer <TItem>()))
            {
                Chart.ForceRender = true;
            }

            currentDatalist = datalist;
        }
Beispiel #7
0
        public IEnumerable <IDataPoint <TItem> > GenerateDataPoints(IEnumerable <TItem> items)
        {
            IEnumerable <DataPoint <TItem> > data;

            if (YValue != null)
            {
                data = items.Select(e => new DataPoint <TItem>
                {
                    X     = XValue.Invoke(e),
                    Y     = YValue.Invoke(e),
                    Items = new List <TItem> {
                        e
                    },
                    FillColor = GetPointColor(e)
                });
            }
            else if (YAggregate != null)
            {
                data = items.GroupBy(XValue)
                       .Select(d => new DataPoint <TItem>
                {
                    X         = d.Key,
                    Y         = YAggregate.Invoke(d),
                    Items     = d.ToList(),
                    FillColor = GetPointColor(d)
                });
            }
            else
            {
                return(new List <IDataPoint <TItem> >());
            }


            if (OrderBy != null)
            {
                data = data.OrderBy(OrderBy);
            }
            else if (OrderByDescending != null)
            {
                data = data.OrderByDescending(OrderByDescending);
            }

            return(UpdateDataPoints(data, DataPointMutator));
        }
Beispiel #8
0
        private void UpdateAxisAngleSettings(object sender, EventArgs e)
        {
            //Clear prior values
            myprocTransformGroup.Children.Clear();
            WValue.Clear();
            XValue.Clear();
            YValue.Clear();
            ZValue.Clear();

            //<SnippetQuaternionView3DN4>
            //Read new settings
            Double angle = System.Convert.ToDouble(AngleValue.Text);

            try
            {
                Double xaxis = System.Convert.ToDouble(XAxisValue.Text);
                Double yaxis = System.Convert.ToDouble(YAxisValue.Text);
                Double zaxis = System.Convert.ToDouble(ZAxisValue.Text);

                endQuaternion = new Quaternion(new Vector3D(xaxis, yaxis, zaxis), angle);
            }
            catch
            {
                XAxisValue.Text = "Axis must be nonzero Vector3D";
                YAxisValue.Text = "Axis must be nonzero Vector3D";
                ZAxisValue.Text = "Axis must be nonzero Vector3D";
            }

            endRotation.Quaternion = endQuaternion;
            //</SnippetQuaternionView3DN4>

            //Update quaternion display
            WValue.Text = endQuaternion.W.ToString();
            XValue.Text = endQuaternion.X.ToString();
            YValue.Text = endQuaternion.Y.ToString();
            ZValue.Text = endQuaternion.Z.ToString();

            //build in some if clauses to determine the animation method to call
            startAnimation();
        }
Beispiel #9
0
        public static IEnumerable <Vector> ToIEnumerableVectorList(this List <Dictionary <string, string> > Source)
        {
            List <Vector> Result = new List <Vector>();

            foreach (Dictionary <string, string> elem in Source)
            {
                string XValue;
                string YValue;
                double X = 0, Y = 0;

                elem.TryGetValue(ComXLabel, out XValue);
                elem.TryGetValue(ComYLabel, out YValue);

                if (XValue != null && XValue.Length > 1)
                {
                    if (XValue.Contains("."))
                    {
                        XValue = XValue.Replace(".", ",");
                    }

                    double.TryParse(XValue, out X);
                }

                if (YValue != null && YValue.Length > 1)
                {
                    if (YValue.Contains("."))
                    {
                        YValue = YValue.Replace(".", ",");
                    }

                    double.TryParse(YValue, out Y);
                }

                Vector VectorElem = new Vector(X / ScaleX, Y / ScaleY);
                Result.Add(VectorElem);
            }

            return(Result);
        }
Beispiel #10
0

        
Beispiel #11
0

        
Beispiel #12
0
 private void Awake()
 {
     instance = this;
 }
Beispiel #13
0
 public bool Equals(Acceleration other)
 {
     return(XValue.Equals(other.XValue) && YValue.Equals(other.YValue) && ZValue.Equals(other.ZValue) &&
            Timestamp.Equals(other.Timestamp));
 }
Beispiel #14
0
        public static IEnumerable <Node> ToIEnumerableNodeList(this List <Dictionary <string, string> > Source, ref double[] BoundingBox)
        {
            List <Node> Result = new List <Node>();
            string      IdValue;
            string      XValue;
            string      YValue;
            string      OValue;
            double      X = 0, Y = 0, O = 0;

            Source[0].TryGetValue(ComXLabel, out XValue);
            Source[0].TryGetValue(ComYLabel, out YValue);

            BoundingBox[0] = BoundingBox[0] - 5;
            BoundingBox[1] = BoundingBox[1] - 5;
            BoundingBox[2] = BoundingBox[2] + 5;
            BoundingBox[3] = BoundingBox[3] + 5;
            if (XValue != null && XValue.Length > 1)
            {
                if (XValue.Contains("."))
                {
                    XValue = XValue.Replace(".", ",");
                }

                double.TryParse(XValue, out X);
            }

            if (YValue != null && YValue.Length > 1)
            {
                if (YValue.Contains("."))
                {
                    YValue = YValue.Replace(".", ",");
                }

                double.TryParse(YValue, out Y);
            }

            BoundingBox[2] = X / ScaleX;
            BoundingBox[0] = X / ScaleX;
            BoundingBox[3] = Y / ScaleY;
            BoundingBox[1] = Y / ScaleY;

            foreach (Dictionary <string, string> elem in Source)
            {
                elem.TryGetValue(UniqIDLabel, out IdValue);
                elem.TryGetValue(ComXLabel, out XValue);
                elem.TryGetValue(ComYLabel, out YValue);
                elem.TryGetValue(ComOrientationLabel, out OValue);
                if (IdValue == null)
                {
                    IdValue = "";
                }

                if (XValue != null && XValue.Length > 1)
                {
                    if (XValue.Contains("."))
                    {
                        XValue = XValue.Replace(".", ",");
                    }

                    double.TryParse(XValue, out X);
                }

                if (YValue != null && YValue.Length > 1)
                {
                    if (YValue.Contains("."))
                    {
                        YValue = YValue.Replace(".", ",");
                    }

                    double.TryParse(YValue, out Y);
                }

                if (OValue != null && OValue.Length > 1)
                {
                    if (OValue.Contains("."))
                    {
                        OValue = OValue.Replace(".", ",");
                    }

                    double.TryParse(OValue, out O);
                }

                if ((X / ScaleX) > BoundingBox[2])
                {
                    BoundingBox[2] = X / ScaleX;
                }
                else if ((X / ScaleX) < BoundingBox[0])
                {
                    BoundingBox[0] = X / ScaleX;
                }
                if ((Y / ScaleY) > BoundingBox[3])
                {
                    BoundingBox[3] = Y / ScaleY;
                }
                else if ((Y / ScaleY) < BoundingBox[1])
                {
                    BoundingBox[1] = Y / ScaleY;
                }
                Result.Add(new Node(IdValue, X / ScaleX, Y / ScaleY, O));
            }

            BoundingBox[0] = BoundingBox[0] - 5;
            BoundingBox[1] = BoundingBox[1] - 5;
            BoundingBox[2] = BoundingBox[2] + 5;
            BoundingBox[3] = BoundingBox[3] + 5;

            return(Result);
        }
Beispiel #15
0
 public override string ToString() => $"X: {XValue.ToString()}, Y: {YValue.ToString()}, Z: {ZValue.ToString()}";
Beispiel #16
0
 public override bool Equals(object obj) => (obj is Vector3 <T>) && XValue.Equals(((Vector3 <T>)obj).XValue) && YValue.Equals(((Vector3 <T>)obj).YValue) && YValue.Equals(((Vector3 <T>)obj).YValue);