private Visual3D CreateConeView(NewCone data)
        {
            var cylinder = new Cylinder();

            cylinder.Bind(Cylinder.Radius1Property, () => data.TopRadius, radius => radius.Value);
            cylinder.Bind(Cylinder.Radius2Property, () => data.BottomRadius, radius => radius.Value);
            cylinder.Bind(Cylinder.Point1Property,
                          () => data.Center,
                          () => data.Axis,
                          () => data.Length,
                          (center, axis, length) => center.Value + 0.5 * length.Value * axis.Value.Normalized());
            cylinder.Bind(Cylinder.Point2Property,
                          () => data.Center,
                          () => data.Axis,
                          () => data.Length,
                          (center, axis, length) => center.Value - 0.5 * length.Value * axis.Value.Normalized());

            cylinder.Material = new DiffuseMaterial {
                Brush = Brushes.White
            };

            return(cylinder);
        }
Exemplo n.º 2
0
        public NewConeView(NewConeViewModel viewModel, ILoggerFacade logger)
            : base(viewModel, logger)
        {
            this.viewModel = viewModel;

            cylinder = new Cylinder();
            Children.Add(cylinder);

            cylinder.Bind(Cylinder.Radius1Property, () => viewModel.TopRadius);
            cylinder.Bind(Cylinder.Radius2Property, () => viewModel.BottomRadius);
            cylinder.Bind(Cylinder.Point1Property,
                          () => viewModel.Center,
                          () => viewModel.Axis,
                          () => viewModel.Length,
                          (center, axis, length) => center + 0.5 * length * axis);
            cylinder.Bind(Cylinder.Point2Property,
                          () => viewModel.Center,
                          () => viewModel.Axis,
                          () => viewModel.Length,
                          (center, axis, length) => center - 0.5 * length * axis);

            cylinder.SetMaterials(GetDefaultFrontAndBackMaterials(viewModel));
        }
        private ModelVisual3D CreateCylinderView(NewCylinder data)
        {
            var cylinder = new Cylinder();

            cylinder.Bind(Cylinder.Radius1Property, () => data.Diameter, diameter => diameter / 2);
            cylinder.Bind(Cylinder.Radius2Property, () => data.Diameter, diameter => diameter / 2);
            cylinder.Bind(Cylinder.Point1Property,
                          () => data.Center,
                          () => data.Axis,
                          () => data.Length,
                          (center, axis, length) => center.Value + 0.5 * length.Value * axis.Value.Normalized());
            cylinder.Bind(Cylinder.Point2Property,
                          () => data.Center,
                          () => data.Axis,
                          () => data.Length,
                          (center, axis, length) => center.Value - 0.5 * length.Value * axis.Value.Normalized());

            cylinder.Material = new DiffuseMaterial {
                Brush = Brushes.White
            };

            return(cylinder);
        }