75 double bond_cutoff_scale = 1.15,
76 bool generate_bonds =
true,
77 bool in_cell =
false);
82 void clear() noexcept;
94 [[nodiscard]]
const std::vector<AtomInstance> &
atoms() const noexcept {
return atoms_; }
100 [[nodiscard]]
const std::vector<BondInstance> &
bonds() const noexcept {
return bonds_; }
106 [[nodiscard]]
const std::vector<LineSegment> &
unitCellLines() const noexcept {
196 double bond_cutoff_scale = 1.15,
bool in_cell =
false);
203 void recomputeBonds(
double bond_cutoff_scale = 1.15,
bool in_cell =
false);
239 std::
size_t max_atoms = 250000) const;
Simulation cell structure with periodic boundary conditions.
CPK color palette and visualization radii for atomic 3D rendering.
Represents the simulation cell (periodic box).
Definition Cell.hpp:30
A lightweight, constexpr, stack-based 3x3 matrix.
Definition LinearAlgebra.hpp:261
A lightweight, constexpr, stack-based 3D vector.
Definition LinearAlgebra.hpp:32
Aggregates atomic coordinates, bonds, and unit cell wireframes for rendering.
Definition Scene3D.hpp:61
void clear() noexcept
Clears all geometry in the scene.
Definition Scene3D.cpp:279
void recomputeBonds(double bond_cutoff_scale=1.15, bool in_cell=false)
Recomputes covalent bonds for current atomic coordinates.
Definition Scene3D.cpp:354
std::vector< BondInstance > bonds_
Definition Scene3D.hpp:243
bool hasLattice() const noexcept
Checks if the scene has valid unit cell lattice vectors.
Definition Scene3D.hpp:150
const std::vector< LineSegment > & unitCellLines() const noexcept
Gets the unit cell boundary line segments for wireframe rendering.
Definition Scene3D.hpp:106
void setAtomScale(float atom_scale) noexcept
Sets the uniform scaling factor applied to covalent radii for ball visualization.
Definition Scene3D.cpp:295
float atomScale() const noexcept
Gets the current uniform scaling factor for atom visualization radii.
Definition Scene3D.hpp:222
const std::vector< BondInstance > & bonds() const noexcept
Gets the collection of bond cylinders in the scene.
Definition Scene3D.hpp:100
static std::shared_ptr< Scene3D > fromCell(const core::Cell &cell, double bond_cutoff_scale=1.15, bool generate_bonds=true, bool in_cell=false)
Constructs a Scene3D from a simulation Cell.
Definition Scene3D.cpp:399
std::vector< AtomInstance > & atoms() noexcept
Gets mutable collection of atom visualization instances in the scene.
Definition Scene3D.hpp:88
bool has_lattice_
Definition Scene3D.hpp:252
math::Vector3< float > bounds_max_
Definition Scene3D.hpp:247
const math::Matrix3< real_t > & inverseLatticeVectors() const noexcept
Gets the 3x3 inverse lattice vectors matrix.
Definition Scene3D.hpp:164
std::vector< LineSegment > unit_cell_lines_
Definition Scene3D.hpp:244
bool in_cell_
Definition Scene3D.hpp:253
const math::Vector3< float > & boundsMax() const noexcept
Gets the maximum 3D coordinate bounding box limits.
Definition Scene3D.hpp:132
math::Vector3< float > bounds_min_
Definition Scene3D.hpp:246
const std::vector< LineSegment > & guideLines() const noexcept
Gets 3D overlay guide line segments (e.g. distance/angle measurement ruler).
Definition Scene3D.hpp:114
const math::Matrix3< real_t > & latticeVectors() const noexcept
Gets the 3x3 direct lattice vectors matrix.
Definition Scene3D.hpp:156
std::shared_ptr< Scene3D > buildVisualSupercell(int rep_a, int rep_b, int rep_c, std::size_t max_atoms=250000) const
Builds a visual-only periodic supercell tiled rep_a x rep_b x rep_c along lattice vectors.
Definition Scene3D.cpp:419
void addUnitCellLine(const LineSegment &line)
Appends a wireframe line segment to the scene.
Definition Scene3D.cpp:293
void addBond(const BondInstance &bond)
Appends a bond cylinder to the scene.
Definition Scene3D.cpp:291
float atom_scale_
Definition Scene3D.hpp:251
std::vector< LineSegment > guide_lines_
Definition Scene3D.hpp:245
void updateBounds() noexcept
Recomputes axis-aligned bounding box from atoms and unit cell vertices.
Definition Scene3D.cpp:302
void setInCell(bool in_cell) noexcept
Sets whether in-cell PBC coordinate wrapping is active.
Definition Scene3D.hpp:144
std::vector< AtomInstance > atoms_
Definition Scene3D.hpp:242
const math::Vector3< float > & boundsMin() const noexcept
Gets the minimum 3D coordinate bounding box limits.
Definition Scene3D.hpp:126
math::Matrix3< real_t > lattice_vectors_
Definition Scene3D.hpp:249
bool inCell() const noexcept
Checks whether in-cell PBC coordinate wrapping is currently active.
Definition Scene3D.hpp:138
void addAtom(const AtomInstance &atom)
Appends an atom visualization instance to the scene.
Definition Scene3D.cpp:289
bool updateFromCell(const core::Cell &cell, bool recompute_bonds=false, double bond_cutoff_scale=1.15, bool in_cell=false)
Updates atomic positions and unit cell in-place from a new Cell snapshot.
Definition Scene3D.cpp:364
math::Matrix3< real_t > inv_lattice_vectors_
Definition Scene3D.hpp:250
const std::vector< AtomInstance > & atoms() const noexcept
Gets the collection of atom visualization instances in the scene.
Definition Scene3D.hpp:94
void updateAtomPositions(const std::vector< core::Atom > &cell_atoms, bool in_cell=false)
Fast in-place update of atom coordinates from Cell atoms vector.
Definition Scene3D.cpp:338
void setGuideLines(std::vector< LineSegment > lines) noexcept
Replaces the 3D overlay guide line segments.
Definition Scene3D.hpp:120
Defines universal mathematical and physical constants.
Definition Camera3D.hpp:14
Visual instance of an atom for 3D rendering.
Definition Scene3D.hpp:22
float halo_radius_ratio
Expansion over visual radius.
Definition Scene3D.hpp:32
math::Vector3< float > position
World coordinates (Angstroms).
Definition Scene3D.hpp:23
float dim_factor
1.0 = normal, 0.3 = ghosted
Definition Scene3D.hpp:33
RgbaColor halo_color
a == 0 denotes no halo
Definition Scene3D.hpp:31
int atomic_number
Atomic number (Z).
Definition Scene3D.hpp:28
float radius
Visualization radius (Angstroms).
Definition Scene3D.hpp:24
float covalent_radius
Physical covalent radius for bonding (Angstroms).
Definition Scene3D.hpp:25
RgbaColor color
CPK element color.
Definition Scene3D.hpp:26
Visual instance of a covalent or ionic bond connecting two atoms.
Definition Scene3D.hpp:40
math::Vector3< float > end
Ending atom position.
Definition Scene3D.hpp:42
RgbaColor color
Bond color (interpolated or neutral).
Definition Scene3D.hpp:44
float radius
Cylinder visual radius.
Definition Scene3D.hpp:43
math::Vector3< float > start
Starting atom position.
Definition Scene3D.hpp:41
3D line segment for wireframe rendering (e.g. simulation box boundaries).
Definition Scene3D.hpp:51
RgbaColor color
Line color.
Definition Scene3D.hpp:54
math::Vector3< float > end
Ending vertex.
Definition Scene3D.hpp:53
math::Vector3< float > start
Starting vertex.
Definition Scene3D.hpp:52
8-bit RGBA color representation for vertex colors and framebuffers.
Definition ElementColors.hpp:23