Ejemplo n.º 1
0
matrix exp(matrix x, double ap, double rp,int ns)
{
	matrix t = my_identity(x.cols);
	matrix s = my_identity(x.cols);

	for (int k=0; k<ns; k++)
	{
		t = t*x/k;   // next term
		s = s + t;   // add next term
		if (norm_1(t)<max(ap,norm_1(s)*rp))
		{
			return s;
		}
	}

	cout << "error! exp: no convergence!\n";
	exit(-1);
}
Ejemplo n.º 2
0
static int	my_init_object(t_object *object)
{
  object->prev = NULL;
  object->name = NULL;
  if ((object->po = my_identity(4)) == NULL ||
      (object->po_opo = my_identity(4)) == NULL ||
      (object->ro = my_identity(4)) == NULL ||
      (object->ro_opo = my_identity(4)) == NULL)
    return (1);
  object->trans = NULL;
  object->eye = NULL;
  object->degres_x = 0;
  object->degres_y = 0;
  object->degres_z = 0;
  object->rayon = 0;
  object->color.color = 0xFFFFFF;
  object->next = NULL;
  return (0);
}