triangle class implementation