Skip to content

Instantly share code, notes, and snippets.

@yfhust
yfhust / ImageJ Macro Programs
Created May 5, 2016 12:34
Programs for Fun
a = parseFloat(getUserInputValue("请输入土方下底面的长度", 100));
b = parseFloat(getUserInputValue("请输入土方下底面的宽度", 100));
x = parseFloat(getUserInputValue("请输入土方上底面的长度", 100));
y = parseFloat(getUserInputValue("请输入土方上底面的宽度", 100));
h = parseFloat(getUserInputValue("请输入土方的高度", 10));
totalArea = eachArea(a,b,x,y,h)+eachArea(b,a,y,x,h);
print("短梯形的高是: "+sqrt((square((b-y)/2)) + square(h)));
print("长梯形的高是: "+sqrt((square((a-x)/2)) + square(h)));
print("每个短梯形的面积是: "+(eachArea(a,b,x,y,h))/2);
print("每个长梯形的面积是: "+(eachArea(b,a,y,x,h))/2);