/** * Returns the center point (barycenter) of this winding. * * <p>Equals WindingCenter() in polylib.cpp * * @return */ public Vector3f getCenter() { Vector3f sum = Vector3f.NULL; // add all verts for (Vector3f vert : verts) { sum = sum.add(vert); } // average vertex position return sum.scalar(1f / verts.size()); }
public Winding translate(Vector3f offset) { if (verts.isEmpty()) { return this; } ArrayList<Vector3f> vertsNew = new ArrayList<>(); for (Vector3f vert : verts) { vertsNew.add(vert.add(offset)); } return new Winding(vertsNew); }