Exemplo n.º 1
0
bool
compute_affine_xform_matrix(struct point disp_pts[3], struct point ts_pts[3], float out[2][3])
{
	int	 i;
	float	 x_ts[3];
	float	 y_ts[3];
	float	 x_disp[3];
	float	 y_disp[3];

	for (i = 0; i < 3; i++) {
		x_ts[i] = ts_pts[i].x;
		y_ts[i] = ts_pts[i].y;
		x_disp[i] = disp_pts[i].x;
		y_disp[i] = disp_pts[i].y;
	}

	float	 m[3][3] = {
		{ x_ts[0], y_ts[0], 1 },
		{ x_ts[1], y_ts[1], 1 },
		{ x_ts[2], y_ts[2], 1 },
	};
	float	m_i[3][3];

	if (!invert33(m, m_i))
		return false;

	dot333(m_i, x_disp, &out[0][0]);
	dot333(m_i, y_disp, &out[1][0]);

	return true;
}
Exemplo n.º 2
0
MxBool optimizev( const MxQuadric3 *q, Vec3 *v)
{
    Mat3 Ainv, tensor;
	double det;
	Vec3 vtemp;

	quad_tensor( q, &tensor );
    det = invert33( &Ainv, &tensor );
    if( MxFEQ(det, 0.0, 1e-12f) )
		return 0;

	quad_vector( &vtemp, q );
	vecmul33( v, &Ainv, &vtemp );
	mxv_neg( v->elt, v->elt, 3 );


    /* MX_ASSERT( quad_evaluatev( q, v->elt ) >= 0 ); */
    return 1;
}