void Elastantig(short i , FloatPoint & ctr) { FloatPoint dist = pts[i]-ctr; float d=(float)dist.length(); FloatPoint vectunite=(dist / d); // antigravitation try not to make it n^2 for(int k=0;k<p.agnumparts;k++) { int j = (frames + k + i )%ptsNum; /* if((i==0) &&(k==0)) cout << j << " "; */ if(i!=j) { FloatPoint vect=pts[i]-pts[j]; float d1=(float)vect.length(); float d2=d1; if(d2!=0) { // d include the normalisation for(int k=0; k< p.antigorder;k++) d2=d2*d1; d2=(10*p.ag)/d2; if(d2>p.maxantig) d2=p.maxantig; vect=(vect * d2); if(p.noagexplosion)// just to make a sphere vect= vect - ( vectunite * (vect % vectunite)); speed[i]+= vect ; } else { pts[i][0]+=0.01; } } } float d0=p.d0min+ (((p.dancingpartk*i +frames)%ptsNum<p.dancingpart*ptsNum)?//is it dancing? (heights[(p.dancingpartk*i)%p.numfrq]*p.velocity) :0); float f=-p.k*(d-d0); vectunite = vectunite* f; speed[i]+= vectunite ; speed[i]= speed[i] /p.visc; pts[i]+= speed[i];// /1000; if(p.mode==5) { ctr[2]-=50; } }
bool LayoutSVGEllipse::shapeDependentStrokeContains(const FloatPoint& point) { // The optimized check below for circles does not support non-scaling or // discontinuous strokes. if (m_usePathFallback || !hasContinuousStroke() || m_radii.width() != m_radii.height()) { if (!hasPath()) createPath(); return LayoutSVGShape::shapeDependentStrokeContains(point); } const FloatPoint center = FloatPoint(m_center.x() - point.x(), m_center.y() - point.y()); const float halfStrokeWidth = strokeWidth() / 2; const float r = m_radii.width(); return std::abs(center.length() - r) <= halfStrokeWidth; }