coordinate angle size without π

Source: Internet
Author: User

First, according to x and x axis angle, tanx=y/x;

ATAN2 usage: atan2 (Y,X) is expressed in the sense that the origin of the coordinates is the starting point, and the angle of the (x, y) ray on the coordinate plane and the positive direction of the x-axis. The code shows the following columns:

1   while(n--)2     {3scanf"%LF%LF%LF%LF",&x1,&y1,&x2,&y2);4a1=atan2 (y1,x1);5A2=atan2 (y2,x2);6A3=fabs (a1-A2);7printf"%.2lf\n", a3* the/PI);8}

Second, according to the angle of x, cosx= vector a point multiplication vector b/Mode A *

 while (n--)    {        double  x1,x2,y1,y2,t,a,b,c;        scanf ("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);        A=x1*x2+y1*y2;        b=sqrt (x2*x2+y2*y2);        C=sqrt (x1*x1+y1*y1);        T=acos (A/B/C) *N/PI;        printf ("%.2lf\n", T);    }

coordinate angle size without π

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.