Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

non-normalized tangent vectors #1

Open
HelliceSaouli opened this issue Oct 15, 2018 · 3 comments
Open

non-normalized tangent vectors #1

HelliceSaouli opened this issue Oct 15, 2018 · 3 comments

Comments

@HelliceSaouli
Copy link

Hello sir, can you please explain to me how you exactly computed non-normalized tangent vectors u and v

@sebastianlipponer
Copy link
Owner

Are you referring to the computation of u and v for triangles?

void
steiner_circumellipse(float const* v0_ptr, float const* v1_ptr,
float const* v2_ptr, float* p0_ptr, float* t1_ptr, float* t2_ptr)
{
Matrix2f Q;
Vector3f d0, d1, d2;
{
Map<const Vector3f> v[3] = { v0_ptr, v1_ptr, v2_ptr };
d0 = v[1] - v[0];
d0.normalize();
d1 = v[2] - v[0];
d1 = d1 - d0 * d0.dot(d1);
d1.normalize();
d2 = (1.0f / 3.0f) * (v[0] + v[1] + v[2]);
Vector2f p[3];
for (unsigned int j(0); j < 3; ++j)
{
p[j] = Vector2f(
d0.dot(v[j] - d2),
d1.dot(v[j] - d2)
);
}
Matrix3f A;
for (unsigned int j(0); j < 3; ++j)
{
A.row(j) = Vector3f(
p[j].x() * p[j].x(),
2.0f * p[j].x() * p[j].y(),
p[j].y() * p[j].y()
);
}
FullPivLU<Matrix3f> lu(A);
Vector3f res = lu.solve(Vector3f::Ones());
Q(0, 0) = res(0);
Q(1, 1) = res(2);
Q(0, 1) = Q(1, 0) = res(1);
}
Map<Vector3f> p0(p0_ptr), t1(t1_ptr), t2(t2_ptr);
{
SelfAdjointEigenSolver<Matrix2f> es;
es.compute(Q);
Vector2f const& l = es.eigenvalues();
Vector2f const& e0 = es.eigenvectors().col(0);
Vector2f const& e1 = es.eigenvectors().col(1);
p0 = d2;
t1 = (1.0f / std::sqrt(l.x())) * (d0 * e0.x() + d1 * e0.y());
t2 = (1.0f / std::sqrt(l.y())) * (d0 * e1.x() + d1 * e1.y());
}
}

@HelliceSaouli
Copy link
Author

yes the t1, and t2 ? and is it possible to compute it if we are not loading a triangular mesh. ?

@sebastianlipponer
Copy link
Owner

sebastianlipponer commented Oct 28, 2018

Whats the actual representation of your input geometry?

The code above converts a triangle mesh to a point based representation by computing the circumellipse for each triangle of the triangle mesh. The vectors t1 and t2 are the ellipses semi-major and semi-minor axis.

While the code allows you to render a triangle mesh using surface splatting in meaningful way, the resulting point based representation is certainly not an optimal reconstruction of the given input geometry.

You may want to use a full-blown point-based surface reconstruction algorithm. For example the technique described by Wu and Kobbelt [1].

[1] Optimized Sub-Sampling of Point Sets for Surface Splatting

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants