计算是对的,误差太大
/
//复制到第一帧,效果显示交点坐标
//
/
var Arr:Array=new Array();
Arr.push({m_type:null});//0
Arr.push({m_type:"point",m_x:100,m_y:100});//1
Arr.push({m_type:"point",m_x:200,m_y:200});//2
Arr.push({m_type:"line2",m_p1:1,m_p2:2}); //3
Arr.push({m_type:"point",m_x:100,m_y:200});//4
Arr.push({m_type:"point",m_x:160,m_y:160});//5
Arr.push({m_type:"circle",m_center:4,m_point:5});//6
//以上是圆6和线3
chuizu(3,6);
function chuizu(line:Number,circle:Number){
//圆的两个控制点信息
var circle_center:Number =Arr[circle].m_center;
var circle_point:Number =Arr[circle].m_point;
var circle_center_x:Number =Arr[circle_center].m_x;
var circle_center_y:Number =Arr[circle_center].m_y;
var circle_point_x:Number =Arr[circle_point].m_x;
var circle_point_y:Number =Arr[circle_point].m_y;
//线的两个控制点信息
var line_p1:Number =Arr[line].m_p1;
var line_p2:Number =Arr[line].m_p2;
var line_p1_x:Number =Arr[line_p1].m_x;
var line_p1_y:Number =Arr[line_p1].m_y;
var line_p2_x:Number =Arr[line_p2].m_x;
var line_p2_y:Number =Arr[line_p2].m_y;
//圆心作圆弦垂线 垂足信息
var line_k1:Number =(line_p2_y-line_p1_y)/(line_p2_x-line_p1_x);
var line_b1:Number =line_p1_y-line_k1*line_p1_x;
var line_k2:Number =-1/line_k1;
var line_b2:Number =circle_center_y-line_k2*circle_center_x;
var node_x:Number =(line_b1-line_b2)/(line_k2-line_k1);
var node_y:Number =(line_k2*line_b1-line_k1*line_b2)/(line_k2-line_k1);
trace(node_x,node_y);
//半径 圆心到弦的距离
var circle_radius:Number =Math.sqrt((circle_center_x-circle_point_x)*(circle_center_x-circle_point_x)+(circle_center_y-circle_point_y)*(circle_center_y-circle_point_y))
var center_line_d:Number =Math.sqrt((circle_center_x - node_x)*(circle_center_x-node_x)+(circle_center_y-node_y)*(circle_center_y-node_y))
//焦点坐标
if(circle_radius == center_line_d){
trace(node_x,node_y);
}else if(circle_radius
本文转自:http://www.5uflash.com/flashjiaocheng/Flash-as3-jiaocheng/1953.html
/
//复制到第一帧,效果显示交点坐标
//
/
var Arr:Array=new Array();
Arr.push({m_type:null});//0
Arr.push({m_type:"point",m_x:100,m_y:100});//1
Arr.push({m_type:"point",m_x:200,m_y:200});//2
Arr.push({m_type:"line2",m_p1:1,m_p2:2}); //3
Arr.push({m_type:"point",m_x:100,m_y:200});//4
Arr.push({m_type:"point",m_x:160,m_y:160});//5
Arr.push({m_type:"circle",m_center:4,m_point:5});//6
//以上是圆6和线3
chuizu(3,6);
function chuizu(line:Number,circle:Number){
//圆的两个控制点信息
var circle_center:Number =Arr[circle].m_center;
var circle_point:Number =Arr[circle].m_point;
var circle_center_x:Number =Arr[circle_center].m_x;
var circle_center_y:Number =Arr[circle_center].m_y;
var circle_point_x:Number =Arr[circle_point].m_x;
var circle_point_y:Number =Arr[circle_point].m_y;
//线的两个控制点信息
var line_p1:Number =Arr[line].m_p1;
var line_p2:Number =Arr[line].m_p2;
var line_p1_x:Number =Arr[line_p1].m_x;
var line_p1_y:Number =Arr[line_p1].m_y;
var line_p2_x:Number =Arr[line_p2].m_x;
var line_p2_y:Number =Arr[line_p2].m_y;
//圆心作圆弦垂线 垂足信息
var line_k1:Number =(line_p2_y-line_p1_y)/(line_p2_x-line_p1_x);
var line_b1:Number =line_p1_y-line_k1*line_p1_x;
var line_k2:Number =-1/line_k1;
var line_b2:Number =circle_center_y-line_k2*circle_center_x;
var node_x:Number =(line_b1-line_b2)/(line_k2-line_k1);
var node_y:Number =(line_k2*line_b1-line_k1*line_b2)/(line_k2-line_k1);
trace(node_x,node_y);
//半径 圆心到弦的距离
var circle_radius:Number =Math.sqrt((circle_center_x-circle_point_x)*(circle_center_x-circle_point_x)+(circle_center_y-circle_point_y)*(circle_center_y-circle_point_y))
var center_line_d:Number =Math.sqrt((circle_center_x - node_x)*(circle_center_x-node_x)+(circle_center_y-node_y)*(circle_center_y-node_y))
//焦点坐标
if(circle_radius == center_line_d){
trace(node_x,node_y);
}else if(circle_radius
本文转自:http://www.5uflash.com/flashjiaocheng/Flash-as3-jiaocheng/1953.html