ON_2dVector ON_Ellipse::GradientAt( const ON_2dPoint& p // coordinates in plane ) const { ON_2dVector g; if ( radius[0] != 0.0 && radius[1] != 0.0 ) { g.x = 2.0*p.x/(radius[0]*radius[0]); g.y = 2.0*p.y/(radius[1]*radius[1]); } else { g.Zero(); } return g; }
ON_2dVector ON_Circle::GradientAt( const ON_2dPoint& p // coordinates in plane ) const { ON_2dVector g; if ( radius != 0.0 ) { const double rr = 2.0/(radius*radius); g.x = rr*p.x; g.y = rr*p.y; } else { g.Zero(); } return g; }