32 const auto& vertex_positions = mesh.vertices().attributes().at<
math::fvec3>(
"position");
33 const auto& face_normals = mesh.faces().attributes().at<
math::fvec3>(
"normal");
37 traversal.
edge =
nullptr;
41 auto target_point = end;
51 const auto& a = vertex_positions[loop_it->vertex()->index()];
52 const auto& b = vertex_positions[(++loop_it)->vertex()->index()];
53 const auto& c = vertex_positions[(++loop_it)->vertex()->index()];
76 closest_loop = *loop_it;
82 traversal.
edge = closest_loop->
edge();
150 if (closest_edge == previous_closest_edge)
153 traversal.edge = closest_edge;
158 previous_closest_edge = closest_edge;
162 if (symmetric_loop == closest_loop)
164 symmetric_loop = closest_edge->
loops().
back();
169 const auto& n0 = face_normals[face->
index()];
170 const auto& n1 = face_normals[symmetric_face->
index()];
177 traversal_direction =
rotation * traversal_direction;
180 face = symmetric_face;
184 traversal.face = face;
185 traversal.target_point = target_point;
189 const auto& a = vertex_positions[loop_it->vertex()->index()];
190 const auto& b = vertex_positions[(++loop_it)->vertex()->index()];
191 const auto& c = vertex_positions[(++loop_it)->vertex()->index()];
brep_loop * front() const noexcept
Returns the first loop.
constexpr std::size_t size() const noexcept
Returns the number of loops in the list.
brep_loop * back() const noexcept
Returns the last loop.
Curve segment bounded by two vertices.
constexpr const brep_edge_loop_list & loops() const noexcept
Returns the list of loops that share this edge.
constexpr const_iterator begin() const noexcept
Returns an iterator to the first loop.
Portion of a shell bounded by loops.
constexpr const brep_face_loop_list & loops() const noexcept
Returns the list of loops associated with this face.
constexpr std::size_t index() const noexcept
Returns the index of this face in the mesh face array.
Connected boundary of a single face.
constexpr brep_loop * next() const noexcept
Returns a pointer to the next loop.
constexpr brep_edge * edge() const noexcept
Returns a pointer to the loop edge.
constexpr brep_loop * previous() const noexcept
Returns a pointer to the previous loop.
constexpr brep_face * face() const noexcept
Returns a pointer to the loop face.
constexpr brep_vertex * vertex() const noexcept
Returns a pointer to the loop vertex.
Boundary representation (B-rep) of a mesh.
constexpr std::size_t index() const noexcept
Returns the index of this vertex in the mesh vertex array.
Artificial intelligence (AI)
navmesh_traversal traverse_navmesh(const geom::brep_mesh &mesh, geom::brep_face *face, const math::fvec3 &start, const math::fvec3 &end)
Moves a point along the surface of a mesh.
constexpr bool is_edge_region(triangle_region region) noexcept
Checks whether a triangle voronoi region is an edge region.
constexpr std::uint8_t vertex_index(triangle_region region) noexcept
Returns the vertex index of a vertex region.
constexpr bool is_face_region(triangle_region region) noexcept
Checks whether a triangle voronoi region is a face region.
triangle_region
Voronoi regions of a triangle.
constexpr point< T, 3 > cartesian_to_barycentric(const point< T, 3 > &p, const point< T, 3 > &a, const point< T, 3 > &b, const point< T, 3 > &c) noexcept
Converts Cartesian coordinates to barycentric coordinates.
constexpr point< T, N > closest_point(const ray< T, N > &a, const point< T, N > &b) noexcept
Calculates the closest point on a ray to a point.
constexpr std::uint8_t edge_index(triangle_region region) noexcept
Returns the edge index of an edge region.
quaternion< T > normalize(const quaternion< T > &q)
Normalizes a quaternion.
constexpr vector< T, N > abs(const vector< T, N > &x)
Returns the absolute values of each element.
quaternion< T > rotation(const vec3< T > &from, const vec3< T > &to, T tolerance=T{1e-6})
Constructs a quaternion representing the minimum rotation from one direction to another direction.
constexpr T dot(const quaternion< T > &a, const quaternion< T > &b) noexcept
Calculates the dot product of two quaternions.