java.math pi_Java Math.PI属性代码示例

/**

* Recursive fonction that draws the whole tree descending from root

* draws root on the canvas, then decides of the ray and margin of root's children, instanciates the children, then calls itself recursivly for each children

* @param canvas

* @param root the root of the tree to be displayed

* @param rootangle the direction of the tree to be displayed in rad (0 mins vertically from top to bottom

* @author Paul Best

*/

public void drawMessages(Canvas canvas,Message root, double rootangle){

int nbchildren = root.getChildren().size();

//angle de séparation entre les message

double angle = Math.PI/nbchildren;

//Dessin de l'oval ( root )

root.getGoval().draw(canvas ,root);

//Dessin du pseudo

drawPseudo(root, canvas);

//On parcours tous les enfants de root

for(int i=0; i

Message msg = root.getChildren().get(i);

double mangle = angle * i - Math.PI / 2 + rootangle + angle / 2;

float mray;

double margin;

//Si on se trouve dans la vue raprochée

if(mScaleFactor>closedViewlimit) {

// DECISION DU RAYON

mray = (float)(root.getGoval().getRay() * (startRay + weightRay * (2*msg.getChildren().size()-nbchildren)));

//DECISION DE LA MARGE

margin = mray*(startMar+msg.getChildren().size() *weightMar);

}//Si on se trouve dans la vue éloignée

else{

mray = (float)(weightraylong * (msg.getChildren().size() * stepraylong + 1));

margin = initraylong + msg.getChildren().size() * mray * stepmarlong + nbchildren*root.getGoval().getRay()*0.2;

}

//dessin du trait

if(margin>50) {

Point beginline = beChildof(root.getGoval(), 0, mangle, marginbeginDist);

Point endline = beChildof(root.getGoval(), mray, mangle, margin - mray - marginEndDist);

canvas.drawLine(beginline.x, beginline.y, endline.x, endline.y, new Paint());

}

//Création de l'oval enfant

Point mpt = beChildof(root.getGoval(), mray,mangle, margin );

msg.setOval(new Oval(mpt.x,mpt.y, mray, theuniverse.getColormap().get(msg.getIduser()), getContext()));

//Appel récurcif avec l'enfant créé

drawMessages(canvas, msg, mangle);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值