public static Vector2 createPositionFromID(int id, int width) { return new Vector2(id % width, id / width); }
public AmbientOcclusionOp(int sampleCount, int sampleOffset, int sampleRadius) { samplePositions = new Tupel2[sampleCount]; for (int i = 1; i < sampleCount + 1; i++) { float s = i / (float) sampleCount; double a = sqrt(s * sampleCount * sampleOffset); double b = sqrt(s); double x = sin(a) * b; double y = cos(a) * b; samplePositions[i - 1] = new Vector2((float) x, (float) y).mul(sampleRadius); } }
private Vector2 getTexCoord(Vertex v) { float[] pos = getFloat(v.getAttribute(texcoord)); return new Vector2(pos[0], pos[1]); }
public Vector2 getRotatedCW() { return new Vector2(getY(), -getX()); }
public Vector2 getRotatedCCW() { return new Vector2(-getY(), getX()); }
public void createCell(ImmutableVector<Vector2> position) { Quad[] quads = new Quad[tessfactor * tessfactor]; float size = 1f / tessfactor; for (int x = 0; x < tessfactor; x++) { for (int y = 0; y < tessfactor; y++) { quads[tessfactor * x + y] = qfactory.createQuad(position.clone().add( new Vector2(size * x, size * y))); } } cells.add(new Cell(quads, tessfactor)); }
public int createCells(ImmutableVector<Vector2>[] positions) { for (ImmutableVector<Vector2> v : positions) { qfactory.precachePosition(v.clone()); qfactory.precachePosition(new Vector2(tessfactor, 0).add(v)); qfactory.precachePosition(new Vector2(tessfactor, tessfactor).add(v)); qfactory.precachePosition(new Vector2(0, tessfactor).add(v)); } int r = qfactory.getVertexCount(); for (ImmutableVector<Vector2> v : positions) { createCell(v); } return r; }
public Mesh buildExtrudedPrisma(float extrude, float height, Path<Vector3> path) { Path<Vector2> p2 = new Path<>(); for (ImmutableVector<Vector3> v : path) { float[] c = v.getCoords(); p2.addPathElement(new Vector2(c[0], c[2])); } return buildExtrudedPrisma(p2, extrude, height); }
throw new IOException("The Texture Coordinats of the OBJ file must be of only 2 elements!"); obj.getTexcoords().add(new Vector2(vals[0], vals[1])); break; case "f":