Known square diagonal two points for another two points

Source: Internet
Author: User
Squares, known (X0,Y0) and (X2,y2) can be obtained according to the following relationship (X1,y1), (x3,y3) x1+x3 = x0+x2;x1-x3 = Y2-y0;y1+y3 = Y0+y2;y1-y3 = x0-x2; node[0].p[1].x = ((node[0].p[0].x+node[0].p[2].x) + (NODE[0].P[2].Y-NODE[0].P[0].Y))/2; node[0].p[1].y = ((NODE[0].P[0].Y+NODE[0].P[2].Y) + (node[0].p[0].x-node[0].p[2].x))/2; node[0].p[3].x = ((node[0].p[0].x+node[0].p[2].x)-(NODE[0].P[2].Y-NODE[0].P[0].Y))/2; node[0].p[3].y = ((NODE[0].P[0].Y+NODE[0].P[2].Y)-(node[0].p[0].x-node[0].p[2].x))/2;

The same with the known rectangle three points to ask for another point

node[0].p[3].x = node[0].p[2].x + (node[0].p[0].x-node[0].p[1].x);
NODE[0].P[3].Y = Node[0].p[2].y + (NODE[0].P[0].Y-NODE[0].P[1].Y);

See POJ3449 for details.

Known square diagonal two points for another two points

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.