fixed prim/ocr optimization, angle function