void rotateshape(shape & s, double rotation) { for (shapeIterator shapeIter = s.begin(); shapeIter != s.end(); ++shapeIter) { (*shapeIter).argument ((*shapeIter).argument() + rotation); } }
void write_shape(shape const & s, std::ostream &streamToWriteTo) { streamToWriteTo << s.size() << "\n"; for (constShapeIterator shapeIter = s.begin(); shapeIter != s.end(); ++shapeIter) { send_to (*shapeIter, streamToWriteTo); streamToWriteTo << "\n"; } }
void sheershape(shape & s, double sheer) { for (shapeIterator shapeIter = s.begin(); shapeIter != s.end(); ++shapeIter) { double newArgument = (*shapeIter).argument() + sheer; //we just need to change the x so that it's angle is changed, while maintaining the y as it is. double newModulus = (*shapeIter).modulus() * sin (radians((*shapeIter).argument())) / sin (radians(newArgument)); (*shapeIter).argument (newArgument); (*shapeIter).modulus (newModulus); } }