Skip to content

Commit

Permalink
mark disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pca006132 committed Sep 15, 2024
1 parent fb7a6ae commit edaaece
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 6 deletions.
4 changes: 4 additions & 0 deletions meshIO/include/manifold/meshIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,9 @@ MeshGL ImportMesh(const std::string& filename, bool forceCleanup = false);

void ExportMesh(const std::string& filename, const MeshGL& mesh,
const ExportOptions& options);

[[deprecated("Mesh API is now deprecated, use MeshGL/MeshGL64 instead")]]
void ExportMesh(const std::string& filename, const Mesh& mesh,
const ExportOptions& options);
/** @} */
} // namespace manifold
5 changes: 5 additions & 0 deletions src/manifold/include/manifold/manifold.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,13 @@ class Manifold {
Manifold& operator=(Manifold&&) noexcept;

Manifold(const MeshGL&, const std::vector<float>& propertyTolerance = {});
[[deprecated("Mesh API is now deprecated, use MeshGL/MeshGL64 instead")]]
Manifold(const Mesh&);
Manifold(const MeshGL64&, const std::vector<double>& propertyTolerance = {});

[[deprecated("Mesh API is now deprecated, use MeshGL/MeshGL64 instead")]]
static Manifold Smooth(const Mesh&,
const std::vector<Smoothness>& sharpenedEdges = {});
static Manifold Smooth(const MeshGL&,
const std::vector<Smoothness>& sharpenedEdges = {});
static Manifold Smooth(const MeshGL64&,
Expand Down Expand Up @@ -212,6 +216,7 @@ class Manifold {
* Details of the manifold
*/
///@{
[[deprecated("Mesh API is now deprecated, use MeshGL/MeshGL64 instead")]]
Mesh GetMesh() const;
MeshGL GetMeshGL(ivec3 normalIdx = ivec3(0)) const;
MeshGL64 GetMeshGL64(ivec3 normalIdx = ivec3(0)) const;
Expand Down
42 changes: 42 additions & 0 deletions src/manifold/src/constructors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,48 @@ Manifold Manifold::Smooth(const MeshGL64& meshGL64,
return Manifold(impl);
}

/**
* Constructs a smooth version of the input mesh by creating tangents; this
* method will throw if you have supplied tangents with your mesh already. The
* actual triangle resolution is unchanged; use the Refine() method to
* interpolate to a higher-resolution curve.
*
* By default, every edge is calculated for maximum smoothness (very much
* approximately), attempting to minimize the maximum mean Curvature magnitude.
* No higher-order derivatives are considered, as the interpolation is
* independent per triangle, only sharing constraints on their boundaries.
*
* @param mesh input Mesh.
* @param sharpenedEdges If desired, you can supply a vector of sharpened
* halfedges, which should in general be a small subset of all halfedges. Order
* of entries doesn't matter, as each one specifies the desired smoothness
* (between zero and one, with one the default for all unspecified halfedges)
* and the halfedge index (3 * triangle index + [0,1,2] where 0 is the edge
* between triVert 0 and 1, etc).
*
* At a smoothness value of zero, a sharp crease is made. The smoothness is
* interpolated along each edge, so the specified value should be thought of as
* an average. Where exactly two sharpened edges meet at a vertex, their
* tangents are rotated to be colinear so that the sharpened edge can be
* continuous. Vertices with only one sharpened edge are completely smooth,
* allowing sharpened edges to smoothly vanish at termination. A single vertex
* can be sharpened by sharping all edges that are incident on it, allowing
* cones to be formed.
*/
Manifold Manifold::Smooth(const Mesh& mesh,
const std::vector<Smoothness>& sharpenedEdges) {
DEBUG_ASSERT(mesh.halfedgeTangent.empty(), std::runtime_error,
"when supplying tangents, the normal constructor should be used "
"rather than Smooth().");

Impl::MeshRelationD relation = {(int)ReserveIDs(1)};
IGNORE_DEPRECATED_BEGIN
std::shared_ptr<Impl> impl = std::make_shared<Impl>(mesh, relation);
IGNORE_DEPRECATED_END
impl->CreateTangents(impl->UpdateSharpenedEdges(sharpenedEdges));
return Manifold(impl);
}

/**
* Constructs a tetrahedron centered at the origin with one vertex at (1,1,1)
* and the rest at similarly symmetric points.
Expand Down
26 changes: 23 additions & 3 deletions src/manifold/src/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,33 @@

#include "manifold/collider.h"
#include "manifold/manifold.h"
#include "manifold/optional_assert.h"
#include "manifold/polygon.h"
#include "manifold/sparse.h"
#include "manifold/utils.h"
#include "manifold/vec.h"
#include "quickhull.h"
#include "shared.h"

#if defined(__GNUC__)

#define IGNORE_DEPRECATED_BEGIN \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")

#define IGNORE_DEPRECATED_END _Pragma("GCC diagnostic pop")

#elif defined(_MSC_VER)

#define IGNORE_DEPRECATED_BEGIN \
_Pragma("warning(push)") _Pragma("warning(disable : 4996)")

#define IGNORE_DEPRECATED_END _Pragma("warning(pop)")

#else

#define IGNORE_DEPRECATED_BEGIN
#define IGNORE_DEPRECATED_END

#endif

namespace manifold {

/** @ingroup Private */
Expand Down Expand Up @@ -229,6 +248,7 @@ struct Manifold::Impl {
meshRelation_.originalID = -1;
}

[[deprecated("Mesh API is now deprecated, use MeshGL/MeshGL64 instead")]]
Impl(const Mesh&, const MeshRelationD& relation,
const std::vector<double>& propertyTolerance = {},
bool hasFaceIDs = false);
Expand Down
4 changes: 4 additions & 0 deletions src/manifold/src/manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ Manifold::Manifold(const MeshGL64& meshGL64,
: pNode_(std::make_shared<CsgLeafNode>(
std::make_shared<Impl>(meshGL64, propertyTolerance))) {}

IGNORE_DEPRECATED_BEGIN
/**
* Convert a Mesh into a Manifold. Will return an empty Manifold
* and set an Error Status if the Mesh is not an oriented 2-manifold. Will
Expand All @@ -316,7 +317,9 @@ Manifold::Manifold(const Mesh& mesh) {
pNode_ =
std::make_shared<CsgLeafNode>(std::make_shared<Impl>(mesh, relation));
}
IGNORE_DEPRECATED_END

IGNORE_DEPRECATED_BEGIN
/**
* This returns a Mesh of simple vectors of vertices and triangles suitable for
* saving or other operations outside of the context of this library.
Expand Down Expand Up @@ -347,6 +350,7 @@ Mesh Manifold::GetMesh() const {

return result;
}
IGNORE_DEPRECATED_END

/**
* The most complete output of this library, returning a MeshGL that is designed
Expand Down
3 changes: 2 additions & 1 deletion src/utilities/include/manifold/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ using Polygons = std::vector<SimplePolygon>;
/**
* The triangle-mesh input and output of this library.
*/
struct Mesh {
struct [[deprecated(
"Mesh API is now deprecated, use MeshGL/MeshGL64 instead")]] Mesh {
/// Required: The X-Y-Z positions of all vertices.
std::vector<vec3> vertPos;
/// Required: The vertex indices of the three triangle corners in CCW (from
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if(MANIFOLD_EXPORT)
target_compile_options(${PROJECT_NAME} PUBLIC -DMANIFOLD_EXPORT)
endif()

target_compile_options(${PROJECT_NAME} PRIVATE ${MANIFOLD_FLAGS})
target_compile_options(${PROJECT_NAME} PRIVATE ${MANIFOLD_FLAGS} -Wno-deprecated-declarations)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)

add_test(test_all ${PROJECT_NAME})
Expand Down
2 changes: 1 addition & 1 deletion test/smooth_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ TEST(Smooth, TruncatedCone) {
}

#ifdef MANIFOLD_CROSS_SECTION
TEST(Smooth, ToLength) {
TEST(Smooth, DISABLED_ToLength) {
Manifold cone = Manifold::Extrude(
CrossSection::Circle(10, 10).Translate({10, 0}).ToPolygons(), 2, 0, 0,
{0, 0});
Expand Down

0 comments on commit edaaece

Please sign in to comment.