[OT]Algoritmo Intersección Rectangulos

04/12/2003 - 20:28 por Gandalf | Informe spam
Hola, a ver si alguien conoce o tiene a mano dicho algoritmo.

Un Saludo.

Preguntas similare

Leer las respuestas

#1 KAKATUO
04/12/2003 - 21:51 | Informe spam
Hasta que piense una respuesta mas elegante ...

BOOL IntersectRect(
LPRECT lprcDst, // pointer to structure for intersection
CONST RECT *lprcSrc1, // pointer to structure with first rectangle
CONST RECT *lprcSrc2 // pointer to structure with second rectangle
);

Saludos.

"Gandalf" escribió en el mensaje
news:
Mostrar la cita
#2 Gandalf
05/12/2003 - 10:57 | Informe spam
Gracias Kakatuo, pero no es eso lo que pido, ya conozco esa función.

Lo que quiero es el algoritmo de esa función, como trabaja.

Gracias
"KAKATUO" escribió en el mensaje
news:bqo6or$dtk$07$
Mostrar la cita
#3 KAKATUO
05/12/2003 - 17:22 | Informe spam
Ya me lo figuraba,
Estoy pensando un algoritmo rápido pero no se si funcionará, puede ser algo
así:

BOOL IntersectRect(CRect& rect3, CRect rect1, CRect rect2)
{
Crect rectTmp;
rectTmp.left = __max(rect1.left, rect2.left);
rectTmp.right = __min(rect1.right, rect2.right);
rectTmp.top = __max(rect1.top, rect2.top);
recrectTmpt3.bottom = __min(rect1.bottom, rect2.bottom);

if(rectTmp.left > rectTmp.right) return FALSE;
if(rectTmp.top > rectTmp.bottom) return FALSE;

rect3 = rectTmp;
return TRUE;
}

Es correcto?

Saludos.
"Gandalf" escribió en el mensaje
news:
Mostrar la cita
#4 Gandalf
05/12/2003 - 20:03 | Informe spam
Gracias, lo voy a probar y ya te contare.

"KAKATUO" escribió en el mensaje
news:bqqbc1$pqo$00$
Mostrar la cita
algo
Mostrar la cita
Ads by Google
Search Busqueda sugerida