Exemple #1
0
        public NewSGCView(NewSGCViewModel viewModel, ILoggerFacade logger)
            : base(viewModel, logger)
        {
            this.viewModel             = viewModel;
            viewModel.PropertyChanged += viewModel_PropertyChanged;

            model = new GeometryModel3D
            {
                Geometry     = CreateGeometry(viewModel),
                Material     = GetDefaultFrontMaterial(viewModel),
                BackMaterial = GetDefaultBackMaterial(),
            };
            modelVisual = new ModelVisual3D {
                Content = model
            };

            Children.Add(modelVisual);
        }
Exemple #2
0
        private static MeshGeometry3D CreateGeometry(NewSGCViewModel viewModel)
        {
            var startPoint = viewModel.Center - 0.5 * viewModel.Length * viewModel.Axis;
            var endPoint   = viewModel.Center + 0.5 * viewModel.Length * viewModel.Axis;
            var components = viewModel.Components;

            var path = from component in components
                       select MathUtils3D.Lerp(startPoint, endPoint, component.Progress);

            var diameters = from component in components
                            select 2 * component.Radius;

            var builder = new MeshBuilder();

            builder.AddTube(
                path.ToArray(),
                null,
                diameters.ToArray(),
                thetaDiv: CIRCLE_DIV,
                isTubeClosed: false);
            var geometry = builder.ToMesh(freeze: true);

            return(geometry);
        }
 public Editor(Point startPoint, LineRange startRay, NewSGCViewModel viewModel)
     : base(startPoint, startRay, viewModel)
 {
     this.viewModel = viewModel;
 }