2、已知两边和此两边的夹角
package com.king{ /* author: ShangBin Feng QQ: 334973991 */ import flash.display.Sprite; import flash.geom.Point; public class testTriangle extends Sprite{ public function testTriangle(){ //已知条件 var a:Number=100; var b:Number=200; var A:Number=90*2*Math.PI/360; //画三角形 graphics.lineStyle(1, 0xff0000, 1); graphics.moveTo(0,0); graphics.lineTo(a,0); graphics.lineTo(b*Math.cos(A),b*Math.sin(A)); graphics.lineTo(0,0); } } }
3、已知三条边长,最大边和最小边之差不能大于第三边
package com.king{ /* author: ShangBin Feng QQ: 334973991 */ import flash.display.Sprite; import flash.geom.Point; public class testTriangle extends Sprite{ public function testTriangle(){ //已知条件 var a:Number=100; var b:Number=200; var c:Number=250; //画三角形 var x=(a*a+b*b-c*c)/(2*a); var y=Math.sqrt(b*b-x*x); graphics.lineStyle(1, 0xff0000, 1); graphics.moveTo(0,0); graphics.lineTo(a,0); graphics.lineTo(x,y); graphics.lineTo(0,0); } } }
|