znvis package¶
Subpackages¶
Module contents¶
ZnVis: A Zincwarecode package.
License¶
This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html SPDX-License-Identifier: EPL-2.0 Copyright Contributors to the Zincwarecode Project. Contact Information ——————- email: zincwarecode@gmail.com github: https://github.com/zincware web: https://zincwarecode.com/ Citation ——– If you use this module please cite us with:
Summary¶
init file for the main ZnVis package.
- class znvis.BoundingBox(center: numpy.ndarray = array([0, 0, 0]), box_size: numpy.ndarray = array([1., 1., 1.]), rotation_matrix: numpy.ndarray = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), colour: numpy.ndarray = array([0., 0., 0.]))[source]¶
Bases:
objectA class to produce sphere meshes.
- Attributes
- centernp.ndarray shape=(3,)
Center of the bounding box
- rotation_matrixnp.ndarray shape=(3, 3)
Rotation matrix of the bounding box.
- box_sizenp.ndarray shape=(3,)
Size of the bounding box.
- colournp.ndarray shape=(3,)
- box_size: numpy.ndarray = array([1., 1., 1.])¶
- center: numpy.ndarray = array([0, 0, 0])¶
- colour: numpy.ndarray = array([0., 0., 0.])¶
- rotation_matrix: numpy.ndarray = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])¶
- class znvis.CustomMesh(material: znvis.material.material.Material = Material(colour=array([0.23137255, 0.20784314, 0.38039216]), alpha=1.0, roughness=0.5, metallic=0.0, reflectance=0.4, anisotropy=0.4), file: Optional[str] = None)[source]¶
Bases:
znvis.mesh.mesh.MeshA class to produce cylinder meshes.
- Attributes
- filestr
Path to mesh file.
- create_mesh(starting_position: numpy.ndarray, starting_orientation: Optional[numpy.ndarray] = None) open3d.cpu.pybind.geometry.TriangleMesh[source]¶
Create a mesh object defined by the dataclass.
- Parameters
- starting_positionnp.ndarray shape=(3,)
Starting position of the mesh.
- starting_orientationnp.ndarray shape=(3,) (default = None)
Starting orientation of the mesh.
- Returns
- mesho3d.geometry.TriangleMesh
- file: str = None¶
- class znvis.Cylinder(material: znvis.material.material.Material = Material(colour=array([0.23137255, 0.20784314, 0.38039216]), alpha=1.0, roughness=0.5, metallic=0.0, reflectance=0.4, anisotropy=0.4), radius: float = 1.0, height: float = 3.0, split: int = 1, resolution: int = 10)[source]¶
Bases:
znvis.mesh.mesh.MeshA class to produce cylinder meshes.
- Attributes
- radiusfloat
Radius of the sphere.
- heightfloat
Height of the cylinder.
- splitint
Number of segment the mesh will be split into.
- resolutionint
Resolution of the sphere.
- create_mesh(starting_position: numpy.ndarray, starting_orientation: Optional[numpy.ndarray] = None) open3d.cpu.pybind.geometry.TriangleMesh[source]¶
Create a mesh object defined by the dataclass.
- Parameters
- starting_positionnp.ndarray shape=(3,)
Starting position of the mesh.
- starting_orientationnp.ndarray shape=(3,) (default = None)
Starting orientation of the mesh.
- Returns
- mesho3d.geometry.TriangleMesh
- height: float = 3.0¶
- radius: float = 1.0¶
- resolution: int = 10¶
- split: int = 1¶
- class znvis.Material(colour: numpy.ndarray = array([0.23137255, 0.20784314, 0.38039216]), alpha: float = 1.0, roughness: float = 0.5, metallic: float = 0.0, reflectance: float = 0.4, anisotropy: float = 0.4)[source]¶
Bases:
objectParent class for the ZnVis materials.
- Attributes
- colournp.ndarray
Colour of the mesh. RGB array in the range 0, 1.
- alphafloat
Transparancy of the mesh.
- roughnessfloat
Roughness of the material.
- metallicafloat
How metallic the material looks. 0. not and 1.0 is metallic.
- reflectance: float
How reflective the material is.
- anisotropy: float
How anisotopic the material is.
- alpha: float = 1.0¶
- anisotropy: float = 0.4¶
- colour: numpy.ndarray = array([0.23137255, 0.20784314, 0.38039216])¶
- metallic: float = 0.0¶
- reflectance: float = 0.4¶
- roughness: float = 0.5¶
- class znvis.Particle(name: str, mesh: Optional[znvis.mesh.mesh.Mesh] = None, position: Optional[numpy.ndarray] = None, velocity: Optional[numpy.ndarray] = None, force: Optional[numpy.ndarray] = None, director: Optional[numpy.ndarray] = None, mesh_list: Optional[List[znvis.mesh.mesh.Mesh]] = None, smoothing: bool = False)[source]¶
Bases:
objectParent class for a ZnVis particle.
- Attributes
- namestr
Name of the particle
- meshMesh
Mesh to use e.g. sphere
- positionnp.ndarray
Position tensor of the shape (n_confs, n_particles, n_dims)
- velocitynp.ndarray
Velocity tensor of the shape (n_confs, n_particles, n_dims)
- forcenp.ndarray
Force tensor of the shape (n_confs, n_particles, n_dims)
- director: np.ndarray
Director tensor of the shape (n_confs, n_particles, n_dims)
- mesh_listlist
A list of mesh objects, one for each time step.
- smoothingbool (default=False)
If true, apply smoothing to each mesh object as it is rendered. This will slow down the initial construction of the mesh objects but not the deployment.
- construct_mesh_list()[source]¶
Constructor the mesh list for the class.
The mesh list is a list of mesh objects for each time step in the parsed trajectory.
- Returns
- Updates the class attributes mesh_list
- director: numpy.ndarray = None¶
- force: numpy.ndarray = None¶
- mesh: znvis.mesh.mesh.Mesh = None¶
- mesh_list: List[znvis.mesh.mesh.Mesh] = None¶
- name: str¶
- position: numpy.ndarray = None¶
- smoothing: bool = False¶
- velocity: numpy.ndarray = None¶
- class znvis.Sphere(material: znvis.material.material.Material = Material(colour=array([0.23137255, 0.20784314, 0.38039216]), alpha=1.0, roughness=0.5, metallic=0.0, reflectance=0.4, anisotropy=0.4), radius: float = 1.0, resolution: int = 10)[source]¶
Bases:
znvis.mesh.mesh.MeshA class to produce sphere meshes.
- Attributes
- radiusfloat
Radius of the sphere
- resolutionint
Resolution of the sphere.
- create_mesh(starting_position: numpy.ndarray, starting_orientation: Optional[numpy.ndarray] = None) open3d.cpu.pybind.geometry.TriangleMesh[source]¶
Create a mesh object defined by the dataclass.
- Parameters
- starting_positionnp.ndarray shape=(3,)
Starting position of the mesh.
- starting_orientationnp.ndarray shape=(3,) (default = None)
Starting orientation of the mesh.
- Returns
- mesho3d.geometry.TriangleMesh
- radius: float = 1.0¶
- resolution: int = 10¶
- class znvis.Visualizer(particles: List[znvis.particle.particle.Particle], output_folder: Union[str, pathlib.Path] = './', frame_rate: int = 24, number_of_steps: Optional[int] = None, keep_frames: bool = False, bounding_box: Optional[znvis.bounding_objects.bounding_box.BoundingBox] = None, video_format: str = 'mp4')[source]¶
Bases:
objectMain class to perform visualization.
- Attributes
- particleslist[znvis.Particle]
A list of particle objects to add to the visualizer.
- appo3d.gui.Application.instance
An open3d application.
- viso3d.visualization.O3DVisualizer
An open3d visualizer window
- counterint
Internally stored counter to track which configuration is currently being viewed.