# W to convert rational nurbs surface into non rational nurbs surfce in opennurbs

Please suggest any method other than pNurbsSurface->makenonrational()

Hi Vamsi,

Why not use `ON_NurbsSurface::MakeNonRational()`? What problem are you trying to solve? Any additional details you can provide might help us help you find a solution.

Thanks,

β Dale

1 Like

Hi Dale,
I need to convert a surface from rational to non rational form. After conversation the surface should almost look like earlier one with tolerance. Suppose if I convert a rational circle to a non rational curve, the curve should almost look like a circle. Which means number of control point will be more in non rational curve after conversion.
Thanks and Regards,
VK.

Do you want to Fit a new non-rational curve to the old rational curve? http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_Fit.htm

1 Like

Thanks for replying. I want fit a rational surface into a new non rational surface.

I think this will do itβ¦

``````/*
Description:
Fits a new surface through an existing surface.
Parameters:
surface_in - [in] the surface to fit.
udegree - [in] the output surface U degree. Must be bigger than 1.
vdegree - [in] the output surface V degree. Must be bigger than 1.
dFitTol - [in] the fitting tolerance.
If dFitTol is ON_UNSET_VALUE or <=0.0, the document absolute tolerance is used.
pAchievedTol - [out] if not NULL this will be used for the achieved tolerance.
pAchievedTol is always <= dFitTol.
Returns:
pointer to surface if success.
NULL if unsuccessful.
Notes:
*/
RHINO_SDK_FUNCTION
ON_Surface* RhinoFitSurface(
const ON_Surface& surface_in,
int udegree = 3,
int vdegree = 3,
double dFitTol = ON_UNSET_VALUE,
double* pAchievedTol = nullptr);
``````
1 Like

If you are using openNURBS in the context of the Rhino C++ SDK, then the `RhinoFitSurface` function might be what you need.

If you using the standalone openNURBS toolkit, then we do not have a solution for as the toolkit does not include a surface fitter. I guess you will have to keep adding knots to the original surface until the conversion meets the tolerance requirement.

β Dale

1 Like

A post was split to a new topic: Get degree of NURBS surface