File ObjVisualization3D.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

template<typename T = double>
class ObjVisualization3D : public Acts::IVisualization3D
#include <Acts/Visualization/ObjVisualization3D.hpp>

This helper produces output in the OBJ format.

Note that colors are not supported in this implementation.

Public Types

using LineType = std::pair<size_t, size_t>

Type of a line.

using ValueType = T

Stored value type, should be double or float.

using VertexType = Eigen::Matrix<ValueType, 3, 1>

Type of a vertex based on the value type.

Public Functions

inline ObjVisualization3D(unsigned int prec = 4, double scale = 1.)

Constructor that allows to set scalor and precision.

Parameters
  • prec – The output precission with std::setprecision

  • scale – An (optional) scaling for the writing out

virtual void clear() final

Remove all contents of this helper.

virtual void face(const std::vector<Vector3> &vtxs, ColorRGB color = {0, 0, 0}) final

Draw a face that connects a list of vertices.

Note

Depending on the helper implementation, out of plane vertices might be handled differently.

Parameters
  • vtxs – The vertices that make up the face

  • color – The color of the face

virtual void faces(const std::vector<Vector3> &vtxs, const std::vector<FaceType> &faces, ColorRGB color = {0, 0, 0}) final

Draw a faces that connects a list of vertices - expert only.

Note

Depending on the helper implementation, out of plane vertices might be handled differently.

Parameters
  • vtxs – The vertices that make up the faceS

  • faces – The face presectiotions (i.e. connecting vertices)

  • color – The color of the face

virtual void line(const Vector3 &a, const Vector3 &b, ColorRGB color = {0, 0, 0}) final

Draw a line from a vertex to another.

Parameters
  • a – The start vertex

  • b – The end vertex

  • color – The color of the line

virtual void vertex(const Vector3 &vtx, ColorRGB color = {0, 0, 0}) final

Draw a vertex at a given location and a color.

Parameters
  • vtx – The vertex position

  • color – The color

virtual void write(const std::string &path) const final

Write the content of the helper to an outstream.

Note

wil change to std::filesystem::path once gcc9 is standard

Parameters

path – is the file system path for writing the file

virtual void write(std::ostream &os) const final

Write the content of the helper to an outstream.

Parameters

os – The output stream for file

void write(std::ostream &os, std::ostream &mos) const

Write the object and the material file.

Parameters
  • os – the output stream for the object

  • mos – the output stream for the auxiliary material file

Private Members

std::map<size_t, ColorRGB> m_faceColors
std::vector<FaceType> m_faces
std::map<size_t, ColorRGB> m_lineColors

Map of colors to be written at given index position.

std::vector<LineType> m_lines
unsigned int m_outputPrecision = 4

The output parameters.

double m_outputScalor = 1.
std::map<size_t, ColorRGB> m_vertexColors
std::vector<VertexType> m_vertices

The object data to be written.