NUBRS Retaliation Compensation Deformation Call Integrated Model Code 2 (Direct Integration System, Export without File Import)
NUBRS Retaliation Compensation Deformation Call Integrated Model Code 2 (Direct Integration System, Export without File Import)
This method of integration does not export data through file import, integrates directly into third-party systems, users read raw grid data in their own systems, deformed grid data, original curve data, transfer these data to api to calculate, and, upon completion, acquire deformed surface data to be used directly in the system.
User uses std: :vector's own definition of NURB profile data structure as follows
NURBS Curve Physical Definition (clip line for the construction of the cropping face)
typedef struct RsNurbCurveV{int degree; Number of timesint n; Number of control pointsstd::vector<double> knot; / Knot vectorstd::vector<double> xcpt; x-coordinate of top pointstd::vector<double> ycpt; // Control the y-coordinate of the top pointstd::vector<double> zcpt; x-coordinates for top point/controlstd::vector<double> weight; / Control the power of the top point* Curve dimensions */int dim;*/int isrational;double start; / Define a field starting pointdouble end; / Define a domain endpoint} RsNurbCurveV;
Definition of NuRBS curved entities:
typedef struct RsNurbSurfaceV{int u_num; * Control point in U direction */int v_num; * Number of control points in V direction */int u_degree; * Number of curves in U direction */int v_degree; * Number of curves in V direction */std::vector<double> u_knot; /*U-direction knot vector, from 0 to u num + u degree + 1. For example, 3 times 5 control point knot vector u degree + 1 time repeats u u degree + 1 time clamped type: (0, 0, 0, 0.5, 1, 1, 1, 1)*/std::vector<double> v_knot; /* Knot vector in V direction. From 0 to v num + v degree +1 */double u_start; / * U-defined domain starting */double u_end; * U-defined domain endpoint*/double v_start; / * V-defined domain starting point*/double v_end; / * V-Definition Domain Terminal*// ** Control point (x,y,z). From (0,0) to (u num-1, v num-1)*/std::vector<double> xCpoint ;std::vector<double> yCpoint ;std::vector<double> zCpoint ;/ ** Control the weight of the top point. Follow V.From (0,0) to (u num-1, v num-1).*/std::vector<double> weight;int isrational; /* 0 = multiple B-sample. 1 = logical B-sample. */int istrim; /* 0 = = non-refined face; 1 = */std::vector<std::vector<RsNurbCurveV>> loopcurves; /* 2d shear curves on the side of the crop, the length of which equals the number of rings*/std::vector<std::vector<RsNurbCurveV>> loop3dcurves; /*No data.I don't know. 3d shear curves on the surface of the crop, which is equal toNumber of rings */std::vector<std::vector<int>> isotags ; /*Data may not be available. Determines whether the shearing curve is equal to the parametric line. Numerical length = curvenum; 3: The line is the western equal parameter line; 4: The line is the southern equal parameter line; 5: The line is the eastern equal parameter line; 6: The line is the northern equal parameter line; 0: The line is not equal to the parametric line. 7: The same parameter line is not on edge; this is an option */}RsNurbSurfaceV;
The following figure shows the non-cut side
In ResurfLib, the control point data storage for all NURB curves isStore in V-direction orderYeah. The control point, marked from 0 to 48 below, is stored along the direction of v, as shown in the figure below.

As shown in the figure below, the black part of the figure is the cut side, with the numbering on the curve and the green part is the numbering on the two-dimensional parameter area, which corresponds to the numbering of the three-dimensional shearing curve. 2-D rectangle is a curved parameter area.

Users pass their grid data, surface data into the API model code
The following codes are used:
Resurflib part:
ResurfNurbsLib.dll
ResurfSurfmap.dll
Operating environment component:
tbb12.dll
- #pragma comment(lib,"ResurfNurbsLib.lib")
#pragma comment(lib,"ResurfSurfmap.lib")
#include "surffrommesh.h"
#include "resurffillhole.h"
#include "resurfsurfacemapping.h"
#include "surfmap_resurflicensekey.h"std::vector<RsNurbSurfaceV> nurbs; // Raw Curve Datastd::vector<RsNurbSurfaceV> nbs; / / Transforming New Curvedouble* xScat, * yScat, * zScat;/ (xScat[i], yScat[i], zScat[i]) is the coordinates of the original grid vertexdouble* xMorph, * yMorph, * zMorph;/ (xMorph[i], yMorph[i], zMorph[i]) is the coordinates of the top points of the deformed gridint nodesize;the number of / top points, and the length of the top point arrayint elemsize; Number of unitsint(*elems)[4]; // Index numbers for each unit (elems [i] [0], elems [i] [1], elems [i] [2], elems [i] [3]) indicate a vertex index number for the first unit (starting with 0), in the case of a triangle unit, elems [i] [3] =-1/ /... here the user constructs the surface data, grid datasurfmap_start();surfmap_set_origmesh(xScat, yScat, zScat, nodesize, elems, elemsize);//input raw grid datasurfmap_set_newmesh(xMorph, yMorph, zMorph, nodesize, elems, elemsize);// Plug in deformation grid datafor (size_t i = 0; i < nurbs.size(); ++i){surfmap_AppendNurbsData(nurbs[i].xCpoint.data(), nurbs[i].yCpoint.data(), nurbs[i].zCpoint.data(),nurbs[i].weight.data(), nurbs[i].u_num, nurbs[i].v_num, nurbs[i].isrational,nurbs[i].u_degree, nurbs[i].v_degree, nurbs[i].u_knot.data(), nurbs[i].v_knot.data() // Add a NURBS surface to ResurfLib.if (nurbs[i].loopcurves.size() > 0)There's a clipping on this side.{for (size_t j = 0; j < nurbs[i].loopcurves.size(); ++j){surfmap_Append2DLoop_start(); / Start with this clippingfor (size_t k = 0; k < nurbs[i].loopcurves[j].size(); ++k){//Put this cropring with a 2D crop curvesurfmap_Append2DNurbCurveInLoop(nurbs[i].loopcurves[j][k].xcpt.data(),nurbs[i].loopcurves[j][k].ycpt.data(),nurbs[i].loopcurves[j][k].weight.data(),nurbs[i].loopcurves[j][k].n,nurbs[i].loopcurves[j][k].isrational,nurbs[i].loopcurves[j][k].degree,nurbs[i].loopcurves[j][k].knot.data());}}surfmap_Append2DLoop_end();All clippings have been added. Over.}}// Start calculating deformationssurfmap_setFeed(1.0);if (!surfmap_domap()){surfmap_end(); return; Failed to transform}int facecount = surfmap_GetNewFaceCount(); / Number of curves successfully deformedif (facecount <= 0){surfmap_end(); return;}nbs.resize(facecount);for (int ni = 0; ni < facecount; ++ni){int unum = 0, vnum = 0, ud = 0, vd = 0;double* uknot = NULL, * vknot = NULL, * xc = NULL, * yc = NULL, * zc = NULL;//Retrieving data on a new curvesurfmap_GetNurbs(ni, &unum, &vnum, &ud, &vd, &uknot, &vknot, &xc, &yc, &zc);int size = unum * vnum;for (int i = 0; i < size; ++i){nbs[ni].xCpoint.push_back(xc[i]);nbs[ni].yCpoint.push_back(yc[i]);nbs[ni].zCpoint.push_back(zc[i]);}for (int i = 0; i < (unum + ud + 1); ++i){nbs[ni].u_knot.push_back(uknot[i]);}for (int i = 0; i < (vnum + vd + 1); ++i){nbs[ni].v_knot.push_back(vknot[i]);}nbs[ni].u_num = unum; nbs[ni].v_num = vnum;nbs[ni].u_degree = ud; nbs[ni].v_degree = vd;nbs[ni].u_start = uknot[ud]; nbs[ni].u_end = uknot[unum];nbs[ni].v_start = vknot[vd]; nbs[ni].v_end = vknot[vnum];nbs[ni].isrational = 0;surfmap_ResurfLibFreeMemory(uknot);surfmap_ResurfLibFreeMemory(vknot);surfmap_ResurfLibFreeMemory(xc);surfmap_ResurfLibFreeMemory(yc);surfmap_ResurfLibFreeMemory(zc);/ How many tailors for this new side Ringint loopcount = surfmap_GetLoopCount(ni);if (loopcount <= 0) continue;nbs[ni].loopcurves.resize(loopcount);for (int j = 0; j < loopcount; ++j){/ / j cropring how many 2d crop surface dataint curvecount = surfmap_Get2DTrimmingCurveCount(ni, j);nbs[ni].loopcurves[j].resize(curvecount);for (int k = 0; k < curvecount; ++k){int ctrlp_num = 0;int degree = 3;double* knot = NULL, * cpx = NULL, * cpy = NULL;//Retrieving article k2d of j shearringsurfmap_Get2DTrimmingCurve(ni, j, k, &ctrlp_num, °ree, &knot, &cpx, &cpy);for (int ki = 0; ki < ctrlp_num; ++ki){nbs[ni].loopcurves[j][k].xcpt.push_back(cpx[ki]);nbs[ni].loopcurves[j][k].ycpt.push_back(cpy[ki]);nbs[ni].loopcurves[j][k].zcpt.push_back(0);}for (int ki = 0; ki < (ctrlp_num + degree + 1); ++ki){nbs[ni].loopcurves[j][k].knot.push_back(knot[ki]);}nbs[ni].loopcurves[j][k].n = ctrlp_num;nbs[ni].loopcurves[j][k].degree = degree;nbs[ni].loopcurves[j][k].isrational = 0;nbs[ni].loopcurves[j][k].start = knot[degree];nbs[ni].loopcurves[j][k].end = knot[ctrlp_num];surfmap_ResurfLibFreeMemory(knot);surfmap_ResurfLibFreeMemory(cpx);surfmap_ResurfLibFreeMemory(cpy);}}}surfmap_end();