我在Android Studio中使用c ++。但是,当我运行以下代码时:
int GetAngleABC(Point a, Point b, Point c)
{
Point ab = { b.x - a.x, b.y - a.y };
Point cb = { b.x - c.x, b.y - c.y };
float dot = (ab.x * cb.x + ab.y * cb.y); // dot product
float cross = (ab.x * cb.y - ab.y * cb.x); // cross product
float alpha = atan2(cross, dot);
return (int)floor(alpha * 180.0 / CV_PI + 0.5);
}
Studio输出错误消息:
错误:(30,11)错误:非聚合类型'Point'(又名'Point_')无法使用初始化列表初始化
错误点是:
点ab = {b.x - a.x,b.y - a.y}; Point cb = {b.x - c.x,b.y - c.y};