// process distance of center of gravity between two GeoObjs
Coord distance (GeoObj const& x1, GeoObj const& x2)
{
    Coord c = x1.center_of_gravity() - x2.center_of_gravity();
    return c.abs();        // return coordinates as absolute values
}
Ejemplo n.º 2
0
// Abstand zwischen zwei geometrischen Objekten berechnen
Koord abstand (const GeoObj& x1, const GeoObj& x2) {
    Koord a = x1.position() - x2.position();
    return a.abs();
}
// draw any GeoObj
void myDraw (GeoObj const& obj)
{
    obj.draw();            // call draw() according to type of object
}
Ejemplo n.º 4
0
// beliebiges geometrisches Objekt zeichnen
void zeichne (const GeoObj& obj) {
    obj.draw();
}