- static vector<Point> profile;
- if(profile.empty())
- {
- profile.push_back(Point(0, -0.02, 0));
- profile.push_back(Point(0, -0.014, 0.008));
- profile.push_back(Point(0, -0.014, 0.008));
- profile.push_back(Point(0, 0.014, 0.008));
- profile.push_back(Point(0, 0.014, 0.008));
- profile.push_back(Point(0, 0.02, 0));
- for(unsigned i=0; i<2; ++i)
- {
- profile.push_back(Point(0, -0.009+i*0.017, 0.008));
- profile.push_back(Point(0, -0.009+i*0.017, 0.0103));
- profile.push_back(Point(0, -0.009+i*0.017, 0.0103));
- profile.push_back(Point(0, -0.008+i*0.017, 0.0103));
- profile.push_back(Point(0, -0.008+i*0.017, 0.0103));
- profile.push_back(Point(0, -0.008+i*0.017, 0.008));
- }
- profile.push_back(Point(0, -0.002, 0.012));
- profile.push_back(Point(0, 0.002, 0.012));
- }
- static unsigned psize=profile.size();
-
- const float &radius=part.radius;
- const float &x=part.x;
- const float &y=part.y;
- const float &length=part.length;
- const float &dir=part.dir;
-
- unsigned nsegs;
- if(radius)
- {
- nsegs=static_cast<unsigned>(part.length*(1<<quality))+1;
- Point center(x-sin(dir)*radius, y+cos(dir)*radius, 0);
- float r=fabs(radius);
- float start=((radius<0)?M_PI:0)+dir;
- float angle=(radius<0)?-length:length;
- int inv=(radius<0)?-1:1;
- for(unsigned i=0; i<=nsegs; ++i)
- {
- float a=start+i*angle/nsegs;
- float c=cos(a);
- float s=sin(a);