Blender V4.3
edge_lengths.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Alec Jacobson
2 * 2023 Blender Authors
3 *
4 * SPDX-License-Identifier: MPL-2.0 */
5
10#pragma once
11
12#include <Eigen/Dense>
13
14namespace slim {
15/* Constructs a list of lengths of edges opposite each index in a face
16 * (triangle) list
17 *
18 * Templates:
19 * DerivedV derived from vertex positions matrix type: i.e. MatrixXd
20 * DerivedF derived from face indices matrix type: i.e. MatrixXi
21 * DerivedL derived from edge lengths matrix type: i.e. MatrixXd
22 * Inputs:
23 * V eigen matrix #V by 3
24 * F #F by 2 list of mesh edges
25 * or
26 * F #F by 3 list of mesh faces (must be triangles)
27 * or
28 * T #T by 4 list of mesh elements (must be tets)
29 * Outputs:
30 * L #F by {1|3|6} list of edge lengths
31 * for edges, column of lengths
32 * for triangles, columns correspond to edges [1,2],[2,0],[0,1]
33 */
34template<typename DerivedV, typename DerivedF, typename DerivedL>
35inline void edge_lengths(const Eigen::PlainObjectBase<DerivedV> &V,
36 const Eigen::PlainObjectBase<DerivedF> &F,
37 Eigen::PlainObjectBase<DerivedL> &L);
38
39/* Constructs a list of squared lengths of edges opposite each index in a face
40 * (triangle) list
41 *
42 * Templates:
43 * DerivedV derived from vertex positions matrix type: i.e. MatrixXd
44 * DerivedF derived from face indices matrix type: i.e. MatrixXi
45 * DerivedL derived from edge lengths matrix type: i.e. MatrixXd
46 * Inputs:
47 * V eigen matrix #V by 3
48 * F #F by 2 list of mesh edges
49 * or
50 * F #F by 3 list of mesh faces (must be triangles)
51 * Outputs:
52 * L #F by {1|3|6} list of edge lengths squared
53 * for edges, column of lengths
54 * for triangles, columns correspond to edges [1,2],[2,0],[0,1]
55 */
56template<typename DerivedV, typename DerivedF, typename DerivedL>
57inline void squared_edge_lengths(const Eigen::PlainObjectBase<DerivedV> &V,
58 const Eigen::PlainObjectBase<DerivedF> &F,
59 Eigen::PlainObjectBase<DerivedL> &L);
60} // namespace slim
61
62#include "edge_lengths.cpp"
#define L
void edge_lengths(const Eigen::PlainObjectBase< DerivedV > &V, const Eigen::PlainObjectBase< DerivedF > &F, Eigen::PlainObjectBase< DerivedL > &L)
void squared_edge_lengths(const Eigen::PlainObjectBase< DerivedV > &V, const Eigen::PlainObjectBase< DerivedF > &F, Eigen::PlainObjectBase< DerivedL > &L)
CCL_NAMESPACE_BEGIN struct Window V