public static void quadToRectRot( Quadrilateral_F64 q , RectangleRotate_F32 r ) {
double centerX = (q.a.x + q.b.x + q.c.x + q.d.x)/4.0;
double centerY = (q.a.y + q.b.y + q.c.y + q.d.y)/4.0;
double topX = (q.a.x + q.b.x)/2.0;
double topY = (q.a.y + q.b.y)/2.0;
double sideX = (q.b.x + q.c.x)/2.0;
double sideY = (q.b.y + q.c.y)/2.0;
r.cx = (float)centerX;
r.cy = (float)centerY;
r.height = 2*(float)UtilPoint2D_F64.distance(topX,topY,centerX,centerY);
r.width = 2*(float)UtilPoint2D_F64.distance(sideX,sideY,centerX,centerY);
r.theta = (float)Math.atan2( sideY - centerY , sideX - centerX );
}