std::vector<double> FittingCylinder::getElementVector (const ON_NurbsSurface &nurbs, int dim) // ! { std::vector<double> result; if (dim == 0) { int idx_min = 0; int idx_max = nurbs.KnotCount (0) - 1; if (nurbs.IsClosed (0)) { idx_min = nurbs.Order (0) - 2; idx_max = nurbs.KnotCount (0) - nurbs.Order (0) + 1; } const double* knotsU = nurbs.Knot (0); result.push_back (knotsU[idx_min]); //for(int E=(m_nurbs.m_order[0]-2); E<(m_nurbs.m_knot_capacity[0]-m_nurbs.m_order[0]+2); E++) { for (int E = idx_min + 1; E <= idx_max; E++) { if (knotsU[E] != knotsU[E - 1]) // do not count double knots result.push_back (knotsU[E]); } } else if (dim == 1) { int idx_min = 0; int idx_max = nurbs.KnotCount (1) - 1; if (nurbs.IsClosed (1)) { idx_min = nurbs.Order (1) - 2; idx_max = nurbs.KnotCount (1) - nurbs.Order (1) + 1; } const double* knotsV = nurbs.Knot (1); result.push_back (knotsV[idx_min]); //for(int F=(m_nurbs.m_order[1]-2); F<(m_nurbs.m_knot_capacity[1]-m_nurbs.m_order[1]+2); F++) { for (int F = idx_min + 1; F <= idx_max; F++) { if (knotsV[F] != knotsV[F - 1]) result.push_back (knotsV[F]); } } else printf ("[FittingCylinder::getElementVector] Error, index exceeds problem dimensions!\n"); return result; }
std::vector<double> FittingSurface::getElementVector (const ON_NurbsSurface &nurbs, int dim) // ! { std::vector<double> result; int idx_min = 0; int idx_max = nurbs.KnotCount (dim) - 1; if (nurbs.IsClosed (dim)) { idx_min = nurbs.Order (dim) - 2; idx_max = nurbs.KnotCount (dim) - nurbs.Order (dim) + 1; } const double* knots = nurbs.Knot (dim); result.push_back (knots[idx_min]); //for(int E=(m_nurbs.Order(0)-2); E<(m_nurbs.KnotCount(0)-m_nurbs.Order(0)+2); E++) { for (int E = idx_min + 1; E <= idx_max; E++) { if (!NEAR_EQUAL(knots[E], knots[E - 1], SMALL_FASTF)) // do not count double knots result.push_back (knots[E]); } return result; }