Suppose you have a nurbs_surf as:
ON_NurbsSurface* nurbs_surf
You can then convert it to bezier patches according to the span_index.
nurbs_surf->ConvertSpanToBezier(span_index0,span_index1,bezier_surface)
my question is that does openNURBS provide topological information about these bezier patches? for example what are the neighbouring bezier patches and etc?
Tags:
Hi Mohammad,
No it does not. But it shouldn't be hard to keep track of neighboring patches yourself.
--
ON_NurbsSurface srf = ...;
for (u = 0; u <= srf.CVCount(0)-srf.Order(0); u++)
{
for (v = 0; v <= srf.CVCount(1)-srf.Order(1); v++)
{
ON_BezierSurface bez;
if (srf.ConvertSpanToBezier(u, v, bez))
{
// todo...
}
}
}
--
-- Dale
Hi Dale,
Thanks. But how can I figure out if the current bez (in the nested loop) is a neighbour of the previous bez or not?
Perhaps you should store the results in a 2-d array. Or, store the results in some custom data structure that also maintains the indices of its neighbors.
-- Dale
I rephrase my question. Suppose I have 2 bezier patches
ON_BezierSurface bez1,bez2;
How can I tell if these 2 are neighbours or not.
Like I said, openNURBS does not provide topological information for this. If you wnat to keep track of which patches are neighbors, you will have to do it yourself.
Not sure how to make this more clear...
-- Dale
Hi Again,
Following the code you provided above in the line //todo...,I know that I can get the points of the bezier patch using "s" and "t" as below:
ON_3dPoint point = bez.PointAt( s, t);
However, I am not sure what is the min and max values of s and t. In particular, If I want to get the 4 vertices of a quadrilateral bezier patch, what values of s and t should I choose?
Hi Mohammad,
Get get min/max interval in each direction, use ON_BezierSurface::Domain.
-- Dale
Hi Dale, Thanks for all the help so far, another geometry related question: When I load an object of ONX_Model, how can I make sure that all the corresponding bezier surfaces, have the same face orientation (Dir)? In particular, I am creating a cube which has all the normals outgoing, but when I read the .3dm file using opennurbs, one of the faces has normals going into the box, and the 5 others going out. How can I flip that one faulty face?
Hi Mohammad,
My guess is your cube is an ON_Brep, correct? If this is the case, then you can flip the normal direction of a face by setting ON_BrepFace::m_bRev to true. If the Brep is solid, then read the comments on opennurbs_brep.h for the SolidOrientation member.
-- Dale
© 2015 Created by McNeel Admin.