本文整理匯總了Java中com.jme3.math.Vector2f.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector2f.add方法的具體用法?Java Vector2f.add怎麽用?Java Vector2f.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.math.Vector2f
的用法示例。
在下文中一共展示了Vector2f.add方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: calcMaximumSize
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
@Override
protected Vector2f calcMaximumSize(Frame parent) {
Vector2f maximumSize = content.calcMaximumSize();
Vector2f dbmin = dragBar.calcPreferredSize();
Vector2f dbleftmin = dragLeft.calcPreferredSize();
Vector2f dbrightmin = dragRight.calcPreferredSize();
Vector2f accpref = accessories.calcPreferredSize();
float dbh = Math.max(accpref.y, Math.max(Math.max(dbmin.y, dbleftmin.y), dbrightmin.y));
maximumSize.addLocal(parent.getTotalPadding());
return maximumSize.add(new Vector2f(0, dbh));
}
示例2: calcTextLayerSize
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
protected Vector2f calcTextLayerSize(C el) {
Vector2f pf = calcTextSize(el, el.getWidth() - el.getTotalPadding().x);
if (pf != null) {
return pf.add(el.getTotalPadding());
}
return pf;
}
示例3: minimum_distance
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
float minimum_distance(Vector2f v, Vector2f w, Vector2f p) {
// Return minimum distance between line segment vw and point p
float l2 = v.distanceSquared(w); // i.e. |w-v|^2 - avoid a sqrt
if (l2 == 0.0) {
return p.distance(v); // v == w case
}
// Consider the line extending the segment, parameterized as v + t (w - v).
// We find projection of point p onto the line.
// It falls where t = [(p-v) . (w-v)] / |w-v|^2
// We clamp t from [0,1] to handle points outside the segment vw.
float t = Math.max(0, Math.min(1, (p.subtract(v)).dot(w.subtract(v)) / l2));
Vector2f projection = v.add(w.subtract(v).multLocal(t)); // Projection falls on the segment
return p.distance(projection);
}