opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
mesh_functions.h
Go to the documentation of this file.
1#pragma once
2
8
9#include <span>
10#include <vector>
11
12namespace osc
13{
14 // returns the "mass center" of a mesh
15 //
16 // assumes:
17 //
18 // - the mesh volume has a constant density
19 // - the mesh is entirely enclosed
20 // - all mesh normals are correct
22
23 // returns the average centerpoint of all vertices in a mesh
25
26 // returns tangent vectors for the given (presumed, mesh) data
27 //
28 // the 4th (w) component of each vector indicates the flip direction
29 // of the corresponding bitangent vector (i.e. `bitangent = cross(normal, tangent) * w`)
30 std::vector<Vector4> calc_tangent_vectors(
31 const MeshTopology&,
32 std::span<const Vector3> vertices,
33 std::span<const Vector3> normals,
34 std::span<const Vector2> tex_coords,
35 const MeshIndicesView&
36 );
37
38 // returns the bounding sphere of the given mesh
39 std::optional<Sphere> bounding_sphere_of(const Mesh&);
40}
Definition mesh_indices_view.h:22
Definition mesh.h:33
Definition custom_decoration_generator.h:5
Vector3 mass_center_of(const Mesh &)
Vector3 average_centroid_of(const Mesh &)
std::optional< Sphere > bounding_sphere_of(const Mesh &)
MeshTopology
Definition mesh_topology.h:8
std::vector< Vector4 > calc_tangent_vectors(const MeshTopology &, std::span< const Vector3 > vertices, std::span< const Vector3 > normals, std::span< const Vector2 > tex_coords, const MeshIndicesView &)