计算几何--判断点是否在矩形里
/** * Created with IntelliJ IDEA. * @author: DongYang * Date: 13-7-3 * Time: 下午1:57 * Progress every day a little more. */ package test { import flash.geom.Point; import flash.geom.Rectangle; public class Geometry { /** * 判断点是否在矩形里 * @param p 需要判断的点 * @param rect 矩形 * @return Boolean 判断结果 * */ public static function pointInRectangle(p:Point,rect:Rectangle):Boolean{ if(p==null&&rect==null){ return false; } if(p.x>rect.x&&p.x<(rect.x+rect.width)&&p.y>rect.y&& p.y<(rect.y+rect.height)){ return true; } return false; } } }