Package org.matheusdev.util.vecmath

Examples of org.matheusdev.util.vecmath.Vec2


  /* (non-Javadoc)
   * @see org.matheusdev.util.collision.SATObject#project(org.matheusdev.util.vecmath.Vec2)
   */
  @Override
  public Vec2 project(Vec2 axis, Vec2 dest) {
    if (dest == null) dest = new Vec2();

    final float p0 = Vec2.dot(axis, topLeftCached);
    final float p1 = Vec2.dot(axis, topRightCached);
    final float p2 = Vec2.dot(axis, botRightCached);
    final float p3 = Vec2.dot(axis, botLeftCached);
View Full Code Here


  // For pooling:
  protected Vec2 vertex0 = new Vec2();
  protected Vec2 vertex1 = new Vec2();

  public Circle(float x, float y, float radius) {
    this.center = new Vec2(x, y);
    this.radius = radius;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.matheusdev.util.collision.Projectable#project(org.matheusdev.util.vecmath.Vec2)
   */
  @Override
  public Vec2 project(Vec2 axis, Vec2 dest) {
    if (dest == null) dest = new Vec2();
    vertex0.set(axis.x, axis.y).scale(radius).translate(center.x, center.y);
    vertex1.set(-axis.x, -axis.y).scale(radius).translate(center.x, center.y);
    float p0 = Vec2.dot(vertex0, axis);
    float p1 = Vec2.dot(vertex1, axis);
    return dest.set(Math.min(p0, p1), Math.max(p0, p1));
View Full Code Here

TOP

Related Classes of org.matheusdev.util.vecmath.Vec2

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.