Blender V5.0
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
9
10#pragma once
11
12#include <Eigen/Dense>
13// Eigen doesn't provide assert anymore
14#include <cassert>
15
16namespace slim {
17/* Constructs a list of lengths of edges opposite each index in a face
18 * (triangle) list
19 *
20 * Templates:
21 * DerivedV derived from vertex positions matrix type: i.e. MatrixXd
22 * DerivedF derived from face indices matrix type: i.e. MatrixXi
23 * DerivedL derived from edge lengths matrix type: i.e. MatrixXd
24 * Inputs:
25 * V eigen matrix #V by 3
26 * F #F by 2 list of mesh edges
27 * or
28 * F #F by 3 list of mesh faces (must be triangles)
29 * or
30 * T #T by 4 list of mesh elements (must be tets)
31 * Outputs:
32 * L #F by {1|3|6} list of edge lengths
33 * for edges, column of lengths
34 * for triangles, columns correspond to edges [1,2],[2,0],[0,1]
35 */
36template<typename DerivedV, typename DerivedF, typename DerivedL>
37inline void edge_lengths(const Eigen::PlainObjectBase<DerivedV> &V,
38 const Eigen::PlainObjectBase<DerivedF> &F,
39 Eigen::PlainObjectBase<DerivedL> &L);
40
41/* Constructs a list of squared lengths of edges opposite each index in a face
42 * (triangle) list
43 *
44 * Templates:
45 * DerivedV derived from vertex positions matrix type: i.e. MatrixXd
46 * DerivedF derived from face indices matrix type: i.e. MatrixXi
47 * DerivedL derived from edge lengths matrix type: i.e. MatrixXd
48 * Inputs:
49 * V eigen matrix #V by 3
50 * F #F by 2 list of mesh edges
51 * or
52 * F #F by 3 list of mesh faces (must be triangles)
53 * Outputs:
54 * L #F by {1|3|6} list of edge lengths squared
55 * for edges, column of lengths
56 * for triangles, columns correspond to edges [1,2],[2,0],[0,1]
57 */
58template<typename DerivedV, typename DerivedF, typename DerivedL>
59inline void squared_edge_lengths(const Eigen::PlainObjectBase<DerivedV> &V,
60 const Eigen::PlainObjectBase<DerivedF> &F,
61 Eigen::PlainObjectBase<DerivedL> &L);
62} // namespace slim
63
64#include "edge_lengths.cpp"
#define F
#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