scimesh 0.3.2
Headless CPU-only 3D software renderer for scientific mesh visualization
Loading...
Searching...
No Matches
scimesh::Triangle Struct Reference

A triangle defined by three vertex indices. More...

#include <types.h>

Public Attributes

uint32_t v0 = 0
 Index of the first vertex in Mesh::vertices.
 
uint32_t v1 = 0
 Index of the second vertex in Mesh::vertices.
 
uint32_t v2 = 0
 Index of the third vertex in Mesh::vertices.
 

Detailed Description

A triangle defined by three vertex indices.

A Triangle does not store actual 3D positions. Instead it stores three indices (v0, v1, v2) into a Mesh::vertices array. This is the standard "indexed face set" representation used throughout computer graphics: vertices are stored once and triangles reference them.

How it works (indexed face set)
// Imagine a mesh with 4 vertices:
mesh.vertices = { vA, vB, vC, vD };
mesh.triangles = {
{0, 1, 2}, // first triangle: vertices[0], vertices[1], vertices[2]
{1, 2, 3} // second triangle: vertices[1], vertices[2], vertices[3]
};
See also
Mesh, Mesh::vertices, Mesh::triangles

Definition at line 127 of file types.h.

Member Data Documentation

◆ v0

uint32_t scimesh::Triangle::v0 = 0

Index of the first vertex in Mesh::vertices.

Definition at line 129 of file types.h.

◆ v1

uint32_t scimesh::Triangle::v1 = 0

Index of the second vertex in Mesh::vertices.

Definition at line 131 of file types.h.

◆ v2

uint32_t scimesh::Triangle::v2 = 0

Index of the third vertex in Mesh::vertices.

Definition at line 133 of file types.h.


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