Ray CoordinateFrame::toObjectSpace(const Ray& r) const { Ray ray; ray.setOrigin(pointToObjectSpace(r.getOrigin())); ray.setDirection(vectorToObjectSpace(r.getDirection())); return ray; }
void CoordinateFrame::pointToObjectSpace(const Array<Vector3>& v, Array<Vector3>& vout) const { vout.resize(v.size()); for (int i = v.size() - 1; i >= 0; --i) { vout[i] = pointToObjectSpace(v[i]); } }
Plane CoordinateFrame::toObjectSpace(const Plane& p) const { Vector3 N, P; double d; p.getEquation(N, d); P = N * (float)d; P = pointToObjectSpace(P); N = normalToObjectSpace(N); return Plane(N, P); }
Plane CoordinateFrame::toObjectSpace(const Plane& p) const { // TODO Vector3 N, P; double d; p.getEquation(N, d); P = N * (float)d; P = pointToObjectSpace(P); N = normalToObjectSpace(N); debugAssertM(isFinite(d), "Not implemented for infinite planes"); return Plane(N, P); }
Ray CoordinateFrame::toObjectSpace(const Ray& r) const { return Ray::fromOriginAndDirection(pointToObjectSpace(r.origin()), vectorToObjectSpace(r.direction())); }
Sphere CoordinateFrame::toObjectSpace(const Sphere &b) const { return Sphere(pointToObjectSpace(b.center), b.radius); }
Triangle CoordinateFrame::toObjectSpace(const Triangle& t) const { return Triangle(pointToObjectSpace(t.vertex(0)), pointToObjectSpace(t.vertex(1)), pointToObjectSpace(t.vertex(2))); }