Lagrange
compute_euler.h
1/*
2 * Copyright 2018 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/Edge.h>
15#include <lagrange/MeshTrait.h>
16#include <lagrange/legacy/inline.h>
17
18namespace lagrange {
19LAGRANGE_LEGACY_INLINE
20namespace legacy {
21/*
22return Euler characteristic of the mesh
23*/
24template <typename MeshType>
25int compute_euler(MeshType& mesh)
26{
27 static_assert(MeshTrait<MeshType>::is_mesh(), "Input type is not Mesh");
28 mesh.initialize_edge_data();
29 return (int)mesh.get_num_vertices() + (int)mesh.get_num_facets() - (int)mesh.get_num_edges();
30}
31} // namespace legacy
32} // namespace lagrange
Definition: Mesh.h:48
int compute_euler(const SurfaceMesh< Scalar, Index > &mesh)
Compute Euler characteristic of a mesh.
Definition: topology.cpp:35
Main namespace for Lagrange.
Definition: AABBIGL.h:30