本文整理匯總了Java中com.jme3.math.Vector2f.length方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector2f.length方法的具體用法?Java Vector2f.length怎麽用?Java Vector2f.length使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.math.Vector2f
的用法示例。
在下文中一共展示了Vector2f.length方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: calculateHeight
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
private float calculateHeight(float radius, float heightFactor, float x, float z) {
// find percentage for each 'unit' in radius
Vector2f point = new Vector2f(x, z);
float val = point.length() / radius;
val = 1 - val;
if (val <= 0) {
val = 0;
}
return heightFactor * val;
}
示例2: calculateHeight
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
private float calculateHeight(float radius, float heightFactor, float x, float z) {
// find percentage for each 'unit' in radius
Vector2f point = new Vector2f(x, z);
float val = point.length() / radius;
val = 1 - val;
if (val <= 0) {
val = 0;
}
return heightFactor * val * 0.1f; // 0.1 scales it down a bit to lower the impact of the tool
}
示例3: isInRadius
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
private boolean isInRadius(float x, float y, float radius) {
Vector2f point = new Vector2f(x, y);
// return true if the distance is less than equal to the radius
return point.length() <= radius;
}
示例4: calculateHeight
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
private float calculateHeight(final float radius, final float heightFactor, @NotNull final Vector2f point) {
// find percentage for each 'unit' in radius
float val = point.length() / radius;
val = 1 - val;
if (val <= 0) val = 0;
return heightFactor * val * 0.1f; // 0.1 scales it down a bit to lower the impact of the tool
}