Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
Arquivo: intersect.c Projeto: k6s/tek1
float		get_inter(t_eye *eye, t_3dpoint *vec, t_obj *obj)
{
  t_3dpoint	tmp_eye;
  t_3dpoint	pvec;

  pvec.x = vec->x;
  pvec.y = vec->y;
  pvec.z = vec->z;
  real_position(&tmp_eye, &pvec, eye, obj);
  if (obj->type == O_SPHERE)
    return (inter_sphere(&tmp_eye, &pvec, obj->obj.sphere.radius));
  if (obj->type == O_PLANE)
    return (inter_plane(&tmp_eye, &pvec));
  if (obj->type == O_CONE)
    return (inter_cone(obj, &tmp_eye, &pvec));
  if (obj->type == O_CYLINDER)
    return (inter_cylinder(obj, &tmp_eye, &pvec));
  return (0);
}