• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
#include <stdio.h>#include <conio.h>#include <iostream.h>#include <math.h>#define pi 3.141592653589int ind;float r,s,t,u,v,w,a,b;void lee_datos(void){cout<<"Por favor no ingrese vectores nulos o los tres colineales\n\n";cout<<"Ingrese componenete x vector 1";cin>>r;cout<<"Ingrese componenete y vector 1";cin>>s;cout<<"\nIngrese componenete x vector 2";cin>>t;cout<<"Ingrese componenete x vector 2";cin>>u;cout<<"\nIngrese componenete x vector 3";cin>>v;cout<<"Ingrese componenete y vector 3";cin>>w;cout<<"\nIngrese componenete x del punto a verificar";cin>>a;cout<<"Ingrese componenete y del punto a verificar";cin>>b;}float maximo(float x, float y){float val;if(x>=y){val=x;}else{val=y;}return(val);}int verificar(float ux1, float uy1, float ux2, float uy2,float ux3,float uy3,floatx,float y){ind=0;float x1,y1,x2,y2;float vx1,vy1,vx2,vy2,vx3,vy3;float wx1,wy1,wx2,wy2,wx3,wy3;float zx1,zy1,zx2,zy2,zx3,zy3;float n2,n3,m2,m3;float m,n;
 
float angu1,angu2,angu3,angu4,ang1,ang2;float max1,max2;//ordenar en sentido contrario de las manecillas del relojif(uy1<=uy2 && uy1<=uy3){vx1=ux1;vy1=uy1;if(ux2>ux3){vx2=ux2;vy2=uy2;vx3=ux3;vy3=uy3;}else{vx2=ux3;vy2=uy3;vx3=ux2;vy3=uy2;}}else{if(uy2<=uy1 && uy2<uy3){vx1=ux2;vy1=uy2;if(ux1>ux3){vx2=ux1;vy2=uy1;vx3=ux3;vy3=uy3;}else{vx2=ux3;vy2=uy3;vx3=ux1;vy3=uy1;}}else{vx1=ux3;vy1=uy3;if(ux1>ux2){vx2=ux1;vy2=uy1;vx3=ux2;vy3=uy2;}else{
 
vx2=ux2;vy2=uy2;vx3=ux1;vy3=uy1;}}}//cambiarwx1=0;wy1=0;wx2=vx2-vx1;wy2=vy2-vy1;wx3=vx3-vx1;wy3=vy3-vy1;x1=x-vx1;y1=y-vy1;//Calcular los ángulosangu1=atan(wy2/wx2); //ángulo entre el nuevo eje x y el vector w2angu2=atan(wy3/wx3); //ángulo entre el nuevo eje x y el el vector w3ang1=atan(y1/x1); //ángulo entre el nuevo eje x el vector a comprobar//Calcular las normasn2=sqrt(wx2*wx2+wy2*wy2);n3=sqrt(wx3*wx3+wy3*wy3);n=sqrt(x1*x1+y1*y1);//verificarmax1=maximo(n2,n3);if((n<=max1) && (angu1<=ang1) && (ang1<=angu2)){//ordenarvx1=wx2;vy1=wy2;vx2=wx3;vy2=wy3;vx3=wx1;vy3=wy1;//cambiarzx1=0;zy1=0;zx2=vx2-vx1;zy2=vy2-vy1;zx3=vx3-vx1;zy3=vy3-vy1;x2=x1-vx1;y2=y1-vy1;//ángulosangu3=atan(zy2/zx2);angu4=atan(zy3/zx3);ang2=atan(y2/x2);//normas
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...