i did it!!! with your guidance for the past 3 years+, i managed to do this just now! LOL ;D ;D

// inside both magnet1&2
if ((xCompass<(xMagnet+Magnetsizex/2) && xCompass>(xMagnet-(Magnetsizex/2)) && yCompass<(yMagnet+Magnetsizey/2) && yCompass>(yMagnet-Magnetsizey/2))&&(xCompass<(xMagnet2+Magnetsizex2/2) && xCompass>(xMagnet2-(Magnetsizex2/2)) && yCompass<(yMagnet2+Magnetsizey2/2) && yCompass>(yMagnet2-Magnetsizey2/2)))
{
//test = true;
// create uniform field
bxField = (lcst*(225*cs-0*sc)+rcst*(225*cs2-0*sc2))*vectorfieldmaxopposite/100; // saturate to direction of magnet Bx'=0 for both magnets
byField = (lcst*(225*sc+0*cs)+rcst*(225*sc2+0*cs2))*vectorfieldmaxopposite/100;//saturate to direction of magnet By' =0 for both magnets

}
//inside magnet1
else if (xCompass<(xMagnet+Magnetsizex/2) && xCompass>(xMagnet-(Magnetsizex/2)) && yCompass<(yMagnet+Magnetsizey/2) && yCompass>(yMagnet-Magnetsizey/2))
{
//test = false;
bxField = (lcst*(225*cs-0*sc)+rcst*(bf2[0]*cs2-bf2[1]*sc2))*vectorfieldmaxopposite/100;// uniform B1x=225 but B2x still calculate normally
byField = (lcst*(225*sc+0*cs)+rcst*(bf2[0]*sc2+bf2[1]*cs2))*vectorfieldmaxopposite/100;//uniform B1y=0 but B2y still calculate normally
}

// inside magnet2
else if (xCompass<(xMagnet2+Magnetsizex2/2) && xCompass>(xMagnet2-(Magnetsizex2/2)) && yCompass<(yMagnet2+Magnetsizey2/2) && yCompass>(yMagnet2-Magnetsizey2/2))
{
//test = false;
bxField = (lcst*(bf1[0]*cs-bf1[1]*sc)+rcst*(225*cs2-0*sc2))*vectorfieldmaxopposite/100;// calculate normally B1x but B2x = 225 uniform
byField = (lcst*(bf1[0]*sc+bf1[1]*cs)+rcst*(225*sc2+0*cs2))*vectorfieldmaxopposite/100;//calculate normally B1y but B2y = 0 uniform
}

else
{
//  test=false;
bxField = lcst*(bf1[0]*cs-bf1[1]*sc)+rcst*(bf2[0]*cs2-bf2[1]*sc2);//FKH
byField = lcst*(bf1[0]*sc+bf1[1]*cs)+rcst*(bf2[0]*sc2+bf2[1]*cs2);//FKH
}

Thanks again Prof Hwang! your forum rocks!