void CoordinateFrame::pointToWorldSpace(const Array<Vector3>& v, Array<Vector3>& vout) const { vout.resize(v.size()); for (int i = 0; i < v.size(); ++i) { vout[i] = pointToWorldSpace(v[i]); } }
Ray CoordinateFrame::toWorldSpace(const Ray& r) const { Ray ray; ray.setOrigin(pointToWorldSpace(r.getOrigin())); ray.setDirection(vectorToWorldSpace(r.getDirection())); return ray; }
Box CoordinateFrame::toWorldSpace(const Box& b) const { Box out(b); for (int i = 0; i < 8; ++i) { out._corner[i] = pointToWorldSpace(b._corner[i]); debugAssert(! isNaN(out._corner[i].x)); } for (int i = 0; i < 3; ++i) { out._axis[i] = vectorToWorldSpace(b._axis[i]); } out._center = pointToWorldSpace(b._center); return out; }
Plane CoordinateFrame::toWorldSpace(const Plane& p) const { Vector3 N, P; double d; p.getEquation(N, d); P = N * (float)d; P = pointToWorldSpace(P); N = normalToWorldSpace(N); return Plane(N, P); }
Box CoordinateFrame::toWorldSpace(const Box& b) const { if(!b.isFinite()) { return b; } Box out(b); out._center = pointToWorldSpace(b._center); for (int i = 0; i < 3; ++i) { out._edgeVector[i] = vectorToWorldSpace(out._edgeVector[i]); } out._area = b._area; out._volume = b._volume; return out; }
Ray CoordinateFrame::toWorldSpace(const Ray& r) const { return Ray::fromOriginAndDirection(pointToWorldSpace(r.origin()), vectorToWorldSpace(r.direction())); }
Sphere CoordinateFrame::toWorldSpace(const Sphere &b) const { return Sphere(pointToWorldSpace(b.center), b.radius); }
Capsule CoordinateFrame::toWorldSpace(const Capsule& c) const { return Capsule( pointToWorldSpace(c.point(0)), pointToWorldSpace(c.point(1)), c.radius()); }
Cylinder CoordinateFrame::toWorldSpace(const Cylinder& c) const { return Cylinder( pointToWorldSpace(c.point(0)), pointToWorldSpace(c.point(1)), c.radius()); }
Triangle CoordinateFrame::toWorldSpace(const Triangle& t) const { return Triangle(pointToWorldSpace(t.vertex(0)), pointToWorldSpace(t.vertex(1)), pointToWorldSpace(t.vertex(2))); }