Package javax.vecmath

Examples of javax.vecmath.Vector2f


   
    ArrayList<Vector2f> shape = new ArrayList<Vector2f>();

    // top line
    if(widthOne) {
      shape.add(new Vector2f(0, -height));
    } else {
      shape.add(new Vector2f(-width/2 + cornerRadius, -height/2));
      shape.add(new Vector2f(+width/2 - cornerRadius, -height/2));
    }
    // top right corner
    for(int i = 1; i <= pointsPerCorner; i++) {
      float angle = angleInc * i - ((float)Math.PI / 2);
      shape.add(new Vector2f(
          cornerRadius * (float)Math.cos(angle) + width/2 - cornerRadius,
          cornerRadius * (float)Math.sin(angle) - height/2 + cornerRadius
          ));
    }

    // right line
    if(heightOne) {
      shape.add(new Vector2f(width, 0));
    } else {
      shape.add(new Vector2f(width/2, -height/2 + cornerRadius));
      shape.add(new Vector2f(width/2, +height/2 - cornerRadius));
    }
    // bottom right corner
    for(int i = 1; i <= pointsPerCorner; i++) {
      float angle = angleInc * i;
      shape.add(new Vector2f(
          cornerRadius * (float)Math.cos(angle) + width/2 - cornerRadius,
          cornerRadius * (float)Math.sin(angle) + height/2 - cornerRadius
          ));
    }

    // bottom line
    if(widthOne) {
      shape.add(new Vector2f(0, height));
    } else {
      shape.add(new Vector2f(+width/2 - cornerRadius, height/2));
      shape.add(new Vector2f(-width/2 + cornerRadius, height/2));
    }
    // bottom left corner
    for(int i = 1; i <= pointsPerCorner; i++) {
      float angle = angleInc * i + ((float)Math.PI / 2);
      shape.add(new Vector2f(
          cornerRadius * (float)Math.cos(angle) - width/2 + cornerRadius,
          cornerRadius * (float)Math.sin(angle) + height/2 - cornerRadius
          ));
    }

    // left line
    if(heightOne) {
      shape.add(new Vector2f(-width, 0));
    } else {
      shape.add(new Vector2f(-width/2, +height/2 - cornerRadius));
      shape.add(new Vector2f(-width/2, -height/2 + cornerRadius));
    }
    // top left corner
    for(int i = 1; i <= pointsPerCorner; i++) {
      float angle = angleInc * i + ((float)Math.PI);
      shape.add(new Vector2f(
          cornerRadius * (float)Math.cos(angle) - width/2 + cornerRadius,
          cornerRadius * (float)Math.sin(angle) - height/2 + cornerRadius
          ));
    }

View Full Code Here


  public static List<Vector2f> createEllipse(float width, float height, int points) {
    float angleInc = (float)(2 * Math.PI / points);
    float angle = 0;
    ArrayList<Vector2f> shape = new ArrayList<Vector2f>(points);
    for(int i = 0; i < points; i++) {
      shape.add(new Vector2f((width/2) * (float)Math.cos(angle), (height/2) * (float)Math.sin(angle)));
      angle += angleInc;
    }
    return shape;
  }
View Full Code Here

    float angleInc = (float)((endAngle - startAngle) / (points - 2));
    float angle = startAngle;
    ArrayList<Vector2f> shape = new ArrayList<Vector2f>(points);

    // Add center to connect
    shape.add(new Vector2f(0,0));
   
    // Add ellipsoidal arc outline
    for(int i = 0; i < (points - 1); i++) {
      float rad = (float)Math.toRadians(angle);
      shape.add(new Vector2f((width/2) * (float)Math.cos(rad), (height/2) * (float)Math.sin(rad)));
      angle += angleInc;
    }
    return shape;
  }
View Full Code Here

    for(int i = 0; i < 3; i++) {
      triangle.setColor(i, color);
    }
  }
  private void setTexCoords(Triangle triangle) {
    triangle.setTextureCoordinate(0, new Vector2f(0, 0));
    triangle.setTextureCoordinate(1, new Vector2f(79, 63));
    triangle.setTextureCoordinate(2, new Vector2f(0, 63));
  }
View Full Code Here

    private Map<String, Mesh> iconMeshes = Maps.newHashMap();

    @Override
    public void initialise() {
        Vector2f texPos = new Vector2f(40.0f * 0.015625f, 32.0f * 0.03125f);
        Vector2f texWidth = new Vector2f(4.0f * 0.015625f, -12.0f * 0.03125f);

        Tessellator tessellator = new Tessellator();
        TessellatorHelper.addBlockMesh(tessellator, new Vector4f(1, 1, 1, 1), texPos, texWidth, 1.0f, 1.0f, 0.9f, 0.0f, 0.0f, 0.0f);
        handMesh = tessellator.generateMesh();
        handTex = Assets.getTexture("engine:char");
View Full Code Here

            Block b = particleEffect.blockType.getArchetypeBlock();
            p.texOffset.set(b.getPrimaryAppearance().getTextureAtlasPos(BlockPart.FRONT));

            if (particleEffect.randBlockTexDisplacement) {
                final float relTileSize = worldAtlas.getRelativeTileSize();
                Vector2f particleTexSize = new Vector2f(
                        relTileSize * particleEffect.randBlockTexDisplacementScale.y,
                        relTileSize * particleEffect.randBlockTexDisplacementScale.y);

                p.texSize.x *= particleEffect.randBlockTexDisplacementScale.x;
                p.texSize.y *= particleEffect.randBlockTexDisplacementScale.y;
View Full Code Here

    /**
     * @return The smallest vector in the region
     */
    public Vector2f min() {
        return new Vector2f(posX, posY);
    }
View Full Code Here

    /**
     * @return The size of the region
     */
    public Vector2f size() {
        return new Vector2f(w, h);
    }
View Full Code Here

public class Vector2fCopyStrategy implements CopyStrategy<Vector2f> {

    @Override
    public Vector2f copy(Vector2f value) {
        if (value != null) {
            return new Vector2f(value);
        }
        return null;
    }
View Full Code Here

            }

            skeletonBuilder.setVertexWeights(vertexStartWeight, vertexWeightCount);

            for (int i = 0; i < normals.size() / 2; i++) {
                uvs.add(new Vector2f(normals.get(i * 2 + 0), normals.get(i * 2 + 1)));
            }
            skeletonBuilder.setUvs(uvs);
            skeletonBuilder.setIndices(indices);
        }

View Full Code Here

TOP

Related Classes of javax.vecmath.Vector2f

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.