calculate extreme points
calculate extreme points