Medusa  1.1
Coordinate Free Mehless Method implementation
test/domains/compute_normal_test.cpp
#include "gtest/gtest.h"
#include <Eigen/Geometry>
namespace mm {
TEST(Domains, NormalTest3D) {
Eigen::Matrix<double, 3, 2> J;
J.col(1) = Vec3d(0.5, 0.5, 0);
J.col(0) = Vec3d(1, 0.5, 0);
Vec3d normal = -J.col(0).cross(J.col(1));
normal.normalize();
EXPECT_LT((normal - normal2).norm(), 1e-15);
}
TEST(Domains, NormalTest1Dto3D) {
Eigen::Matrix<double, 3, 1> J;
J.col(0) = Vec3d(0.5, 0.5, 0);
EXPECT_LT(std::abs(normal.dot(J.col(0))), 1e-15);
}
TEST(Domains, NormalTest2D) {
Eigen::Matrix<double, 2, 1> J;
J << 0.1, 2.3;
Vec2d normal(J(1), -J(0)); normal.normalize();
EXPECT_LT((normal - normal2).norm(), 1e-15);
}
} // namespace mm
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
compute_normal_fwd.hpp
mm::Vec3d
Vec< double, 3 > Vec3d
Convenience typedef for 3d vector of doubles.
Definition: Vec_fwd.hpp:35
mm::surface_fill_internal::compute_normal
Vec< scalar_t, dim_to > compute_normal(Eigen::Matrix< scalar_t, dim_to, dim_from > J)
Compute normal from given Jacobian.
mm::Vec2d
Vec< double, 2 > Vec2d
Convenience typedef for 2d vector of doubles.
Definition: Vec_fwd.hpp:34