回答网友问题:数学或物理高手进来看看

      Flash学习 2006-9-17 0:23
数学或物理高手进来看看
space.flash8.net/bbs/thread-308208-1-1.html
知道A点的坐标,
A点和B点的距离,
也知道A和B的角度,
请问怎么求得B点的坐标
-------我的回答---------------------


Flash 动画

--------------------------
//var AB=20;
mytxt_txt.selectable=false;
function run(ax:Number,ay:Number,ag:Number,L:Number){
  //mytxt_txt.text="A("+ax+","+ay+")"+/n+"B("+dx+","+dy+")";
  var hd=Math.PI*ag/180;
  var _lx=L*Math.cos(hd);
  var _ly=L*Math.sin(hd);
  var dx=ax+_lx;
  var dy=-ay-_ly;
  mytxt_txt.text="A("+ax+","+ay+")\nB("+Math.round(dx*10)/10+","+-Math.round(10*dy)/10+")"+"\nAB="+L;
  A_mc._x=B_mx._x=ax;
  A_mc._y=B_mc._y=-ay;
  this.onEnterFrame=function(){
    this.clear();
    this.lineStyle(1);
    B_mc._x+=(dx-B_mc._x)/10;
    B_mc._y+=(dy-B_mc._y)/10;
    this.moveTo(A_mc._x,A_mc._y);
    this.lineTo(B_mc._x,B_mc._y);
    if((B_mc._x-dx)<5&(B_mc._y-dy)<5){
      B_mc._x=dx;
      B_mc._y=dy;
      this.clear();
      this.lineStyle(1);
      this.moveTo(A_mc._x,A_mc._y);
      this.lineTo(B_mc._x,B_mc._y);
      delete this.onEnterFrame;
      
      }
    }
  
  }
a_btn.onPress=function(){
  var _agree=Number(agree_txt.text);
  var _ax=Number(ax_txt.text);
  var _ay=Number(ay_txt.text);
  var _L=Number(AB_txt.text);//*5;
  run(_ax,_ay,_agree,_L);
  }
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}