Skip to content

Commit

Permalink
Replaced a few more cpp17::optional with std::optional
Browse files Browse the repository at this point in the history
I missed these in the previous commits.
  • Loading branch information
patrikhuber committed Dec 15, 2024
1 parent d08b4c2 commit 8cd16c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions examples/fit-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "eos/morphablemodel/MorphableModel.hpp"
#include "eos/render/opencv/draw_utils.hpp"
#include "eos/render/texture_extraction.hpp"
#include "eos/cpp17/optional.hpp"

#include "Eigen/Core"

Expand Down Expand Up @@ -142,7 +141,7 @@ int main(int argc, char* argv[])
morphablemodel::load_blendshapes(blendshapesfile.string());

morphablemodel::MorphableModel morphable_model_with_expressions(
morphable_model.get_shape_model(), blendshapes, morphable_model.get_color_model(), cpp17::nullopt,
morphable_model.get_shape_model(), blendshapes, morphable_model.get_color_model(), std::nullopt,
morphable_model.get_texture_coordinates());

// These two are used to fit the front-facing contour to the ibug contour landmarks:
Expand All @@ -167,7 +166,7 @@ int main(int argc, char* argv[])
fitting::RenderingParameters rendering_params;
std::tie(mesh, rendering_params) = fitting::fit_shape_and_pose(
morphable_model_with_expressions, landmarks, landmark_mapper, image.cols, image.rows, edge_topology,
ibug_contour, model_contour, 5, cpp17::nullopt, 30.0f);
ibug_contour, model_contour, 5, std::nullopt, 30.0f);

// The 3D head pose can be recovered as follows - the function returns an Eigen::Vector3f with yaw, pitch,
// and roll angles:
Expand Down
6 changes: 3 additions & 3 deletions include/eos/core/read_obj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#define EOS_READ_OBJ_HPP

#include "eos/core/Mesh.hpp"
#include "eos/cpp17/optional.hpp"

#include "Eigen/Core"

Expand All @@ -33,6 +32,7 @@
#include <tuple>
#include <utility>
#include <vector>
#include <optional>

namespace eos {
namespace core {
Expand Down Expand Up @@ -88,7 +88,7 @@ void tokenize(const std::string& str, ContainerType& tokens, const std::string&
* Another obj parser we can check: https://github.com/qnzhou/PyMesh/blob/master/src/IO/OBJParser.cpp (and
* same file with .h)
*/
inline std::pair<Eigen::Vector3f, cpp17::optional<Eigen::Vector3f>> parse_vertex(const std::string& line)
inline std::pair<Eigen::Vector3f, std::optional<Eigen::Vector3f>> parse_vertex(const std::string& line)
{
std::vector<std::string> tokens;
tokenize(line, tokens, " ", true); // compress multiple (and leading/trailing) whitespaces
Expand All @@ -99,7 +99,7 @@ inline std::pair<Eigen::Vector3f, cpp17::optional<Eigen::Vector3f>> parse_vertex
"or 6 ('x y z r g b') numbers.");
}
const Eigen::Vector3f vertex(std::stof(tokens[0]), std::stof(tokens[1]), std::stof(tokens[2]));
cpp17::optional<Eigen::Vector3f> vertex_color;
std::optional<Eigen::Vector3f> vertex_color;
if (tokens.size() == 6)
{
vertex_color = Eigen::Vector3f(std::stof(tokens[3]), std::stof(tokens[4]), std::stof(tokens[5]));
Expand Down
2 changes: 1 addition & 1 deletion include/eos/morphablemodel/MorphableModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class MorphableModel
/**
* Returns the shape expression model, if this Morphable Model has one.
*
* Returns an empty cpp17::optional if the Morphable Model does not have a separate expression
* Returns an empty std::optional if the Morphable Model does not have a separate expression
* model (check with MorphableModel::has_separate_expression_model()).
* If it does have an expression model, an std::variant<PcaModel, Blendshapes> is returned -
* that is, either a PcaModel (if it is an expression PCA model), or Blendshapes.
Expand Down

0 comments on commit 8cd16c1

Please sign in to comment.