示例#1
0
        /// <summary>
        /// Build the sculptor for the label.
        /// </summary>
        /// <param name="ad">An AxisDirection enum value.</param>
        /// <returns></returns>
        private SquareSculptor BuildLabelSculptor(AxisDirection ad)
        {
            SquareSculptor   sculptor = new SquareSculptor();
            Transform3DGroup tg       = new Transform3DGroup();
            double           xyLength = 0.2;

            tg.Children.Add(new ScaleTransform3D(xyLength, xyLength, 1.0));
            switch (ad)
            {
            case AxisDirection.X:
                // tg.Children.Add(new TranslateTransform3D(0.6, -0.27, 0.0));
                tg.Children.Add(new TranslateTransform3D(0.6, -(xyLength + Radius / 2.0), 0.0));
                break;

            case AxisDirection.Y:
                tg.Children.Add(new TranslateTransform3D(Radius / 2.0, 0.6, 0.0));
                break;

            case AxisDirection.Z:
                tg.Children.Add(
                    new RotateTransform3D(
                        new AxisAngleRotation3D(new Vector3D(0, -1, 0), 90)));
                // 2ème rotation pour que les 3 lettres X, Y zt Z soient dans le même sens
                tg.Children.Add(
                    new RotateTransform3D(
                        new AxisAngleRotation3D(new Vector3D(0, 1, 0), 180)));
                tg.Children.Add(new TranslateTransform3D(0.0, -(xyLength + Radius / 2.0), 0.8));
                break;
            }
            sculptor.Transform(tg);
            sculptor.BuildMesh();
            return(sculptor);
        }
示例#2
0
        // private SquareSculptor _sculptor = new SquareSculptor();

        /// <summary>
        /// Called by UIElement3D.InvalidateModel() to update the 3D model.
        /// </summary>
        protected override void OnUpdateModel()
        {
            Sculptor = new SquareSculptor();
            //_sculptor.BuildMesh();
            //Geometry = _sculptor.Mesh;
            base.OnUpdateModel();
        }
示例#3
0
        /// <summary>
        /// Build the sculptor for the label.
        /// </summary>
        /// <param name="ad">An AxisDirection enum value.</param>
        /// <returns></returns>
        private SquareSculptor BuildLabelSculptor(AxisDirection ad)
        {
            SquareSculptor   sculptor = new SquareSculptor();
            Transform3DGroup tg       = new Transform3DGroup();
            double           xyLength = 0.2;

            tg.Children.Add(new ScaleTransform3D(xyLength, xyLength, 1.0));
            switch (ad)
            {
            case AxisDirection.X:
                // The 0.001 Z translation prevents flickering when displaying another surface on the X-Y axis
                tg.Children.Add(new TranslateTransform3D(0.6, -(xyLength + Radius / 2.0), -0.001));
                break;

            case AxisDirection.Y:
                // The 0.001 Z translation prevents flickering when displaying another surface on the X-Y axis
                tg.Children.Add(new TranslateTransform3D(Radius / 2.0, 0.6, -0.001));
                break;

            case AxisDirection.Z:
                tg.Children.Add(
                    new RotateTransform3D(
                        new AxisAngleRotation3D(new Vector3D(0, -1, 0), 90)));
                // 2nd rotation so the 3 letters X, Y and Z are in the same direction
                tg.Children.Add(
                    new RotateTransform3D(
                        new AxisAngleRotation3D(new Vector3D(0, 1, 0), 180)));
                // The 0.001 X translation prevents flickering when displaying another surface on the Y-Z axis
                // tg.Children.Add(new TranslateTransform3D(-0.001, -(xyLength + Radius / 2.0), 0.8));
                double zTranslation =
                    (this.CoordinateSystemKind == Primitives.CoordinateSystemKind.RightHanded) ? 0.8 : -0.8;
                tg.Children.Add(new TranslateTransform3D(-0.001, -(xyLength + Radius / 2.0), zTranslation));
                break;
            }
            sculptor.Transform(tg);
            sculptor.BuildMesh();
            sculptor.MapTexture();
            return(sculptor);
        }