Разработка функций, рисующих на экране геометрические фигуры (параллелограммы) (Лабораторная работа № 1), страница 2

int check2nd ()

{

                  int t1_2,t3_4,r=1,i;

                  t3_4=xExt[3]-xExt[4];

                  t1_2=xExt[2]-xExt[1];

                  if ((abs(t1_2)!=0)&&(abs(t3_4)!=0))

                  {

                                    //Parameters calculation

                                    //                #pragma omp section

                  //                {

                                                     //1-2 init

                                                     k1_2=get_k(2,1,yExt,xExt);

                                                     b1_2=yExt[1]-k1_2*xExt[1];

       //         }

                                    //                #pragma omp section

       //         {

                                                     //3-4 init

                                                     k3_4=get_k(4,3,yExt,xExt);

                                                     b3_4=yExt[4]-k3_4*xExt[4];

                  //                }

                                    k2_3=get_k(3,2,yExt,xExt);

                                    b2_3=yExt[2]-k2_3*xExt[2];

                                    k4_1=get_k(4,1,yExt,xExt);

                                    b4_1=yExt[1]-k4_1*xExt[1];

                                    for (i=1;i<=4;i++)

                                    {

                                                     //Horizontal check

                                                     if ((t1_2>0)&&(t3_4>0))

                                                     {

                                                                       //Right orientated case

                                                                       if (((fabs(k1_2*xIn[i]+b1_2-yIn[i]))<2)||

                                                                       ((fabs(k3_4*xIn[i]+b3_4-yIn[i])>2))) r=0;

                                                     }

                                                     else

                                                     {

                                                                       //left orientated case

                                                                       if (((fabs(k1_2*xIn[i]+b1_2-yIn[i])>2))&&

                                                                       ((k3_4*xIn[i]+

                                                                       b3_4-yIn[i])<2)) r=0;

                                                     }

                                                     //Vertical check

                                                     if (((k2_3*xIn[i]+b2_3-yIn[i])<2)||

                                                     ((k4_1*xIn[i]+b4_1-yIn[i])>2)) r=0;

                                    }

                  }

                  else

                  {

                                    //pi/2 angle case

                                    for (i=1;i<=4;i++)

                                    {

                                                     //Vertical check

                                                     if (((k2_3*xIn[i]+b2_3-yIn[i])<2)||

                                                     ((k4_1*xIn[i]+b4_1-yIn[i])>2)) r=0;

                                                     //Horizontal check

                                                     if ( (xIn[i]>xExt[2]) || (xIn[i]<xExt[4])  ) r=0;

                                    }

                  }

                  return (r);

}

//Inccorrect data msg

void incdatamsg()

{

                  perror ("Incorrect data! Please try to input correct inormation!");

                  /*switch (type)

                  {

                                    case 1: break;