I want to draw hundreds of 2D triangles(with labels) simultaneously in python+matplotlib, so I'm going to put these triangles in a list:
triangles =[ (label_1, A, B, C) , (label_2, D,E,F),...]
Here in (label , A, B, C), A,B,C be the three vertices of the triangle, so they are like pairs of real numbers like (x,y), and label might be a string(the color or the name of the triangle)
Now the question arise: how do I tell python that A=(x,y) is a point in the plane, not merely a "tuple of two elements" ? Since I need to do the operation "A+0.2*B", this results the error: "can't multiply sequence by non-int of type 'float'
Thanks in advance!
You could create a custom
Point
class, and define behavior for addition and multiplication: