Skip to content

Instantly share code, notes, and snippets.

Sebastian Reiter sreiter

View GitHub Profile
@sreiter
sreiter / triangle_to_vertex_normals.cpp
Last active Jul 2, 2020
A short example on how triangle normals can be used to compute vertex normals for either smooth or flat shading.
View triangle_to_vertex_normals.cpp
// Please note: The code below has not been compiled. Includes are missing.
// This snippet is just for illustration purposes. Feedback is highly appreciated, of course.
// First we'll read the stl data into local arrays. Each triplet in `rawPoints` corresponds to one
// 3D point and each triplet in `rawTriNormals` to one 3D triangle normal.
std::vector <float> rawPoints, rawTriNormals;
std::vector <unsigned int> triIndices, solids;
stl_reader::ReadStlFile ("geometry.stl", rawPoints, rawTriNormals, triIndices, solids);
You can’t perform that action at this time.