8 #include "transforms.hh"
10 double Point::planedistance= 1.0;
11 double Point::eyedistance= 1.0;
12 double Point::cutoffdistance= 10.0;
13 double Point::eyex= 0.0;
15 TransformList Point::usertransforms;
16 TransformList Point::povtransform;
18 Point TransformList::operator()(Point it) {
19 for (int i=0; i<used; i++) { it= (*a[i])(it); }
23 void TransformList::append(Transform *it) {
26 a= (Transform**)realloc(a,sizeof(Transform*)*size);
27 if (!a) { perror("realloc"); exit(1); }
32 void TransformList::clearcontents() {
33 for (int i=0; i<used; i++) delete a[i];
36 Point::operator Onscreen() const {
37 Point it= transformed();
38 double factor= eyedistance / (eyedistance + planedistance - it[2]);
39 return Onscreen(it[0] * factor + eyex * (1.0-factor), it[1] * factor);
42 void Point::setobserver(double theta, double eta, double planedist, double eyedist,
44 planedistance= planedist;
46 cutoffdistance= cutoffdist;
48 if (theta != 0.0) povtransform.append(new XZRotationTransform(theta));
49 if (eta != 0.0) povtransform.append(new YZRotationTransform(eta));