MCPcopy Create free account
hub / github.com/FreeFem/FreeFem-sources / drawCubicBeziers

Function drawCubicBeziers

plugin/seq/plotPDF.cpp:2021–2054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2019 Cx[j] = P[0][0] * Px + P[0][1] * Py;
2020 Cy[j] = P[1][0] * Px + P[1][1] * Py;
2021 }
2022 } // k
2023 return;
2024}
2025
2026void drawCubicBeziers( std::stringstream &Content,
2027 const std::vector< std::vector<double> > &Cxs,
2028 const std::vector< std::vector<double> > &Cys,
2029 const double scale, const double ar, const double x0, const double y0 )
2030{
2031 const double EPS = 1e-10;
2032
2033 std::stringstream &st = Content;
2034
2035 assert( Cxs.size() == Cys.size() );
2036
2037 if( Cxs.size() == 0 ) return; // nothing to draw
2038
2039 for(size_t k = 0; k < Cxs.size(); k++){
2040
2041 const std::vector<double> &px = Cxs[k];
2042 const std::vector<double> &py = Cys[k];
2043
2044 assert( px.size() == py.size() );
2045 assert( ( px.size()-1 ) % 3 == 0 ); // ignore the starting point
2046
2047 st << scale*ar*(px[0]-x0) << ' ' << scale*(py[0]-y0) << " m\n";
2048
2049 // sequential control points
2050 for(size_t j = 1; j < px.size(); j += 3){ // j=0 : starting point
2051
2052 for(int i = 0; i < 3; i++)
2053 st << scale*ar*(px[j+i]-x0) << ' ' << scale*(py[j+i]-y0) << ' ';
2054 st << "c\n";
2055 }
2056 st << "S\n";
2057 } // k

Callers 1

plot_P2_isoline_bodyFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected