本文整理汇总了Java中processing.core.PVector.mult方法的典型用法代码示例。如果您正苦于以下问题:Java PVector.mult方法的具体用法?Java PVector.mult怎么用?Java PVector.mult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.core.PVector
的用法示例。
在下文中一共展示了PVector.mult方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: relaxEdges
import processing.core.PVector; //导入方法依赖的package包/类
void relaxEdges() {
ArrayList<PVector> tempPos = new ArrayList<PVector>();
for (int i = 0; i < pointsList.size(); i++) {
Point pt = pointsList.get(i);
if (pt.border)
tempPos.add(pt.pos);
else {
PVector p = new PVector(0, 0);
for (Face f : pt.faces)
p.add(f.pos);
p.mult(1.0f / pt.faces.size());
tempPos.add(p);
}
}
for (int i = 0; i < tempPos.size(); i++)
pointsList.get(i).pos = lerpVector(pointsList.get(i).pos, tempPos.get(i), relaxEdgesAmount);
}
示例2: scale
import processing.core.PVector; //导入方法依赖的package包/类
/**
* Increases or decreases the size of the scan by a given factor
*
* @param scaleFactor the size scaling factor
*/
public void scale(float scaleFactor) {
// Scale the scan points
for (PVector point : points) {
point.sub(center);
point.mult(scaleFactor);
point.add(center);
}
// Update the normals array
updateNormals();
// Remove the meshes
mesh = null;
pointsMesh = null;
linesMesh = null;
// Update the maximum scan separation between points
setMaxPointSeparation(scaleFactor * getMaxPointSeparation());
}
示例3: twoFingerMovement
import processing.core.PVector; //导入方法依赖的package包/类
protected void twoFingerMovement() {
if (!getValidTouchs()) {
emptyUpdate();
return;
}
// System.out.println("Full Update");
// Every values needs to be divided by 2... for some reason.
float rot = computeRotation(touchs[0], touchs[1]);
if (!Float.isNaN(rot)) // && abs(rot) > PI / 90f)
{
addRotation(rot / 2f);
}
float scale = computeScale(touchs[0], touchs[1]);
if (!Float.isNaN(scale)) // && abs(scale) > 0.8)
{
float halfScale = (scale - 1f) / 2f + 1;
multScale(halfScale);
}
PVector translate = computeTranslate(touchs[0], touchs[1]);
translate.mult(0.5f);
addTranslation(translate);
}
示例4: getCentroid
import processing.core.PVector; //导入方法依赖的package包/类
PVector getCentroid() {
PVector centroid = new PVector();
float area = 0;
int nb = points.size();
PVector p2 = points.get(nb - 1).pos;
for (Point p : points) {
float a = p.pos.x * p2.y - p2.x * p.pos.y; // (cross
// product)
area += a;
centroid.add(PVector.mult(PVector.add(p.pos, p2), a));
p2 = p.pos;
}
centroid.mult(1 / (3 * area));
return centroid;
}
示例5: computeTranslate
import processing.core.PVector; //导入方法依赖的package包/类
protected PVector computeTranslate(Touch touch0, Touch touch1) {
PVector previousCenter = PVector.add(touch0.pposition, touch1.pposition);
previousCenter.mult(0.5f);
PVector currentCenter = PVector.add(touch0.position, touch1.position);
currentCenter.mult(0.5f);
PVector diff = PVector.sub(currentCenter, previousCenter);
// diff.mult(0.5f);
return diff;
}