简体   繁体   English

有人可以帮我翻译 java 中的这行代码吗?

[英]Can someone help me to translate this line of code in java?

if (area >= 30 &&
    std::abs(1 - ((double)rect.width / (double)rect.height)) <= 0.2 && 
    std::abs(1 - (area / (CV_PI * std::pow(radius, 2)))) <= 0.2)

What I want to be translated is the std::abs and the CV_PI * std::pow .我要翻译的是std::absCV_PI * std::pow

I've search the net for std::abs equivalent to java and failed to find any.我在网上搜索了相当于 java 的std::abs ,但没有找到。 Please help.请帮忙。 Wasn't able to search for CV_PI * std::pow since I can't still find the std::abs .无法搜索CV_PI * std::pow因为我仍然找不到std::abs

Look at the Math class.查看Math class。

https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html

 Math.PI
 Math.pow(...)
 Math.abs(...)
 etc.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM