// 计算两直线的交点x坐标
private float crossPointX(float line1x1, float line1y1, float line1x2,
float line1y2, float line2x1, float line2y1, float line2x2,
float line2y2) {
float x = (line1x1 * (line1y2 - line1y1) / (line1x2 - line1x1)
- line2x1 * (line2y2 - line2y1) / (line2x2 - line2x1) + line2y1 - line1y1)
/ ((line1y2 - line1y1) / (line1x2 - line1x1) - (line2y2 - line2y1)
/ (line2x2 - line2x1));
return x;
}
 
// 计算两直线的交点y坐标
private float crossPointY(float linex1, float liney1, float linex2,
float liney2, float x) {
float y = (liney2 - liney1) * (x - linex1) / (linex2 - linex1) + liney1;
return y;
}