SpatiumLib
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
spatium::gfx3d::Mesh Class Reference

Mesh object in a scene. More...

#include <Mesh.h>

Inheritance diagram for spatium::gfx3d::Mesh:
Inheritance graph
[legend]
Collaboration diagram for spatium::gfx3d::Mesh:
Collaboration graph
[legend]

Public Member Functions

 Mesh (const std::vector< geom3d::Point3 > &vertices, const std::vector< std::array< int, 2 >> &edges)
 Constructor. More...
 
std::vector< geom3d::Point3vertices () const
 Get all vertices. More...
 
geom3d::Point3 vertex (size_t index) const
 Get a vertex by index. More...
 
std::vector< std::array< int, 2 > > edges () const
 Get all edges. More...
 
std::array< int, 2 > edge (size_t index) const
 Get an edge by index. An edge is a tuple of two vertex indices (v1, v2). More...
 
- Public Member Functions inherited from spatium::gfx3d::RenderObject
 RenderObject ()
 
std::array< double, 6 > bounds () const
 Get the boundaries of the object; axis aligned. Xmin, Xmax, Ymin, Ymax, Zmin, Zmax. More...
 
void setColor (const std::array< unsigned char, 3 > color)
 Set the color. More...
 
std::array< unsigned char, 3 > color () const
 Get the color. More...
 
- Public Member Functions inherited from spatium::gfx3d::SceneObject
 SceneObject ()
 
Transformtransform ()
 Get the transformation. More...
 

Static Public Member Functions

static Mesh cube (double diameter=1)
 Construct a cube mesh. More...
 

Protected Member Functions

void updateBounds () override
 

Friends

std::ostream & operator<< (std::ostream &os, const Mesh &mesh)
 Output to ostream. More...
 

Additional Inherited Members

- Protected Attributes inherited from spatium::gfx3d::RenderObject
std::array< double, 6 > m_bounds
 
std::array< unsigned char, 3 > m_color
 \TODO: use BoundingBox<double, 3> from namespace idx More...
 
- Protected Attributes inherited from spatium::gfx3d::SceneObject
Transform m_transform
 

Detailed Description

Mesh object in a scene.

A mesh is a collection of vertices connected by edges.

Constructor & Destructor Documentation

◆ Mesh()

spatium::gfx3d::Mesh::Mesh ( const std::vector< geom3d::Point3 > &  vertices,
const std::vector< std::array< int, 2 >> &  edges 
)
inline

Constructor.

Parameters
[in]verticesList of vertex coordinates
[in]edgesList of edges. An edge is a tuple of two vertex indices (v1, v2).

Member Function Documentation

◆ cube()

static Mesh spatium::gfx3d::Mesh::cube ( double  diameter = 1)
inlinestatic

Construct a cube mesh.

Parameters
[in]diameterDiameter of the cube (width, height, length)
Returns
Cube mesh

◆ edge()

std::array<int, 2> spatium::gfx3d::Mesh::edge ( size_t  index) const
inline

Get an edge by index. An edge is a tuple of two vertex indices (v1, v2).

Parameters
[in]indexIndex of the edge
Returns
The edge (v1, v2)

◆ edges()

std::vector<std::array<int, 2> > spatium::gfx3d::Mesh::edges ( ) const
inline

Get all edges.

Returns
Edges

◆ updateBounds()

void spatium::gfx3d::Mesh::updateBounds ( )
inlineoverrideprotectedvirtual
Todo:
Update these bounds based on m_transformation. Will that work?

Implements spatium::gfx3d::RenderObject.

◆ vertex()

geom3d::Point3 spatium::gfx3d::Mesh::vertex ( size_t  index) const
inline

Get a vertex by index.

Parameters
[in]indexIndex of the vertex
Returns
Vertex coordinates
Todo:
Bounds checking

◆ vertices()

std::vector<geom3d::Point3> spatium::gfx3d::Mesh::vertices ( ) const
inline

Get all vertices.

Returns
Vertices

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Mesh mesh 
)
friend

Output to ostream.


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