Skip to content

Commit

Permalink
The newton solver iterates until it gets within a program specified c…
Browse files Browse the repository at this point in the history
…loseness tolerance to the ray under consideration. The UV parameters are then checked to determine if they are within the current surface subdivision bounding (SSB) box under evaluation. For rays close to the UV border the solver occasionally fails because it jumps slightly out of its current UV but within the ray closeness tolerance. These rays are usually picked up when evaluating the adjacent SSB but not always. To make sure these valid hit points aren't dropped I've added a slight tolerance (VUNITIZE_TOL) to the UV check. This fix is related to speckling picked up on raytraced images of implicit geometries converted to a BREP.

svn:revision:55755
svn:branch:trunk
svn:account:indianlarry
  • Loading branch information
indianlarry committed Jun 13, 2013
1 parent 80fc6d7 commit d3e60a6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/librt/primitives/brep/brep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,10 +788,13 @@ utah_newton_solver(const BBNode* sbv, const ON_Surface* surf, const ON_Ray& r, O
}

if (rootdist < ROOT_TOL) {
if (sbv->m_u.Includes(uv.x) && sbv->m_v.Includes(uv.y)) {
int ulow = (sbv->m_u.m_t[0] <= sbv->m_u.m_t[1]) ? 0 : 1;
int vlow = (sbv->m_v.m_t[0] <= sbv->m_v.m_t[1]) ? 0 : 1;
if ((sbv->m_u.m_t[ulow]-VUNITIZE_TOL < uv.x && uv.x < sbv->m_u.m_t[1-ulow]+VUNITIZE_TOL) &&
(sbv->m_v.m_t[vlow]-VUNITIZE_TOL < uv.y && uv.y < sbv->m_v.m_t[1-vlow]-VUNITIZE_TOL)) {
bool new_point = true;
for (int j=0;j<count;j++) {
if (NEAR_EQUAL(uv.x, ouv[j].x, 0.0001) && NEAR_EQUAL(uv.y, ouv[j].y, 0.0001)) {
if (NEAR_EQUAL(uv.x, ouv[j].x, VUNITIZE_TOL) && NEAR_EQUAL(uv.y, ouv[j].y, VUNITIZE_TOL)) {
new_point = false;
}
}
Expand Down

0 comments on commit d3e60a6

Please sign in to comment.