Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Issue with extrapolating missing control points for boundary patches. #1195

Closed
VadiMysore opened this issue Apr 13, 2020 · 4 comments
Closed

Comments

@VadiMysore
Copy link

Hi there!
I have been using the following simple rules to extrapolate the missing control points for boundary patches. This was suggested by @barfowl.

// Don't extrapolate corner points until all boundary points in place
if ((boundaryMask & 1) != 0) {
cpt[1] = 2cpt[5] - cpt[9];
cpt[2] = 2cpt[6] - cpt[10];
}
if ((boundaryMask & 2) != 0) {
cpt[7] = 2cpt[6] - cpt[5];
cpt[11] = 2cpt[10] - cpt[9];
}
if ((boundaryMask & 4) != 0) {
cpt[13] = 2cpt[9] - cpt[5];
cpt[14] = 2cpt[10] - cpt[6];
}
if ((boundaryMask & 8) != 0) {
cpt[4] = 2cpt[5] - cpt[6];
cpt[8] = 2cpt[9] - cpt[10];
}

// Now safe to extrapolate corner points:
if ((boundaryMask & 1) != 0) {
cpt[0] = 2cpt[4] - cpt[8];
cpt[3] = 2
cpt[7] - cpt[11];
}
if ((boundaryMask & 2) != 0) {
cpt[3] = 2cpt[2] - cpt[1];
cpt[15] = 2
cpt[14] - cpt[13];
}
if ((boundaryMask & 4) != 0) {
cpt[12] = 2cpt[8] - cpt[4];
cpt[15] = 2
cpt[11] - cpt[7];
}
if ((boundaryMask & 8) != 0) {
cpt[0] = 2cpt[1] - cpt[2];
cpt[12] = 2
cpt[13] - cpt[14];
}

The above extrapolation rules have been working fine for most of the cases tested, except the following. In the following picture, the coordinates of non-extrapolated control points: 0, 1, 2, 4, 5, 6, 8, 9, 10, are given with their 3D coordinates in the model space(units should not matter though they are all in mm).

Now, we need to extrapolate the CVs: 3, 7, 11, 12, 13, 14, 15.

Using the above rules, we first evaluate the boundary points 7, 11, 13 and 14.

CV7 = (0.2, -0.1, 0.05), CV11 = (0.1, -0.05, 0.1). These are distinct and look correct.

So does, CV3.

But, CV13 = (0, 0, 0.15) and CV14 = (0, 0, 0.15) turn out to be the same.

So also, CV12 = (0, 0, 0.15) and CV15 = (0, 0, 0.15).

It appears that the extrapolation scheme suggested may have issues for cases like these. Is there an alternative to it?

IssueWithExtrapolatingGhostControlPoints

@davidgyu
Copy link
Member

Hi! Although the resulting point positions you are seeing might be surprising, they are correct!

If you evaluate the resulting patch, it will correctly interpolate the boundary curves defined by points 2,6,10 and points 8,9,10 with a sharp corner at point 10.

It might be helpful to try to re-derive the above formulae yourself! They are all simple linear extrapolation. And then consider the effect of the additional extrapolated points on the shape of surface defined by the patch.

BoundaryPatch

@VadiMysore
Copy link
Author

@davidgyu - Hi David!
Thanks for the response. Yes, the extrapolation of the ghost control points is correct. It is just that our modeling kernel considers these as self-intersecting surfaces and thus our display gets affected.

I found that even perturbing the extrapolation factor 2 by even 10 e-05 changes the original b-surface definition as expected and we do not want to go this route.

We have found a workaround to such situations to clamp the knots of the surface. This changes the basis of definition to Bezier's but keeps the surface shape the same. This appears to work.

Also, can someone please answer my earlier query on the continuity across the Subdivision patches returned by OpnSubDiv? This is: Quality of limit surface when extra-ordinary vertices are present. #1188.

Thanks again for your response.

@jilliene
Copy link

Filed as internal issue #OSD-323

@davidgyu
Copy link
Member

Glad you have a solution that's working for you! A change of basis can be helpful in some situations as you have discovered. I think Barry has followed up on your other question.

Marking this closed.

Thanks!

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

No branches or pull requests

3 participants