Class triangle implementation