A visual element that shows a flat pie slice defined by center, normal, up vectors, inner and outer radius, start and end angles.
Inheritance: MeshElement3D
Ejemplo n.º 1
0
        /// <summary>
        /// Updates the visuals.
        /// </summary>
        private void UpdateVisuals()
        {
            this.Children.Clear();
            var frontColor = Brushes.Red;
            var leftColor  = Brushes.Green;
            var upColor    = Brushes.Blue;
            var vecUp      = this.ModelUpDirection;
            // create left vector 90° from up
            var vecLeft = new Vector3D(vecUp.Y, vecUp.Z, vecUp.X);

            // change the colors if not a positive Z vector is used for up
            if (vecUp.Z < 1)
            {
                leftColor = Brushes.Blue;
                upColor   = Brushes.Green;
            }

            var vecFront = Vector3D.CrossProduct(vecLeft, vecUp);

            this.AddCubeFace(vecFront, vecUp, frontColor, this.FrontText);
            this.AddCubeFace(-vecFront, vecUp, frontColor, this.BackText);
            this.AddCubeFace(vecLeft, vecUp, leftColor, this.LeftText);
            this.AddCubeFace(-vecLeft, vecUp, leftColor, this.RightText);
            this.AddCubeFace(vecUp, vecLeft, upColor, this.TopText);
            this.AddCubeFace(-vecUp, -vecLeft, upColor, this.BottomText);

            var circle = new PieSliceVisual3D();

            circle.BeginEdit();
            circle.Center      = (this.ModelUpDirection * (-this.Size / 2)).ToPoint3D();
            circle.Normal      = this.ModelUpDirection;
            circle.UpVector    = vecLeft; // rotate 90° so that it's at the bottom plane of the cube.
            circle.InnerRadius = this.Size;
            circle.OuterRadius = this.Size * 1.3;
            circle.StartAngle  = 0;
            circle.EndAngle    = 360;
            circle.Fill        = Brushes.Gray;
            circle.EndEdit();
            this.Children.Add(circle);

            if (EnableEdgeClicks)
            {
                AddCorners();
                AddEdges();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The update visuals.
        /// </summary>
        private void UpdateVisuals()
        {
            this.Children.Clear();
            var frontColor = Brushes.Red;
            var rightColor = Brushes.Green;
            var upColor    = Brushes.Blue;
            var up         = this.ModelUpDirection;
            var right      = new Vector3D(0, 1, 0);

            if (!up.Z.Equals(1))
            {
                // Y-axis up
                right      = new Vector3D(0, 0, 1);
                rightColor = Brushes.Blue;
                upColor    = Brushes.Green;
            }

            var front = Vector3D.CrossProduct(right, up);

            this.AddFace(front, up, frontColor, this.FrontText);
            this.AddFace(-front, up, frontColor, this.BackText);
            this.AddFace(-right, up, rightColor, this.RightText);
            this.AddFace(right, up, rightColor, this.LeftText);
            this.AddFace(up, right, upColor, this.TopText);
            this.AddFace(-up, right, upColor, this.BottomText);

            var circle = new PieSliceVisual3D();

            circle.BeginEdit();
            circle.Center   = (this.ModelUpDirection * (-this.Size / 2)).ToPoint3D();
            circle.Normal   = this.ModelUpDirection;
            circle.UpVector = this.ModelUpDirection.Equals(new Vector3D(0, 0, 1))
                                  ? new Vector3D(0, 1, 0)
                                  : new Vector3D(0, 0, 1);
            circle.InnerRadius = this.Size;
            circle.OuterRadius = this.Size * 1.3;
            circle.StartAngle  = 0;
            circle.EndAngle    = 360;
            circle.Fill        = Brushes.Gray;
            circle.EndEdit();
            this.Children.Add(circle);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the visuals.
        /// </summary>
        private void UpdateVisuals()
        {
            this.Children.Clear();
            faceNormals.Clear();
            faceUpVectors.Clear();
            CubeFaceModels.Clear();
            EdgeModels.Clear();
            CornerModels.Clear();
            var vecUp = this.ModelUpDirection;
            // create left vector 90° from up
            var vecLeft = new Vector3D(vecUp.Y, vecUp.Z, vecUp.X);

            var vecFront = Vector3D.CrossProduct(vecLeft, vecUp);

            CubeFaceModels.Add(this.AddCubeFace(vecFront, vecUp, GetCubefaceColor(0), this.FrontText));
            CubeFaceModels.Add(this.AddCubeFace(-vecFront, vecUp, GetCubefaceColor(1), this.BackText));
            CubeFaceModels.Add(this.AddCubeFace(vecLeft, vecUp, GetCubefaceColor(2), this.LeftText));
            CubeFaceModels.Add(this.AddCubeFace(-vecLeft, vecUp, GetCubefaceColor(3), this.RightText));
            CubeFaceModels.Add(this.AddCubeFace(vecUp, vecLeft, GetCubefaceColor(4), this.TopText));
            CubeFaceModels.Add(this.AddCubeFace(-vecUp, -vecLeft, GetCubefaceColor(5), this.BottomText));

            var circle = new PieSliceVisual3D();

            circle.BeginEdit();
            circle.Center      = (this.ModelUpDirection * (-this.Size / 2)).ToPoint3D();
            circle.Normal      = this.ModelUpDirection;
            circle.UpVector    = vecLeft; // rotate 90° so that it's at the bottom plane of the cube.
            circle.InnerRadius = this.Size;
            circle.OuterRadius = this.Size * 1.3;
            circle.StartAngle  = 0;
            circle.EndAngle    = 360;
            circle.Fill        = Brushes.Gray;
            circle.EndEdit();
            this.Children.Add(circle);

            AddCorners();
            AddEdges();
            EnableDisableEdgeClicks();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the visuals.
        /// </summary>
        private void UpdateVisuals()
        {
            this.Children.Clear();
            var frontColor = Brushes.Red;
            var leftColor = Brushes.Green;
            var upColor = Brushes.Blue;
            var vecUp = this.ModelUpDirection;
            // create left vector 90° from up
            var vecLeft = new Vector3D(vecUp.Y, vecUp.Z, vecUp.X);

            // change the colors if not a positive Z vector is used for up
            if (vecUp.Z < 1)
            {
                leftColor = Brushes.Blue;
                upColor = Brushes.Green;
            }

            var vecFront = Vector3D.CrossProduct(vecLeft, vecUp);

            this.AddCubeFace(vecFront, vecUp, frontColor, this.FrontText);
            this.AddCubeFace(-vecFront, vecUp, frontColor, this.BackText);
            this.AddCubeFace(vecLeft, vecUp, leftColor, this.LeftText);
            this.AddCubeFace(-vecLeft, vecUp, leftColor, this.RightText);
            this.AddCubeFace(vecUp, vecLeft, upColor, this.TopText);
            this.AddCubeFace(-vecUp, -vecLeft, upColor, this.BottomText);

            var circle = new PieSliceVisual3D();
            circle.BeginEdit();
            circle.Center = (this.ModelUpDirection * (-this.Size / 2)).ToPoint3D();
            circle.Normal = this.ModelUpDirection;
            circle.UpVector = vecLeft; // rotate 90° so that it's at the bottom plane of the cube.
            circle.InnerRadius = this.Size;
            circle.OuterRadius = this.Size * 1.3;
            circle.StartAngle = 0;
            circle.EndAngle = 360;
            circle.Fill = Brushes.Gray;
            circle.EndEdit();
            this.Children.Add(circle);

            if (EnableEdgeClicks)
            {
                AddCorners();
                AddEdges();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Updates the visuals.
        /// </summary>
        private void UpdateVisuals()
        {
            this.Children.Clear();
            var frontColor = Brushes.Red;
            var rightColor = Brushes.Green;
            var upColor = Brushes.Blue;
            var up = this.ModelUpDirection;
            var right = new Vector3D(0, 1, 0);
            if (up.Z < 1)
            {
                right = new Vector3D(0, 0, 1);
                rightColor = Brushes.Blue;
                upColor = Brushes.Green;
            }

            var front = Vector3D.CrossProduct(right, up);

            this.AddCubeFace(front, up, frontColor, this.FrontText);
            this.AddCubeFace(-front, up, frontColor, this.BackText);
            this.AddCubeFace(right, up, rightColor, this.RightText);
            this.AddCubeFace(-right, up, rightColor, this.LeftText);
            this.AddCubeFace(up, right, upColor, this.TopText);
            this.AddCubeFace(-up, -right, upColor, this.BottomText);

            var circle = new PieSliceVisual3D();
            circle.BeginEdit();
            circle.Center = (this.ModelUpDirection * (-this.Size / 2)).ToPoint3D();
            circle.Normal = this.ModelUpDirection;
            circle.UpVector = this.ModelUpDirection.Equals(new Vector3D(0, 0, 1))
                                  ? new Vector3D(0, 1, 0)
                                  : new Vector3D(0, 0, 1);
            circle.InnerRadius = this.Size;
            circle.OuterRadius = this.Size * 1.3;
            circle.StartAngle = 0;
            circle.EndAngle = 360;
            circle.Fill = Brushes.Gray;
            circle.EndEdit();
            this.Children.Add(circle);
        }