# Wish: More options for "Match surface"

I think it is a combination of how the geometry of NURBS surfaces works and how MatchSrf is designed to work. Exact tangential continuity along the entire length of the edges requires moving control points towards or away from the edge. MatchSrf appears to only move control points more or less normal to the surface and does not change the distance from the edge. My guess is this behavior by MatchSrf is intentional. By only moving control points normal to the surface exact matching may be only possible at a discrete set of locations. That is why MatchSrf has the “Refine match” option which adds knots and control points as needed to achieve the match within the requested tolerance.

I’ve been looking into the math of tangency and curvature matching of surfaces and it is much more complicated than the equivalent matching of curves.

Example of two exact tangency matches:
Match surface fail 3 DC01.3dm (2.8 MB)

1 Like

I don’t know why is this happening in Rhino, since Alias could do it perfectly. NURBS should be NURBS in every program. Also, I was able to achieve 0,5 degrees manually by moving the 2nd row of control points along their normal direction with the “MoveUVN” tool. It’s amazing that the automatic “Match surface” tool can’t achieve less than 1 degree of tangency.

Presumable Alias moves control points in a direction tangential to the surface as well as normal to the surface. See the examples of exact matches I posted above and compare them to what MatchSrf provides.

It appears that in your example MatchSrf provides an exact match at the side edges. My guess is that is by design. What was the match at the side edges when you manually moved control points?

It was exactly the same except that I moved them to the normal direction only. I don’t keep that model, but it’s easy to make a new one with the “MoveUVN” tool. My goal was to keep the control points at those exact locations across the UV coordinate and only modify the N position. But looks like it’s not possible to do so.

It bugs me that the automatic “Match surface” will create a very unnatural looking control polygon flow along those rows of control points. This thing alone breaks the tangency:

1 Like

I think what you’re not taking into consideration is that curvature and tangency don’t simply follow the UV directions. If the surface is not uniform in it’s control point structure then the curvatures/tangency can run in varying ‘degrees’ diagonally across the surface. When this happens, as in your case, you’re forced to keep on increasing the degree of the matching surface until the maths has enough control points to fully describe how the curvature/tangency crosses the surfaces boundaries diagonally.

Same thing happens in ICEM Surf. If you keep the degree of the matching surface the same and keep on applying the match tool then it’ll distort the control points heavily to get a better match. Increase the degree to 7 or 8 and you’ll get a very clean match.

This is just normal and part of what @davidcockey is describing about the maths involved.

That’s not to say MatchSurf command doesn’t need improvement though…

The problem is that “Match surface” is supposed to achieve a proper tangency, while in reality the 2nd control point of the matched surface in this particular example is not even tangent to the corresponding 2nd control point of the target surface. The angle between those opposite control points between the two adjacent surfaces is 6,1646619 degrees.

I disagree.

The real problem is that you’re asking the impossible.

The surface you are matching in to is horribly twisted at one end. This causes the tangency to flow across the surface in directions other than straight forward U/V directions. To capture this you’ll have to increase the mathematical ‘resolution’ of the matching surface by increasing the number of control points.

This really isn’t a match surf problem…!

Try an experiment - increase the order of the matching surface to 8, re-match into that horrible twisting surface and then display your control points and observe what’s happening with the curvature/tangency with the higher ‘resolution’.

Not really. David already demonstrated that a precise match is possible.

Its not hard to manually match Bobi’s surfaces for tangency.

Draw four lines using the bothsides option from the edge cv to the next cv on the surface that you want to match to and then move each control point in the second row of the other surface to the ends of those lines. The surfaces are now precisely matched for tangency. Turn on control points to see how in this file:
MatchSrf.3dm (171.5 KB)

To get the examples David posted all you have to do is scale3d each control point in the second row by the same scale factor using the edge control point as the base point for the scale operation. For Match1 the scale factor is 1.045 and for Match2 the scale factor is 1.93348.

Bobi is right. MatchSrf should be able to do this. It should be able to recognize that the two surfaces start with matching structure and therefore it should have the option to take advantage of that fact.

3 Likes

Or turn on “Refine match” in the current MatchSrf, specify your desired tolerances and MatchSrf will add control points as needed to achieve the tolerance. That is already built into MatchSrf though it refines the match while keeping the degree the same by adding knots and control points.

Give it explicit control over degree/spans and we may be up to something.

3 Likes

This post is a clear evidence that a more clever “Match surface” tool should be able to automatically do the math and achieve a proper G1 tangency with 0 degree deviation, given the fact that a human could do it without boosting the amount of control points. “Match surface” must be smart enough to “see” what’s the distance between the 1st and 2nd control points of the target surface and then apply similar distance to the corresponding control points on the surface to be matched. That basically fixes the majority of the problem.

What distance between the 1st and 2nd rows of control points should be used when the distance varies with each pair of control points, such as in the example above? My preference is for a G1 “exact match” option with a slider for the user to select the ratio of the distances between the surfaces.

Matching becomes much more complicated and restrictive when matching multiple edges and surfaces is involved, but that may be a topic for a new thread.

Hi David - yeah, the distance must be a consistent ratio - like 1:1 or 1:2 etc for all pairs of points.
For what it is worth, I monkeyed with this a bit a while ago - this thing works only for exactly matching surface structures but it helps sometimes at least:
PerfectTan.rhp (27 KB)

Bug report added here
RH-68644 MatchSrf: Match better

-Pascal

Pascal, constant scale factor between pairs of points on one surface and the corresponding pairs of points on the other side is what Jim and i are saying. See the examples in the file I posted. The scale factor can be any non-negative number, not just integers.

Knot insertion and degree elevation can be used to obtain exactly matching structures where feasible. There can be situations with mutispan surfaces where exactly matching structures may not be feasible without introducing multi-knots.

One sometimes disturbing issue with “Match surface” is that it will try to transfer the 1st and 2nd row of control points to the target edge while keeping the distances between them relatively unchanged. This is usually great for the majority of users, because it’s predictable and even usable in specific cases. However, there must be an option to “unclock” the aforementioned correlation between the 1st and 2nd row of control points and instead let “Match surface” adopt the same distances as the target control points. With that option turned on, the surface to be matched will become perfectly matched to the target one.

To demonstrate the HUGE advantage of a potential “Adopt” option that I just described, here is a simple way to achieve the necessary correlation between the 1st and 2nd row of control points by “mirroring” the distances from the target surface to the opposite one. Lets hope that “McNeel” will consider adding such an option in the future releases of Rhino.

By the way, this particular technique have been already used by you and @jim in your posts above. I also use this technique when necessary, because “mirroring” the distances between the end points is what actually solves many problems with matching two surfaces whose general shape is not close to rectangular. Just like in my example with heavily curved surface edge which I did on purpose to demonstrate the weakness of the “Match surface” tool. Alias does matching much better, so it’s totally possible to make that improvement for Rhino, too. If I remember correctly, even VSR for Rhino 5 had an option to adopt the target surface’s control point structure.

Don’t get me wrong, I love the nature of “Match surface” to basically transfer the entire bunch of 1st, 2nd and 3rd row of control points when G2 curvature continuity is used, because it’s very predictable and usable most of the time. However, there should be an alternative “Adopt” option that will make it possible to set variable distances between the 1st and 2nd row of control points in such way that they will closely repeat (mirror) the same distances and opposite position like the 1st and 2nd row of control points of the target surface.

Ah, ok. Apologies, didn’t read his post properly or download the files.

In ICEM it looks like you can get tangency ok with the ‘control point linear’ setting, which is basically what you guys have done here manually (unfortunately I jumped straight to curvature… ) but to take it further for curvature you’ve just got to up the order. Or as David points out ‘refine match’ will probably be best for most users.

I still think that surface we’re matching in to is pretty horrific and would be surprised to see it on a front bumper for instance.

There are many situations (not only related to car bumpers) where the geometry is non-linear, ansdinclude trimmed and untrimmed surfaces whose shape is similar to the one from my example. In 99% of the cases the distances between 1st row and 2nd row control points wary across the target edge.

By the way, you can still apply G2 curvature matching to the 3rd row of control points after the initial manual matching of the 2nd row of control points to achieve G1 tangency. Once the manual tangency is done, the automatic G2 curvature with the “Match surface” tool is good. It’s pity that at the moment Rhino lacks an “Adopt” option (or “Linear”, which you mentioned is used in ICEM) for the “Match surface” to do that job in a fully automated way.