Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::render3d::Scene3D Class Reference

Aggregates atomic coordinates, bonds, and unit cell wireframes for rendering. More...

#include <Scene3D.hpp>

Collaboration diagram for correlation::render3d::Scene3D:

Public Member Functions

 Scene3D ()=default
void clear () noexcept
 Clears all geometry in the scene.
std::vector< AtomInstance > & atoms () noexcept
 Gets mutable collection of atom visualization instances in the scene.
const std::vector< AtomInstance > & atoms () const noexcept
 Gets the collection of atom visualization instances in the scene.
const std::vector< BondInstance > & bonds () const noexcept
 Gets the collection of bond cylinders in the scene.
const std::vector< LineSegment > & unitCellLines () const noexcept
 Gets the unit cell boundary line segments for wireframe rendering.
const std::vector< LineSegment > & guideLines () const noexcept
 Gets 3D overlay guide line segments (e.g. distance/angle measurement ruler).
void setGuideLines (std::vector< LineSegment > lines) noexcept
 Replaces the 3D overlay guide line segments.
const math::Vector3< float > & boundsMin () const noexcept
 Gets the minimum 3D coordinate bounding box limits.
const math::Vector3< float > & boundsMax () const noexcept
 Gets the maximum 3D coordinate bounding box limits.
bool inCell () const noexcept
 Checks whether in-cell PBC coordinate wrapping is currently active.
void setInCell (bool in_cell) noexcept
 Sets whether in-cell PBC coordinate wrapping is active.
bool hasLattice () const noexcept
 Checks if the scene has valid unit cell lattice vectors.
const math::Matrix3< real_t > & latticeVectors () const noexcept
 Gets the 3x3 direct lattice vectors matrix.
const math::Matrix3< real_t > & inverseLatticeVectors () const noexcept
 Gets the 3x3 inverse lattice vectors matrix.
void addAtom (const AtomInstance &atom)
 Appends an atom visualization instance to the scene.
void addBond (const BondInstance &bond)
 Appends a bond cylinder to the scene.
void addUnitCellLine (const LineSegment &line)
 Appends a wireframe line segment to the scene.
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.
void recomputeBonds (double bond_cutoff_scale=1.15, bool in_cell=false)
 Recomputes covalent bonds for current atomic coordinates.
void updateAtomPositions (const std::vector< core::Atom > &cell_atoms, bool in_cell=false)
 Fast in-place update of atom coordinates from Cell atoms vector.
void setAtomScale (float atom_scale) noexcept
 Sets the uniform scaling factor applied to covalent radii for ball visualization.
float atomScale () const noexcept
 Gets the current uniform scaling factor for atom visualization radii.
void updateBounds () noexcept
 Recomputes axis-aligned bounding box from atoms and unit cell vertices.
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.

Static Public Member Functions

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.

Private Attributes

std::vector< AtomInstance > atoms_
std::vector< BondInstance > bonds_
std::vector< LineSegment > unit_cell_lines_
std::vector< LineSegment > guide_lines_
math::Vector3< float > bounds_min_ {0.0F, 0.0F, 0.0F}
math::Vector3< float > bounds_max_ {0.0F, 0.0F, 0.0F}
math::Matrix3< real_t > lattice_vectors_
math::Matrix3< real_t > inv_lattice_vectors_
float atom_scale_ {0.35F}
bool has_lattice_ {false}
bool in_cell_ {false}

Detailed Description

Aggregates atomic coordinates, bonds, and unit cell wireframes for rendering.

Constructor & Destructor Documentation

◆ Scene3D()

correlation::render3d::Scene3D::Scene3D ( )
default

Member Function Documentation

◆ addAtom()

void correlation::render3d::Scene3D::addAtom ( const AtomInstance & atom)

Appends an atom visualization instance to the scene.

Parameters
[in]atomVisual atom definition.

◆ addBond()

void correlation::render3d::Scene3D::addBond ( const BondInstance & bond)

Appends a bond cylinder to the scene.

Parameters
[in]bondVisual bond definition.

◆ addUnitCellLine()

void correlation::render3d::Scene3D::addUnitCellLine ( const LineSegment & line)

Appends a wireframe line segment to the scene.

Parameters
[in]lineLine segment definition.

◆ atoms() [1/2]

const std::vector< AtomInstance > & correlation::render3d::Scene3D::atoms ( ) const
inlinenodiscardnoexcept

Gets the collection of atom visualization instances in the scene.

Returns
Immutable reference to atom instances.

◆ atoms() [2/2]

std::vector< AtomInstance > & correlation::render3d::Scene3D::atoms ( )
inlinenodiscardnoexcept

Gets mutable collection of atom visualization instances in the scene.

Returns
Mutable reference to atom instances.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atomScale()

float correlation::render3d::Scene3D::atomScale ( ) const
inlinenodiscardnoexcept

Gets the current uniform scaling factor for atom visualization radii.

Returns
Active atom radius scale multiplier.

◆ bonds()

const std::vector< BondInstance > & correlation::render3d::Scene3D::bonds ( ) const
inlinenodiscardnoexcept

Gets the collection of bond cylinders in the scene.

Returns
Immutable reference to bond instances.
Here is the caller graph for this function:

◆ boundsMax()

const math::Vector3< float > & correlation::render3d::Scene3D::boundsMax ( ) const
inlinenodiscardnoexcept

Gets the maximum 3D coordinate bounding box limits.

Returns
Vector of maximum x, y, z coordinates.

◆ boundsMin()

const math::Vector3< float > & correlation::render3d::Scene3D::boundsMin ( ) const
inlinenodiscardnoexcept

Gets the minimum 3D coordinate bounding box limits.

Returns
Vector of minimum x, y, z coordinates.

◆ buildVisualSupercell()

std::shared_ptr< Scene3D > correlation::render3d::Scene3D::buildVisualSupercell ( int rep_a,
int rep_b,
int rep_c,
std::size_t max_atoms = 250000 ) const
nodiscard

Builds a visual-only periodic supercell tiled rep_a x rep_b x rep_c along lattice vectors.

Parameters
[in]rep_aRepetitions along lattice vector a (clamped to >= 1).
[in]rep_bRepetitions along lattice vector b (clamped to >= 1).
[in]rep_cRepetitions along lattice vector c (clamped to >= 1).
[in]max_atomsSoft safety cap on total replicated atom instances.
Returns
Shared pointer to replicated Scene3D preserving halos, colors, and visibility.
Here is the call graph for this function:

◆ clear()

void correlation::render3d::Scene3D::clear ( )
noexcept

Clears all geometry in the scene.

◆ fromCell()

std::shared_ptr< Scene3D > correlation::render3d::Scene3D::fromCell ( const core::Cell & cell,
double bond_cutoff_scale = 1.15,
bool generate_bonds = true,
bool in_cell = false )
staticnodiscard

Constructs a Scene3D from a simulation Cell.

Parameters
[in]cellAtomic cell containing lattice and atoms.
[in]bond_cutoff_scaleScaling multiplier for covalent radius cutoff.
[in]generate_bondsFlag enabling covalent bond detection.
[in]in_cellFlag enabling in-cell coordinate folding and periodic boundary clipped bonds.
Returns
Shared pointer to initialized Scene3D.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ guideLines()

const std::vector< LineSegment > & correlation::render3d::Scene3D::guideLines ( ) const
inlinenodiscardnoexcept

Gets 3D overlay guide line segments (e.g. distance/angle measurement ruler).

Returns
Immutable reference to overlay guide lines.
Here is the caller graph for this function:

◆ hasLattice()

bool correlation::render3d::Scene3D::hasLattice ( ) const
inlinenodiscardnoexcept

Checks if the scene has valid unit cell lattice vectors.

Returns
True if lattice vectors define a positive simulation volume.

◆ inCell()

bool correlation::render3d::Scene3D::inCell ( ) const
inlinenodiscardnoexcept

Checks whether in-cell PBC coordinate wrapping is currently active.

Returns
True if in-cell mode is enabled.

◆ inverseLatticeVectors()

const math::Matrix3< real_t > & correlation::render3d::Scene3D::inverseLatticeVectors ( ) const
inlinenodiscardnoexcept

Gets the 3x3 inverse lattice vectors matrix.

Returns
Constant reference to inverse lattice matrix.

◆ latticeVectors()

const math::Matrix3< real_t > & correlation::render3d::Scene3D::latticeVectors ( ) const
inlinenodiscardnoexcept

Gets the 3x3 direct lattice vectors matrix.

Returns
Constant reference to lattice matrix.

◆ recomputeBonds()

void correlation::render3d::Scene3D::recomputeBonds ( double bond_cutoff_scale = 1.15,
bool in_cell = false )

Recomputes covalent bonds for current atomic coordinates.

Parameters
[in]bond_cutoff_scaleScaling multiplier for covalent radius cutoff.
[in]in_cellFlag enabling periodic minimum image convention and boundary clipping.
Here is the caller graph for this function:

◆ setAtomScale()

void correlation::render3d::Scene3D::setAtomScale ( float atom_scale)
noexcept

Sets the uniform scaling factor applied to covalent radii for ball visualization.

Parameters
[in]atom_scaleMultiplier in [0.05, 2.0] (default 0.35).
Here is the caller graph for this function:

◆ setGuideLines()

void correlation::render3d::Scene3D::setGuideLines ( std::vector< LineSegment > lines)
inlinenoexcept

Replaces the 3D overlay guide line segments.

Parameters
[in]linesNew guide lines.

◆ setInCell()

void correlation::render3d::Scene3D::setInCell ( bool in_cell)
inlinenoexcept

Sets whether in-cell PBC coordinate wrapping is active.

Parameters
[in]in_cellTrue to enable in-cell folding and boundary clipping.

◆ unitCellLines()

const std::vector< LineSegment > & correlation::render3d::Scene3D::unitCellLines ( ) const
inlinenodiscardnoexcept

Gets the unit cell boundary line segments for wireframe rendering.

Returns
Immutable reference to unit cell lines.
Here is the caller graph for this function:

◆ updateAtomPositions()

void correlation::render3d::Scene3D::updateAtomPositions ( const std::vector< core::Atom > & cell_atoms,
bool in_cell = false )

Fast in-place update of atom coordinates from Cell atoms vector.

Parameters
[in]cell_atomsSource atom list.
[in]in_cellWhether to wrap coordinates into [0, 1) fractional box.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateBounds()

void correlation::render3d::Scene3D::updateBounds ( )
noexcept

Recomputes axis-aligned bounding box from atoms and unit cell vertices.

Here is the caller graph for this function:

◆ updateFromCell()

bool correlation::render3d::Scene3D::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.

Parameters
[in]cellNew simulation snapshot.
[in]recompute_bondsIf true, recalculates bond pairs.
[in]bond_cutoff_scaleScaling multiplier for cutoff.
[in]in_cellFlag enabling in-cell coordinate folding and periodic boundary clipped bonds.
Returns
True if update succeeded without rebuilding the scene graph.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ atom_scale_

float correlation::render3d::Scene3D::atom_scale_ {0.35F}
private

◆ atoms_

std::vector<AtomInstance> correlation::render3d::Scene3D::atoms_
private

◆ bonds_

std::vector<BondInstance> correlation::render3d::Scene3D::bonds_
private

◆ bounds_max_

math::Vector3<float> correlation::render3d::Scene3D::bounds_max_ {0.0F, 0.0F, 0.0F}
private

◆ bounds_min_

math::Vector3<float> correlation::render3d::Scene3D::bounds_min_ {0.0F, 0.0F, 0.0F}
private

◆ guide_lines_

std::vector<LineSegment> correlation::render3d::Scene3D::guide_lines_
private

◆ has_lattice_

bool correlation::render3d::Scene3D::has_lattice_ {false}
private

◆ in_cell_

bool correlation::render3d::Scene3D::in_cell_ {false}
private

◆ inv_lattice_vectors_

math::Matrix3<real_t> correlation::render3d::Scene3D::inv_lattice_vectors_
private

◆ lattice_vectors_

math::Matrix3<real_t> correlation::render3d::Scene3D::lattice_vectors_
private

◆ unit_cell_lines_

std::vector<LineSegment> correlation::render3d::Scene3D::unit_cell_lines_
private

The documentation for this class was generated from the following files: