Interface0DIterator Curve::verticesEnd() { return pointsEnd(0); }
void PolyBezierCurve::generateSamplePoints( const curvedef::MapEvaluators & evalMap, const int & rate ) { assert( !evalMap.empty() ); mathdef::resize( m_samplePoints, rate * getNumSegments() + 1 ); mathdef::setZero( m_samplePoints ); // Evaluate the first point on the first curve, then // Loop through all segment to sample 1st sample to last sample. resetToFirstSegment(); int samp_i = 0; // Sample temp index int j; curvedef::Degree deg; VectorX2s segCtrlPts; while (m_iter != pointsEnd()) { deg = getSegmentDegree( m_currentSegment ); const BezierEvaluator & evaluator = evalMap.find( deg )->second; assert( evaluator.isBasesComputed() ); assert( deg > 0); segCtrlPts = m_controlPoints.block( m_iter.getCurrentRow(), 0, deg + 1, 2 ); // Compute first end point if we are at first segment if (m_currentSegment == 0) { j = 0; // std::cout << "eval first t = " << computeParameterT(j, rate) << ": " << std::endl; setSamplePoint(samp_i, evaluator.eval(segCtrlPts, j)); // std::cout << m_samplePoints.block(samp_i, 0, 1, 2) << std::endl; ++samp_i; } j = 1; while (j <= rate) { // Sample segment point from index 1 to rate // std::cout << "eval t = " << computeParameterT(j, rate) << ": " << std::endl; setSamplePoint(samp_i, evaluator.eval(segCtrlPts, j)); // std::cout << m_samplePoints.block(samp_i, 0, 1, 2) << std::endl; ++samp_i; ++j; } advanceSegment(); } // // int segment = 0; // Segment index // int samp_i = 0; // Sample temp index // int ctrl_i = 0; // Control point temp index // int j; // curvedef::Degree deg; int numPts; // VectorX2s segCtrlPts; // while (segment < getNumSegments()) // { // deg = getSegmentDegree( segment ); // const BezierEvaluator & evaluator = evalMap.find( deg )->second; // // assert( evaluator.isBasesComputed() ); // assert( deg > 0); // // std::cout << "CONTROL POINTS:\n" << m_controlPoints << std::endl; // std::cout << "deg, ctrl_i, samp_i: " << deg << " " << ctrl_i << " " << samp_i << std::endl; // std::cout << m_controlPoints.block( ctrl_i, 0, deg + 1, 2) << std::endl; // // segCtrlPts = m_controlPoints.block( ctrl_i, 0, deg + 1, 2); // // // Compute first end point if we are at first segment // if (segment == 0) // { // j = 0; // std::cout << "eval first t = " << computeParameterT(j, rate) << ": " << std::endl; // setSamplePoint(samp_i, evaluator.eval(segCtrlPts, j)); // std::cout << m_samplePoints.block(samp_i, 0, 1, 2) << std::endl; // ++samp_i; // } // // j = 1; // while (j <= rate) // { // // Sample segment point from index 1 to rate // std::cout << "eval t = " << computeParameterT(j, rate) << ": " << std::endl; // setSamplePoint(samp_i, evaluator.eval(segCtrlPts, j)); // std::cout << m_samplePoints.block(samp_i, 0, 1, 2) << std::endl; // ++samp_i; // ++j; // } // // ctrl_i += deg; // ++segment; // } }