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)

  1. typedef struct RsNurbCurveV
  2. {
  3. int degree; Number of times
  4. int n; Number of control points
  5. std::vector<double> knot; / Knot vector
  6. std::vector<double> xcpt; x-coordinate of top point
  7. std::vector<double> ycpt; // Control the y-coordinate of the top point
  8. std::vector<double> zcpt; x-coordinates for top point/control
  9. std::vector<double> weight; / Control the power of the top point
  10. * Curve dimensions */
  11. int dim;
  12. */
  13. int isrational;
  14. double start; / Define a field starting point
  15. double end; / Define a domain endpoint
  16. } RsNurbCurveV;

Definition of NuRBS curved entities:

  1. typedef struct RsNurbSurfaceV
  2. {
  3. int u_num; * Control point in U direction */
  4. int v_num; * Number of control points in V direction */
  5. int u_degree; * Number of curves in U direction */
  6. int v_degree; * Number of curves in V direction */
  7. 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)*/
  8. std::vector<double> v_knot; /* Knot vector in V direction. From 0 to v num + v degree +1 */
  9. double u_start; / * U-defined domain starting */
  10. double u_end; * U-defined domain endpoint*/
  11. double v_start; / * V-defined domain starting point*/
  12. double v_end; / * V-Definition Domain Terminal*/
  13. / ** Control point (x,y,z). From (0,0) to (u num-1, v num-1)*/
  14. std::vector<double> xCpoint ;
  15. std::vector<double> yCpoint ;
  16. std::vector<double> zCpoint ;
  17. / ** Control the weight of the top point. Follow V.From (0,0) to (u num-1, v num-1).*/
  18. std::vector<double> weight;
  19. int isrational; /* 0 = multiple B-sample. 1 = logical B-sample. */
  20. int istrim; /* 0 = = non-refined face; 1 = */
  21. std::vector<std::vector<RsNurbCurveV>> loopcurves; /* 2d shear curves on the side of the crop, the length of which equals the number of rings*/
  22. 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 */
  23. 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 */
  24. }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.

nurbs

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.
trimsrf

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

  1. #pragma comment(lib,"ResurfNurbsLib.lib")

    #pragma comment(lib,"ResurfSurfmap.lib")

    #include "surffrommesh.h"

    #include "resurffillhole.h"

    #include "resurfsurfacemapping.h"
    #include "surfmap_resurflicensekey.h"

  2. std::vector<RsNurbSurfaceV> nurbs; // Raw Curve Data
  3. std::vector<RsNurbSurfaceV> nbs; / / Transforming New Curve
  4. double* xScat, * yScat, * zScat;/ (xScat[i], yScat[i], zScat[i]) is the coordinates of the original grid vertex
  5. double* xMorph, * yMorph, * zMorph;/ (xMorph[i], yMorph[i], zMorph[i]) is the coordinates of the top points of the deformed grid
  6. int nodesize;the number of / top points, and the length of the top point array
  7. int elemsize; Number of units
  8. int(*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
  9. / /... here the user constructs the surface data, grid data
  10. surfmap_start();
  11. surfmap_set_origmesh(xScat, yScat, zScat, nodesize, elems, elemsize);//input raw grid data
  12. surfmap_set_newmesh(xMorph, yMorph, zMorph, nodesize, elems, elemsize);// Plug in deformation grid data
  13. for (size_t i = 0; i < nurbs.size(); ++i)
  14. {
  15. surfmap_AppendNurbsData(nurbs[i].xCpoint.data(), nurbs[i].yCpoint.data(), nurbs[i].zCpoint.data(),
  16. nurbs[i].weight.data(), nurbs[i].u_num, nurbs[i].v_num, nurbs[i].isrational,
  17. nurbs[i].u_degree, nurbs[i].v_degree, nurbs[i].u_knot.data(), nurbs[i].v_knot.data() // Add a NURBS surface to ResurfLib.
  18. if (nurbs[i].loopcurves.size() > 0)There's a clipping on this side.
  19. {
  20. for (size_t j = 0; j < nurbs[i].loopcurves.size(); ++j)
  21. {
  22. surfmap_Append2DLoop_start(); / Start with this clipping
  23. for (size_t k = 0; k < nurbs[i].loopcurves[j].size(); ++k)
  24. {
  25. //Put this cropring with a 2D crop curve
  26. surfmap_Append2DNurbCurveInLoop(nurbs[i].loopcurves[j][k].xcpt.data(),
  27. nurbs[i].loopcurves[j][k].ycpt.data(),
  28. nurbs[i].loopcurves[j][k].weight.data(),
  29. nurbs[i].loopcurves[j][k].n,
  30. nurbs[i].loopcurves[j][k].isrational,
  31. nurbs[i].loopcurves[j][k].degree,
  32. nurbs[i].loopcurves[j][k].knot.data());
  33. }
  34. }
  35. surfmap_Append2DLoop_end();All clippings have been added. Over.
  36. }
  37. }
  38. // Start calculating deformations
  39. surfmap_setFeed(1.0);
  40. if (!surfmap_domap())
  41. {
  42. surfmap_end(); return; Failed to transform
  43. }
  44. int facecount = surfmap_GetNewFaceCount(); / Number of curves successfully deformed
  45. if (facecount <= 0)
  46. {
  47. surfmap_end(); return;
  48. }
  49. nbs.resize(facecount);
  50. for (int ni = 0; ni < facecount; ++ni)
  51. {
  52. int unum = 0, vnum = 0, ud = 0, vd = 0;
  53. double* uknot = NULL, * vknot = NULL, * xc = NULL, * yc = NULL, * zc = NULL;
  54. //Retrieving data on a new curve
  55. surfmap_GetNurbs(ni, &unum, &vnum, &ud, &vd, &uknot, &vknot, &xc, &yc, &zc);
  56. int size = unum * vnum;
  57. for (int i = 0; i < size; ++i)
  58. {
  59. nbs[ni].xCpoint.push_back(xc[i]);
  60. nbs[ni].yCpoint.push_back(yc[i]);
  61. nbs[ni].zCpoint.push_back(zc[i]);
  62. }
  63. for (int i = 0; i < (unum + ud + 1); ++i)
  64. {
  65. nbs[ni].u_knot.push_back(uknot[i]);
  66. }
  67. for (int i = 0; i < (vnum + vd + 1); ++i)
  68. {
  69. nbs[ni].v_knot.push_back(vknot[i]);
  70. }
  71. nbs[ni].u_num = unum; nbs[ni].v_num = vnum;
  72. nbs[ni].u_degree = ud; nbs[ni].v_degree = vd;
  73. nbs[ni].u_start = uknot[ud]; nbs[ni].u_end = uknot[unum];
  74. nbs[ni].v_start = vknot[vd]; nbs[ni].v_end = vknot[vnum];
  75. nbs[ni].isrational = 0;
  76. surfmap_ResurfLibFreeMemory(uknot);
  77. surfmap_ResurfLibFreeMemory(vknot);
  78. surfmap_ResurfLibFreeMemory(xc);
  79. surfmap_ResurfLibFreeMemory(yc);
  80. surfmap_ResurfLibFreeMemory(zc);
  81. / How many tailors for this new side Ring
  82. int loopcount = surfmap_GetLoopCount(ni);
  83. if (loopcount <= 0) continue;
  84. nbs[ni].loopcurves.resize(loopcount);
  85. for (int j = 0; j < loopcount; ++j)
  86. {
  87. / / j cropring how many 2d crop surface data
  88. int curvecount = surfmap_Get2DTrimmingCurveCount(ni, j);
  89. nbs[ni].loopcurves[j].resize(curvecount);
  90. for (int k = 0; k < curvecount; ++k)
  91. {
  92. int ctrlp_num = 0;
  93. int degree = 3;
  94. double* knot = NULL, * cpx = NULL, * cpy = NULL;
  95. //Retrieving article k2d of j shearring
  96. surfmap_Get2DTrimmingCurve(ni, j, k, &ctrlp_num, &degree, &knot, &cpx, &cpy);
  97. for (int ki = 0; ki < ctrlp_num; ++ki)
  98. {
  99. nbs[ni].loopcurves[j][k].xcpt.push_back(cpx[ki]);
  100. nbs[ni].loopcurves[j][k].ycpt.push_back(cpy[ki]);
  101. nbs[ni].loopcurves[j][k].zcpt.push_back(0);
  102. }
  103. for (int ki = 0; ki < (ctrlp_num + degree + 1); ++ki)
  104. {
  105. nbs[ni].loopcurves[j][k].knot.push_back(knot[ki]);
  106. }
  107. nbs[ni].loopcurves[j][k].n = ctrlp_num;
  108. nbs[ni].loopcurves[j][k].degree = degree;
  109. nbs[ni].loopcurves[j][k].isrational = 0;
  110. nbs[ni].loopcurves[j][k].start = knot[degree];
  111. nbs[ni].loopcurves[j][k].end = knot[ctrlp_num];
  112. surfmap_ResurfLibFreeMemory(knot);
  113. surfmap_ResurfLibFreeMemory(cpx);
  114. surfmap_ResurfLibFreeMemory(cpy);
  115. }
  116. }
  117. }
  118. surfmap_end();

Back to top