12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- // This file is part of libigl, a simple c++ geometry processing library.
- //
- // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
- //
- // This Source Code Form is subject to the terms of the Mozilla Public License
- // v. 2.0. If a copy of the MPL was not distributed with this file, You can
- // obtain one at http://mozilla.org/MPL/2.0/.
- #ifndef IGL_PER_VERTEX_NORMALS_H
- #define IGL_PER_VERTEX_NORMALS_H
- #include "igl_inline.h"
- #include <Eigen/Core>
- // Note: It would be nice to support more or all of the methods here:
- // "A comparison of algorithms for vertex normal computation"
- namespace igl
- {
- enum PerVertexNormalsWeightingType
- {
- // Incident face normals have uniform influence on vertex normal
- PER_VERTEX_NORMALS_WEIGHTING_TYPE_UNIFORM = 0,
- // Incident face normals are averaged weighted by area
- PER_VERTEX_NORMALS_WEIGHTING_TYPE_AREA = 1,
- // Incident face normals are averaged weighted by incident angle of vertex
- PER_VERTEX_NORMALS_WEIGHTING_TYPE_ANGLE = 2,
- // Area weights
- PER_VERTEX_NORMALS_WEIGHTING_TYPE_DEFAULT = 3,
- NUM_PER_VERTEX_NORMALS_WEIGHTING_TYPE = 4
- };
- // Compute vertex normals via vertex position list, face list
- // Inputs:
- // V #V by 3 eigen Matrix of mesh vertex 3D positions
- // F #F by 3 eigne Matrix of face (triangle) indices
- // weighting Weighting type
- // Output:
- // N #V by 3 eigen Matrix of mesh vertex 3D normals
- template <typename DerivedV, typename DerivedF>
- IGL_INLINE void per_vertex_normals(
- const Eigen::PlainObjectBase<DerivedV>& V,
- const Eigen::PlainObjectBase<DerivedF>& F,
- const igl::PerVertexNormalsWeightingType weighting,
- Eigen::PlainObjectBase<DerivedV> & N);
- // Without weighting
- template <typename DerivedV, typename DerivedF>
- IGL_INLINE void per_vertex_normals(
- const Eigen::PlainObjectBase<DerivedV>& V,
- const Eigen::PlainObjectBase<DerivedF>& F,
- Eigen::PlainObjectBase<DerivedV> & N);
- // Inputs:
- // FN #F by 3 matrix of face (triangle) normals
- template <typename DerivedV, typename DerivedF, typename DerivedFN, typename DerivedN>
- IGL_INLINE void per_vertex_normals(
- const Eigen::PlainObjectBase<DerivedV>& V,
- const Eigen::PlainObjectBase<DerivedF>& F,
- const PerVertexNormalsWeightingType weighting,
- const Eigen::PlainObjectBase<DerivedFN>& FN,
- Eigen::PlainObjectBase<DerivedN> & N);
- // Without weighting
- template <typename DerivedV, typename DerivedF>
- IGL_INLINE void per_vertex_normals(
- const Eigen::PlainObjectBase<DerivedV>& V,
- const Eigen::PlainObjectBase<DerivedF>& F,
- const Eigen::PlainObjectBase<DerivedV>& FN,
- Eigen::PlainObjectBase<DerivedV> & N);
- }
- #ifndef IGL_STATIC_LIBRARY
- # include "per_vertex_normals.cpp"
- #endif
- #endif
|