AndBase开发框架  1.6
 全部  命名空间 文件 函数 变量 枚举值 
Public 成员函数 | 静态 Public 成员函数 | 所有成员列表
com.ab.util.AbMathUtil类 参考

Public 成员函数

boolean pointAtSLine (double x, double y, double x1, double y1, double x2, double y2)
 

静态 Public 成员函数

static BigDecimal round (double number, int decimal)
 
static String byte2HexStr (byte[] b, int length)
 
static char binaryToHex (int binary)
 
static int[][] arrayToMatrix (int[] m, int width, int height)
 
static double[] matrixToArray (double[][] m)
 
static double[] intToDoubleArray (int[] input)
 
static double[][] intToDoubleMatrix (int[][] input)
 
static int average (int[] pixels)
 
static int average (double[] pixels)
 
static boolean pointAtELine (double x, double y, double x1, double y1, double x2, double y2)
 
static boolean LineAtLine (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 
static boolean eLineAtELine (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 
static boolean eLineAtLine (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 
static boolean pointAtRect (double x, double y, double x1, double y1, double x2, double y2)
 
static boolean rectAtRect (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 
static boolean circleAtRect (double x, double y, double r, double x1, double y1, double x2, double y2)
 
static double getDistance (double x1, double y1, double x2, double y2)
 
static boolean isRectCollision (float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2)
 

详细描述

© 2012 amsoft.cn 名称:AbMathUtil.java 描述:数学处理类.

作者
还如一梦中
版本
v1.0
日期
:2013-01-17 下午11:52:13

成员函数说明

static int [][] com.ab.util.AbMathUtil.arrayToMatrix ( int[]  m,
int  width,
int  height 
)
inlinestatic

一维数组转为二维数组

参数
mthe m
widththe width
heightthe height
返回
the int[][]
static int com.ab.util.AbMathUtil.average ( int[]  pixels)
inlinestatic

计算数组的平均值.

参数
pixels数组
返回
int 平均值
static int com.ab.util.AbMathUtil.average ( double[]  pixels)
inlinestatic

计算数组的平均值.

参数
pixels数组
返回
int 平均值
static char com.ab.util.AbMathUtil.binaryToHex ( int  binary)
inlinestatic

二进制转为十六进制.

参数
binarythe binary
返回
char hex
static String com.ab.util.AbMathUtil.byte2HexStr ( byte[]  b,
int  length 
)
inlinestatic

描述:字节数组转换成16进制串.

参数
bthe b
lengththe length
返回
the string
static boolean com.ab.util.AbMathUtil.circleAtRect ( double  x,
double  y,
double  r,
double  x1,
double  y1,
double  x2,
double  y2 
)
inlinestatic

描述:圆心在矩形内 . 圆心在矩形中且圆的半径小于等于圆心到矩形四边的距离的最小值。 圆心(x,y) 半径r 矩形对角点A(x1,y1),B(x2,y2)

参数
x
y
r
x1
y1
x2
y2
返回
static boolean com.ab.util.AbMathUtil.eLineAtELine ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)
inlinestatic

描述:线段与线段相交. 点A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4) 线段AB与线段CD相交吗?

参数
x1
y1
x2
y2
x3
y3
x4
y4
返回
static boolean com.ab.util.AbMathUtil.eLineAtLine ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)
inlinestatic

描述:线段直线相交. 点A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4) 线段AB与直线CD相交吗?

参数
x1
y1
x2
y2
x3
y3
x4
y4
返回
static double com.ab.util.AbMathUtil.getDistance ( double  x1,
double  y1,
double  x2,
double  y2 
)
inlinestatic

描述:获取两点间的距离.

参数
x1
y1
x2
y2
返回
static double [] com.ab.util.AbMathUtil.intToDoubleArray ( int[]  input)
inlinestatic

描述:int数组转换为double数组.

参数
inputthe input
返回
the double[]
static double [][] com.ab.util.AbMathUtil.intToDoubleMatrix ( int  input[][])
inlinestatic

描述:int二维数组转换为double二维数组.

参数
inputthe input
返回
the double[][]
static boolean com.ab.util.AbMathUtil.isRectCollision ( float  x1,
float  y1,
float  w1,
float  h1,
float  x2,
float  y2,
float  w2,
float  h2 
)
inlinestatic

矩形碰撞检测 参数为x,y,width,height

参数
x1第一个矩形的x
y1第一个矩形的y
w1第一个矩形的w
h1第一个矩形的h
x2第二个矩形的x
y2第二个矩形的y
w2第二个矩形的w
h2第二个矩形的h
返回
是否碰撞
static boolean com.ab.util.AbMathUtil.LineAtLine ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)
inlinestatic

描述:两条直线相交. 点A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4) 直线AB与直线CD相交吗?

参数
x1
y1
x2
y2
x3
y3
x4
y4
返回
static double [] com.ab.util.AbMathUtil.matrixToArray ( double  m[][])
inlinestatic

二维数组转为一维数组

参数
mthe m
返回
the double[]
static boolean com.ab.util.AbMathUtil.pointAtELine ( double  x,
double  y,
double  x1,
double  y1,
double  x2,
double  y2 
)
inlinestatic

描述:点在线段上. 点A(x,y),B(x1,y1),C(x2,y2) 点A在线段BC上吗?

参数
x
y
x1
y1
x2
y2
返回
static boolean com.ab.util.AbMathUtil.pointAtRect ( double  x,
double  y,
double  x1,
double  y1,
double  x2,
double  y2 
)
inlinestatic

描述:点在矩形内. 矩形的边都是与坐标系平行或垂直的。 只要判断该点的横坐标和纵坐标是否夹在矩形的左右边和上下边之间。 点A(x,y),B(x1,y1),C(x2,y2) 点A在以直线BC为对角线的矩形中吗?

参数
x
y
x1
y1
x2
y2
返回
boolean com.ab.util.AbMathUtil.pointAtSLine ( double  x,
double  y,
double  x1,
double  y1,
double  x2,
double  y2 
)
inline

描述:点在直线上. 点A(x,y),B(x1,y1),C(x2,y2) 点A在直线BC上吗?

参数
x
y
x1
y1
x2
y2
返回
static boolean com.ab.util.AbMathUtil.rectAtRect ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)
inlinestatic

描述:矩形在矩形内. 只要对角线的两点都在另一个矩形中就可以了. 点A(x1,y1),B(x2,y2),C(x1,y1),D(x2,y2) 以直线AB为对角线的矩形在以直线BC为对角线的矩形中吗?

参数
x1
y1
x2
y2
x3
y3
x4
y4
返回
static BigDecimal com.ab.util.AbMathUtil.round ( double  number,
int  decimal 
)
inlinestatic

四舍五入.

参数
number原数
decimal保留几位小数
返回
四舍五入后的值

该类的文档由以下文件生成: