|
|
|
|
|
by Someone
4074 days ago
|
|
No, you add the lengths of the sides. That's type-safe and generalizes from rectangles with edges parallel to the x and y axes to general polygons: perimeter = poly.edges.map(length).sum()
Height and width have (implicit) direction; length doesn't.But yes, this will get hairy. For convenience, you want the ability to add heights, but that only makes sense in some cases. Two 100m high skyscrapers only make a 200m high skyscraper if you place one on top of the other. |
|