public void SelectGroup(SpaceGroupCl spaceGroup) { _selectedSpaceGroup = spaceGroup; _groupSelected = true; SpaceGroupNameLabel.Content = spaceGroup.Name; BuildCompound(); }
public AtomVisual(Atom atom, string atomColor, SpaceGroupCl selectedSpaceGroup, CrystalCell atomCell, List <Atom> multipliedAtoms, double xAxisL = 0, double yAxisL = 0, double zAxisL = 0) { if (selectedSpaceGroup == null) { throw new NotImplementedException(); } this.atom = atom; Content = MiscModel3DGroup; double atomVisualSize = 0.4; if (atom.Element[0] == 'O' && (atom.Element[1] != 's')) { atomVisualSize = 0.2; } //Model3DGroup atomRepro = new Model3DGroup(); List <Atom> atomReproList = new List <Atom>(); for (int i = 0; i < selectedSpaceGroup.Expressions.Length; i += 3) { double X = SpaceGroupCl.Evaluate(selectedSpaceGroup.Expressions[i + 1], 0, atom.Y, 0); //сухие координаты double Y = SpaceGroupCl.Evaluate(selectedSpaceGroup.Expressions[i + 2], 0, 0, atom.Z); double Z = SpaceGroupCl.Evaluate(selectedSpaceGroup.Expressions[i], atom.X, 0, 0); if (X < 0) { X += 1; } if (Y < 0) { Y += 1; } if (Z < 0) { Z += 1; } if (X > 1) { X -= 1; } if (Y > 1) { Y -= 1; } if (Z > 1) { Z -= 1; } // double a = atomCell.YAxisL; double b = atomCell.ZAxisL; double c = atomCell.XAxisL; double xC = c * Math.Cos(ToRadians(atomCell.Gamma)); double yC = (b * c * Math.Cos(ToRadians(atomCell.Beta)) - xC * b * Math.Cos(ToRadians(atomCell.Alpha))) / b * Math.Sin(ToRadians(atomCell.Alpha)); double zC = Math.Sqrt(c * c - xC * xC - yC * yC); Vector3D xVector = new Vector3D(a * X, 0, 0); Vector3D oyVector = new Vector3D(b * Math.Cos(ToRadians(atomCell.Alpha)) * Y, b * Math.Sin(ToRadians(atomCell.Alpha)) * Y, 0); Vector3D zVector = new Vector3D(xC * Z, yC * Z, zC * Z); Vector3D xyVector = Vector3D.Add(xVector, oyVector); Vector3D xyzVector = Vector3D.Add(xyVector, zVector); // var addedAtom = new Atom(atom.Element, Z.ToString(), X.ToString(), Y.ToString(), null); if (multipliedAtoms.Contains(addedAtom)) { continue; } multipliedAtoms.Add(addedAtom); AtomVisual multipliedAtomVisual = new AtomVisual((Point3D)xyzVector, atomVisualSize, atomColor, addedAtom); Children.Add(multipliedAtomVisual); atomReproList.Add(new Atom(atom.Element, Z.ToString(), X.ToString(), Y.ToString(), atom.Brush)); } }