Ejemplo n.º 1
0
        private void BuildCompound()
        {
            if (!_compoundSelected || !_groupSelected)
            {
                return;
            }

            _multipliedAtoms.Clear();
            MainViewport.Children.Clear();

            _atomCell = _compound.CrystalCell;
            try
            {
                _compoundVisual =
                    new CompoundVisual(_compound, _selectedSpaceGroup, _selectableModels, _multipliedAtoms);
            }
            catch (EvaluateException)
            {
                MessageBox.Show("Ошибка в записях пространственной группы! Ячейка построена неправильно!");
                return;
            }


            MainViewport.Children.Add(_compoundVisual);
            MoveFromCenter(_compoundVisual);

            ModelBuilder.BuildDiscreteAxis(out _discreteYAxis, out _discreteXAxis, out _discreteZAxis, _atomCell);


            _discreteAxisGroup.Children.Clear();
            _discreteAxisGroup.Children.Add(_discreteXAxis);
            _discreteAxisGroup.Children.Add(_discreteYAxis);
            _discreteAxisGroup.Children.Add(_discreteZAxis);

            ModelVisual3D axisModelVisual = new ModelVisual3D();

            AmbientLight     ambientLight     = new AmbientLight(Colors.Gray);
            DirectionalLight directionalLight =
                new DirectionalLight(Colors.Gray, new Vector3D(-1.0, -3.0, -2.0));

            _discreteAxisGroup.Children.Add(ambientLight);
            _discreteAxisGroup.Children.Add(directionalLight);

            axisModelVisual.Content = _discreteAxisGroup;
            AxisViewport.Children.Add(axisModelVisual);
        }
Ejemplo n.º 2
0
        private void VisualizeTranslations(object sender, RoutedEventArgs e)
        {
            if (_compound == null || _selectedSpaceGroup == null)
            {
                translationsCheckbox.IsChecked = false;
                return;
            }

            List <Atom> multipliedAtomsTransl = new List <Atom>();

            var translatedCompoundVisual =
                new CompoundVisual(_compound, _selectedSpaceGroup, _selectableModels, multipliedAtomsTransl, _compoundVisual.ColorTypeDictionary);

            MainViewport.Children.Add(translatedCompoundVisual);

            var transform = new TranslateTransform3D(-_atomCell.YAxisL / 2, -_atomCell.ZAxisL / 2 + _atomCell.ZAxisL, -_atomCell.XAxisL / 2);

            translatedCompoundVisual.Transform = transform;

            TranslationsList.Add(translatedCompoundVisual);
        }