1v13d/src/FxEngine/face.c

29 lines
847 B
C
Raw Normal View History

2019-07-25 13:23:41 +02:00
#include "face.h"
static bool compare(FE_face const * face)
{
const int dx_1=face->s2->translated.x-face->s1->translated.x;
const int dx_2=face->s3->translated.x-face->s1->translated.x;
const int dy_1=face->s2->translated.y-face->s1->translated.y;
const int dy_2=face->s3->translated.y-face->s1->translated.y;
double coef1,coef2;
if (dx_1==0) coef1=10000*dy_1;
else coef1=dy_1/dx_1;
if (dx_2==0) coef2=10000*dy_2;
else coef2=dy_2/dx_2;
return (coef1<coef2);
}
2019-07-25 13:23:41 +02:00
void FE_draw_face(FE_face const * face)
{
if (face->s1->translated.x==face->s2->translated.x && face->s1->translated.x==face->s3->translated.x)
return;
if (face->s1->translated.y==face->s2->translated.y && face->s1->translated.y==face->s3->translated.y)
return;
if (compare(face)!=face->visible)
return;
2019-07-25 13:23:41 +02:00
}