Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
intersection.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
10#include <momentum/math/fwd.h>
11#include <momentum/math/types.h>
12
13namespace momentum {
14
27// TODO: Document the behavior for degenerate triangles (zero-area faces) and for
28// coplanar overlapping triangles, neither of which is explicitly specified here.
29template <typename T>
30bool intersectFace(
31 const MeshT<T>& mesh,
32 const std::vector<Vector3<T>>& faceNormals,
33 int32_t face0,
34 int32_t face1);
35
46template <typename T>
47std::vector<std::pair<int32_t, int32_t>> intersectMeshBruteForce(const MeshT<T>& mesh);
48
59template <typename T>
60std::vector<std::pair<int32_t, int32_t>> intersectMesh(const MeshT<T>& mesh);
61
62} // namespace momentum
bool intersectFace(const MeshT< T > &mesh, const std::vector< Vector3< T > > &faceNormals, const int32_t face0, const int32_t face1)
Tests whether two given triangle faces of a mesh intersect with each other.
std::vector< std::pair< int32_t, int32_t > > intersectMeshBruteForce(const MeshT< T > &mesh)
Tests if the mesh self-intersects anywhere and returns all intersecting face pairs using a brute-forc...
std::vector< std::pair< int32_t, int32_t > > intersectMesh(const MeshT< T > &mesh)
Tests if the mesh self-intersects anywhere and returns all intersecting face pairs using a BVH (bound...
Vector< T, 3 > Vector3
Definition types.h:236
A generic mesh representation with support for vertices, faces, lines, and texture coordinates.
Definition mesh.h:20