int		csg_display_cylinder(t_rt *s, t_object *obj)
{
  t_cylinder	*shape;

  s->hit.limited = 0;
  shape = (t_cylinder *)obj->datas;
  if (inter_cylinder(s, shape) == 1)
    return (csg_cylinder_plans_inters(s, shape, obj));
  if (get_simple_inter(s, s->ray.vct, &s->ray.new_eye))
    return(end_rotation(&s->rotation, s->ray.vct, &shape->rot), 0);
  end_rotation(&s->rotation, s->ray.vct, &shape->rot);
  if (limited_cylinder(s, shape) == 0
      && limited_cylinder2(s, shape) == 0 && order_solutions(s) == 0)
    {
      shape->simple_inter1 = s->hit.simple_inter1;
      shape->simple_inter2 = s->hit.simple_inter2;
      shape->k1 = s->hit.k1;
      shape->k2 = s->hit.k2;
      shape->norm1 = s->hit.norm1;
      shape->limited = s->hit.limited;
      if ((fill_inter_list_cylinder(s, obj)) == -1)
	return (-1);
      s->hit.name = obj->name;
    }
  return (0);
}
示例#2
0
文件: raytracer2.c 项目: lnieto-m/RT
static gboolean		intersection2(t_env *rt, t_vector ray, t_vector origin,
	int i)
{
	if ((rt->object[i].name == L_SPHERE && limited_sphere(ray,
		rt->object[i], origin, rt)) ||
	(rt->object[i].name == L_CYLINDER && limited_cylinder(ray,
		rt->object[i], origin, rt)) ||
	(rt->object[i].name == L_CONE && limited_cone(ray, rt->object[i]
		, origin, rt)) ||
	(rt->object[i].name == TRIANGLE && triangle(ray, rt->object[i],
		&rt->t, origin)) ||
	(rt->object[i].name == TORUS && torus(ray, rt->object[i], &rt->t
		, origin)) ||
	(rt->object[i].name == ELLIPSOIDE && ellipsoide(ray, rt->object[i],
		&rt->t, origin)) ||
	(rt->object[i].name == PARABOL && parabol(ray, rt->object[i],
		&rt->t, origin)) ||
	(rt->object[i].name == QUADRILATERAL && quadrilateral(ray,
		rt->object[i], &rt->t, origin)) ||
	(rt->object[i].name == CUBE && cube(ray, &rt->object[i], &rt->t,
		origin)))
		return (1);
	return (0);
}