Beispiel #1
0
	void rotateshape(shape & s, double rotation)
    {
        for (shapeIterator shapeIter = s.begin(); shapeIter != s.end(); ++shapeIter)
        {
            (*shapeIter).argument ((*shapeIter).argument() + rotation);
        }
    }
Beispiel #2
0
	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";
        }
    }
Beispiel #3
0
    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);
        }
    }