Datasets:

Modalities:
Image
Text
Formats:
text
Size:
< 1K
Libraries:
Datasets
License:
File size: 1,120 Bytes
5b89cb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// This file is part of libigl, a simple c++ geometry processing library.
// 
// Copyright (C) 2018 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/.
#include <test_common.h>
#include <igl/barycentric_interpolation.h>

TEST_CASE("barycentric_interpolation: two-triangles", "[igl]")
{
  const Eigen::MatrixXd V = 
    (Eigen::MatrixXd(4,3) << 
     0,0,0,
     1,0,0,
     1,1,0,
     0,1,0).finished();
  const Eigen::MatrixXi F = 
    (Eigen::MatrixXi(2,3) << 0,1,2,0,2,3).finished();
  const Eigen::VectorXi I =
   (Eigen::VectorXi(4,1)<<0,0,1,1).finished();
  const Eigen::MatrixXd B =
   (Eigen::MatrixXd(4,3)<<
    1,0,0,
    0.5,0.5,0,
    0.5,0.5,0,
    0.25,0.25,0.5
    ).finished();
  const Eigen::MatrixXd Xgt =
   (Eigen::MatrixXd(4,3)<<
    0,0,0,
    0.5,0,0,
    0.5,0.5,0,
    0.25,0.75,0
    ).finished();
  Eigen::MatrixXd X;
  igl::barycentric_interpolation(V,F,B,I,X);
  test_common::assert_eq(X,Xgt);
}