The class Point3d.
There are three different classes of Point according to the dimension:
They are read write attributes. It means that they are accessible directly without any member function. For example:
Point2d p; p.x=5; p.y=12; std::cout << p.y << std::endl;
Point2d p1; // = Point2d p1(0,0) p1=1; // p1.x = p1.y = 1 Point2d p2(12,24); Dimension d(50,100); Point2d p3(d); // =Point(50,100) Point2d *p4 = new Point2d(3); // p4->x = p4->y = 3;
Point2d p1(5,10), p2;
if (p1==p2 || p1==1) {
p1+=p2; p2+=2+p1;
p1*=p2; p2*=2;
}
Point p;
p.SaveFile("foobar.pan");
To load a point from a file, just use:
Point p;
p.LoadFile("foobar.pan");
Generally, a point is not saved directly in a file but by the way of a collection. To save and load a point in a collection, use:
Collection cold; Point2d *p1=new Point2d(10,20),*p2; cold.SETPOBJECT("bar",Point2d,p1); p2=(Point2d*)cold.GETPOBJECT("bar",Point2d);
To save and load an array of points in a collection, use:
Point2d **p3=new Point2d*[12], **p4; for (int i=0; i<12; i++) p3[i]=new Point2d(i,i); cold.SETPARRAY("foo",Point2d,p3,12); p4=(Point2d**)cols.GETPARRAY("foo",Point2d); std::cout << "Coordinates: " << p4[11]->x << "," << p4[11]->y << std::endl;