Added input validation in Triangle constructor.