private void ShowPopupAtomInfo(AtomVisual atomVisual) { if (atomVisual == null) { atomInfoPopText.Text = ""; atomInfoPopup.IsOpen = false; return; } Atom atom = atomVisual.Atom; atomInfoPopText.Text = $"{atom.Element}\n{atom.X}\n{atom.Y}\n{atom.Z}"; atomInfoPopup.IsOpen = true; }
private void ShowSelectedAtomInfo(AtomVisual atomVisual) { if (atomVisual == null) { return; } selectedAtomName.Content = atomVisual.Atom.Element; selectedAtomX.Content = atomVisual.Atom.X; selectedAtomY.Content = atomVisual.Atom.Y; selectedAtomZ.Content = atomVisual.Atom.Z; selectedAtomPolyhedronVolume.Content = $"{Math.Round(atomVisual.Atom.PolyhedronVolume, 4)} A\xB3"; SelectedAtomPolyhedronFillingDegree.Content = Math.Round(atomVisual.Atom.PolyhedronFillingDegree, 4); }
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)); } }