diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-01-10 17:08:59 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-01-10 17:08:59 +0300 |
commit | 622a65a297b82f6f63baff124f42e02a8f6ef29c (patch) | |
tree | f0a0fe4f5c7e53100e9b7979fdaa8dfd7c671803 /source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp | |
parent | 05603fa110e4e40a12db8d97789f8a56e62aa3f7 (diff) |
Fixed a bug in SilhouetteGeomEngine::ImageToWorldParameter() that caused
instability issues regarding the view map creation. A new iterative
solver of the 2D-to-3D inverse projection transformation problem was
implemented. Instead of directly solving the problem in the direction
from the 2D to 3D space, the new solver starts with an initial guess of
an approximated solution and asymptotically approaches to the true
solution by iteratively performing the forward 3D-to-2D projection
transformation and improving the approximation. Preliminary tests with
one simple and another complex scenes showed that the solver converges
quickly (more and less 20 iterations in many cases, with a stopping
criterion of a residual distance between the true and approximated
solutions less than 1e-6 Blender Unit).
Diffstat (limited to 'source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp')
-rwxr-xr-x | source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 3a4d86ea16f..9c7a084c204 100755 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -946,14 +946,20 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi real tb = (*i)->tB; if((ta < -epsilon) || (ta > 1+epsilon)) - cerr << "Warning: intersection out of range for edge " << fA->vertexA()->getId() << " - " << fA->vertexB()->getId() << endl; + cerr << "Warning: 2D intersection out of range for edge " << fA->vertexA()->getId() << " - " << fA->vertexB()->getId() << endl; if((tb < -epsilon) || (tb > 1+epsilon)) - cerr << "Warning: intersection out of range for edge " << fB->vertexA()->getId() << " - " << fB->vertexB()->getId() << endl; + cerr << "Warning: 2D intersection out of range for edge " << fB->vertexA()->getId() << " - " << fB->vertexB()->getId() << endl; real Ta = SilhouetteGeomEngine::ImageToWorldParameter(fA, ta); real Tb = SilhouetteGeomEngine::ImageToWorldParameter(fB, tb); + if((Ta < -epsilon) || (Ta > 1+epsilon)) + cerr << "Warning: 3D intersection out of range for edge " << fA->vertexA()->getId() << " - " << fA->vertexB()->getId() << endl; + + if((Tb < -epsilon) || (Tb > 1+epsilon)) + cerr << "Warning: 3D intersection out of range for edge " << fB->vertexA()->getId() << " - " << fB->vertexB()->getId() << endl; + TVertex * tvertex = ioViewMap->CreateTVertex(Vec3r(A1 + Ta*(A2-A1)), Vec3r(a1 + ta*(a2-a1)), fA, Vec3r(B1 + Tb*(B2-B1)), Vec3r(b1 + tb*(b2-b1)), fB, id); |