Transform::rotation(Angle::half_turn()-time_of_day, Vector(0, 0, 1))*
Transform::rotation(axial_tilt, Vector(-1, 0, 0));
Vector sun_dir = trans.transform_linear(Vector(0, -1, 0));
- Vector diff = Vector(sun.get_position())-sun_dir;
+ Vector diff = sun.get_position().slice<3>(0)-sun_dir;
if(diff.norm()>0.0025f)
- sun.set_position(GL::Vector4(sun_dir, 0.0f));
+ sun.set_position(compose(sun_dir, 0.0f));
double T = 5777;
double h = 6.62606957e-34; // Planck constant
{
const GL::Vector3 &start = camera.get_position();
GL::Vector4 ray = camera.unproject(GL::Vector4(x, y, 0, 0));
- return Ray(start, Vector(ray));
+ return Ray(start, ray.slice<3>(0));
}
void View3D::compute_bounds(Vector &minp, Vector &maxp)
const GL::Vector3 &cpos = view.get_camera().get_position();
GL::Vector4 cray = view.get_camera().unproject(GL::Vector4(pointer.x, pointer.y, 0, 0));
- return view.get_layout().get_layout().pick<Object>(Ray(cpos, Vector(cray)));
+ return view.get_layout().get_layout().pick<Object>(Ray(cpos, cray.slice<3>(0)));
}
void Designer::update_object_icon(Object &obj)
GL::Vector4 ray = main_view.get_camera().unproject(GL::Vector4(p.x, p.y, 0, 0));
// XXX Do this better; make this function a template?
- if(Vehicle *veh = layout.pick<Vehicle>(Ray(start, Vector(ray))))
+ if(Vehicle *veh = layout.pick<Vehicle>(Ray(start, ray.slice<3>(0))))
return veh;
- return layout.pick<Track>(Ray(start, Vector(ray)));
+ return layout.pick<Track>(Ray(start, ray.slice<3>(0)));
}
void Engineer::emergency(Block *block, const string &msg)
OrientedPoint result;
result.position = front*(1-ratio)+back*ratio;
result.rotation = Geometry::atan2<float>(front.y-back.y, front.x-back.x);
- result.tilt = Geometry::atan2<float>(front.z-back.z, LinAl::Vector<float, 2>(front-back).norm());
+ result.tilt = Geometry::atan2<float>(front.z-back.z, (front-back).slice<2>(0).norm());
return result;
}