C++ (Qt)qreal PolyAngle( const QPolygonF & poly, int index ){ int count = poly.size(); assert(count > 2); const QPointF & nxt = poly[(index + 1) % count]; const QPointF & prv = poly[(index - 1 + count) % count]; QVector2D v1 = QVector2D(poly[index] - prv).normalized(); QVector2D v2 = QVector2D(nxt - poly[index]).normalized(); return acos(QVector2D ::dotProduct(v1, v2));}