001package net.gdface.sdk; 002 003public class RectUtils { 004 005 /** 006 * 计算两点间è·ç¦» 007 * @param p1 008 * @param p2 009 * @return 010 */ 011 public static final double distance(FInt2 p1,FInt2 p2){ 012 int x=p1.getX()-p2.getY(),y=p1.getY()-p2.getY(); 013 return Math.sqrt(x*x+y*y); 014 } 015 /** 016 * 计算矩形rä¸å¿ƒç‚¹åˆ°pçš„è·ç¦» 017 * @param r 018 * @param p 019 * @return 020 * @see #distance(FInt2, FInt2) 021 */ 022 public static final double distance(FRect r,FInt2 p){ 023 return distance(new FInt2(r.getLeft()+(r.getWidth()>>1),r.getTop()+(r.getHeight()>>1)),p); 024 } 025}