Converting between Rational and Floating Point KernelFloating point objects can be converted to rational objects, and vice versa. We illustrate conversion for points.If If Remark 1: The conversion from rational objects to floating point
objects needs to be used whenever an object is to be displayed in a window.
If Example:#include <LEDA/graphics/window.h>
#include <LEDA/geo/rat_point.h>
using namespace leda;
int main()
{
rat_point rp(50,50);
window W(100,100);
W.open();
W << rp.to_point();
//W << rp; does not work
W.display();
W.read_mouse();
return 0;
}
Remark 2: We could write |
See also: |