Fix memory error

The Triangle class was holding references to elements of the
std::vector<Point> ... these references can become stale if the vector
is resized, leading to memory garbage. New code keeps reference to the
vector itself and obtains elements directly when needed.