Sync
Some checks are pending
CMake / build (zip, zip, [self-hosted Linux], normals, obj, quad_subdivision, ux) (push) Waiting to run
CMake / build (zip, zip, [self-hosted Windows], Release/normals.exe, Release/obj.exe, Release/quad_subdivision.exe, win) (push) Waiting to run

This commit is contained in:
Tibo De Peuter 2024-11-10 20:12:39 +01:00
parent fa6881fb01
commit d0468e3b85
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
2 changed files with 5 additions and 8 deletions

View file

@ -6,8 +6,8 @@ void per_face_normals(
const Eigen::MatrixXi & F,
Eigen::MatrixXd & N)
{
////////////////////////////////////////////////////////////////////////////
// Replace with your code:
N = Eigen::MatrixXd::Zero(F.rows(),3);
////////////////////////////////////////////////////////////////////////////
for (int i = 0; i < F.rows(); i++)
{
N.row(i) = triangle_area_normal(V.row(F(i, 0) - 1), V.row(F(i, 1) - 1), V.row(F(i, 2) - 1));
}
}

View file

@ -6,8 +6,5 @@ Eigen::RowVector3d triangle_area_normal(
const Eigen::RowVector3d & b,
const Eigen::RowVector3d & c)
{
////////////////////////////////////////////////////////////////////////////
// Replace with your code:
////////////////////////////////////////////////////////////////////////////
return Eigen::RowVector3d(0,0,0);
return (a + b + c).normalized() * ((b - a).cross(c - a) / 2.0).norm();
}