代码


<?php $a=[0,0];
$b=[0,1];
$c=[1,1];
$d=[1,0]; $ar=array($a,$b,$c,$d); $a1=[];
// 0 1 2 3
foreach ( $ar as $key => $value) { unset($ar[$key]);
foreach ($ar as $k => $v) { $a1[]=gettest($value,$v); } } $a_unique=array_unique($a1); $max=max($a_unique); $min=min($a_unique); if(count($a_unique)==2)
{
var_dump(zhengfangxing($min,$max));
} if(count($a_unique)==3){
$cx=array_diff($a_unique, [$max,$min]); var_dump(changfnagxing($min,$cx,$max));
} function gettest($a,$b)
{
return pow($a[0]-$b[0],2)+pow($a[1]-$b[1],2);
} function zhengfangxing($a,$b)
{
return ($b=2*$a)?true:false;
} function changfnagxing($a,$b,$c)
{
return ($c=$a+$b);
} // function gettest($a,$b)
// {
// return pow($a[0]-$b[0],2)
// }

php之4个坐标点判断是否为矩形和正方形的更多相关文章

  1. 判断圆和矩形是否相交C - Rectangle and Circle

    Description Given a rectangle and a circle in the coordinate system(two edges of the rectangle are p ...

  2. poj 1410 Intersection (判断线段与矩形相交 判线段相交)

    题目链接 Intersection Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12040   Accepted: 312 ...

  3. HDU 1221 Rectangle and Circle(判断圆和矩形是不是相交)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1221 Rectangle and Circle Time Limit: 2000/1000 MS (J ...

  4. Intersection--poj1410(判断线段与矩形的关系)

    http://poj.org/problem?id=1410 题目大意:给你一个线段和矩形的对角两点  如果相交就输出'T'  不想交就是'F' 注意: 1,给的矩形有可能不是左上 右下  所以要先判 ...

  5. Codeforces Round #587 (Div. 3) C题 【判断两个矩形是否完全覆盖一个矩形问题】 {补题 [差点上分系列]}

    C. White Sheet There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle ...

  6. poj1410(判断线段和矩形是否相交)

    题目链接:https://vjudge.net/problem/POJ-1410 题意:判断线段和矩形是否相交. 思路:注意这里的相交包括线段在矩形内,因此先判断线段与矩形的边是否相交,再判断线段的两 ...

  7. hihocoder #1040 矩形判断(计算几何问题 给8个点的坐标,能否成为一个矩形 【模板思路】)

    #1040 : 矩形判断 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 给出平面上4条线段,判断这4条线段是否恰好围成一个面积大于0的矩形. 输入 输入第一行是一个整数T ...

  8. G - Intersecting Rectangles Kattis - intersectingrectangles (扫描线)(判断多个矩形相交)

    题目链接: G - Intersecting Rectangles Kattis - intersectingrectangles 题目大意:给你n个矩形,每一个矩形给你这个矩形的左下角的坐标和右上角 ...

  9. POJ 1410 判断线段与矩形交点或在矩形内

    这个题目要注意的是:给出的矩形坐标不一定是按照左上,右下这个顺序的 #include <iostream> #include <cstdio> #include <cst ...

随机推荐

  1. c++模板中set(date st):t(st)中的:符号

    转载:https://zhidao.baidu.com/question/618119741512344012.html 半角冒号是构造函数里的初bai始化列表 开始du的标识. 如楼上所述: set ...

  2. matlab中imread 从图形文件读取图像

    来源:https://ww2.mathworks.cn/help/matlab/ref/imread.html?searchHighlight=imread&s_tid=doc_srchtit ...

  3. SPI通信基础学习

    SPI是"Serial Peripheral Interface"的缩写,即"串行外设接口",是摩托罗拉公司推出的一种串行接口通信协议. 接线的示意图: SPI ...

  4. 设备通讯——RS232

    RS232的接口有两种--一种公头.一种母头,两种头的引脚是有区别的 MAX232电路图: 注意:串口通讯需要交叉接线.

  5. RESTfull是什么

    经常做接口测试,会看很多接口文档,那怎么识别研发的接口设计是否足够规范,是否符合一些行业标准或准则.那认识了解RESTfull,可以让我们更具有专业性.让我们对接口文档的阅.接口合理性设计识别,做到有 ...

  6. Java虚拟机诊断利器

    Java虚拟机诊断利器  

  7. 1.ffmpeg、ffplay、ffprobe命令使用

    1.学前知识 1.1视频码率值 码率公式: 码率(kbps)=文件大小(KB)*8/时间(秒) 所以码率和视频文件大小成正比的,不过码率超过一定值后,人眼是看不出效果的. 接下来,我们便先来学习ffm ...

  8. 4-20mA模拟量采集

    4-20mA模拟量采集 4-20mA模拟量采集可选卓岚ZLAN6802(485)/ZLAN6842(以太网)/ZLAN6844(无线wifi)他们不仅可以可采集4~20mA还可以采集 /0~5V/0~ ...

  9. 【原创】xenomai内核解析--xenomai与普通linux进程之间通讯XDDP(一)--实时端socket创建流程

    版权声明:本文为本文为博主原创文章,转载请注明出处.如有问题,欢迎指正.博客地址:https://www.cnblogs.com/wsg1100/ 1.概述 上篇文章xenomai内核解析--实时IP ...

  10. spring boot:用dynamic-datasource-spring-boot-starter配置druid多数据源(spring boot 2.3.3)

    一,dynamic-datasource-spring-boot-starter的用途? 1,dynamic-datasource-spring-boot-starter 是一个基于springboo ...