Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
urdf_mesh_io.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
11#include <momentum/math/mesh.h>
12
13#include <optional>
14
15namespace momentum {
16
23Mesh generateBoxMesh(float dimX, float dimY, float dimZ);
24
31Mesh generateCylinderMesh(float radius, float length, int segments = 32);
32
39Mesh generateSphereMesh(float radius, int latSegments = 16, int lonSegments = 32);
40
47std::optional<Mesh> loadStlMesh(const filesystem::path& filepath);
48
56std::optional<Mesh> loadObjMesh(const filesystem::path& filepath);
57
68std::optional<filesystem::path> resolveMeshPath(
69 const std::string& filename,
70 const filesystem::path& urdfDir);
71
72} // namespace momentum
Mesh generateCylinderMesh(float radius, float length, int segments)
Generates a cylinder mesh centered at the origin with the Z axis as its axis.
MeshT< float > Mesh
Definition fwd.h:20
Mesh generateSphereMesh(float radius, int latSegments, int lonSegments)
Generates a UV sphere mesh centered at the origin.
Mesh generateBoxMesh(float dimX, float dimY, float dimZ)
Generates a box mesh with the given dimensions centered at the origin.
std::optional< filesystem::path > resolveMeshPath(const std::string &filename, const filesystem::path &urdfDir)
Resolves a mesh filename from a URDF visual element to a filesystem path.
std::optional< Mesh > loadStlMesh(const filesystem::path &filepath)
Loads a mesh from an STL file (binary or ASCII).
std::optional< Mesh > loadObjMesh(const filesystem::path &filepath)
Loads a mesh from a Wavefront OBJ file (vertices and triangular/polygon faces).