Example #1
0
	//vnl_vector<double> vgl_point_to_vnl_vector(const vgl_point_3d<double> &vgl_point)
	vnl_double_3 vgl_point_to_vnl_vector(const vgl_point_3d<double> &vgl_point)
	{
		vnl_vector<double> vnl_vec(3);
		vnl_vec(0) = vgl_point.x();
		vnl_vec(1) = vgl_point.y();
		vnl_vec(2) = vgl_point.z();
		return vnl_vec;
	}
Example #2
0
// Creates a perspective camera looking at pt, and adds the camera and
// the projection of GOAL to the list.
static void add_pt_and_cam(
    vgl_homg_point_3d<double> pt,
    vgl_vector_3d<double> trans,
    vcl_vector<vgl_point_2d<double> > &points,
    vcl_vector<vpgl_perspective_camera<double> > &cameras)
{
    vpgl_perspective_camera<double> cam;
    cam.look_at(pt);
    cam.set_translation(trans);

    cameras.push_back(cam);

    double x,y;
    cam.project(GOAL.x(), GOAL.y(), GOAL.z(), x, y);
    
    std::cout << "x: " << x << " y: " << y << std::endl;

    points.push_back(vgl_point_2d<double>(x, y));
}
Example #3
0
void VglPlus::generateBox(const vgl_point_3d<double> & center, const vnl_vector_fixed<double, 3> & xyz_size, vcl_vector<vgl_point_3d<double> > & vertex)
{
    
    int sign[][3] = {-1, -1, -1,
        1, -1, -1,
        1, 1, -1,
        -1, 1, -1,
        -1, -1, 1,
        1, -1, 1,
        1, 1, 1,
        -1, 1, 1};
    double x_s = xyz_size[0];
    double y_s = xyz_size[1];
    double z_s = xyz_size[2];
    for (int i = 0; i<8; i++) {
        double x = center.x() + sign[i][0] * 0.5 * x_s;
        double y = center.y() + sign[i][1] * 0.5 * y_s;
        double z = center.z() + sign[i][2] * 0.5 * z_s;
        vertex.push_back(vgl_point_3d<double>(x, y, z));
    }
    assert(vertex.size() == 8);
}
Example #4
0
	vgl_vector_3d<double> vgl_point_to_vgl_vector(const vgl_point_3d<double> &p)
	{
		return vgl_vector_3d<double> (p.x(), p.y(), p.z());
	}