Package se.llbit.math

Examples of se.llbit.math.Quad


   * @return Quads rotated about the Z axis
   */
  public static final Quad[] rotateZ(Quad[] src) {
    Quad[] rot = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      rot[i] = new Quad(src[i], Transform.NONE.rotateZ());
    }
    return rot;
  }
View Full Code Here


   * @return Quads rotated about the Z axis by some angle
   */
  public static final Quad[] rotateZ(Quad[] src, double angle) {
    Quad[] rot = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      rot[i] = new Quad(src[i], Transform.NONE.rotateZ(angle));
    }
    return rot;
  }
View Full Code Here

   * @return Translated copies of the source quads
   */
  public static final Quad[] translate(Quad[] src, double x, double y, double z) {
    Quad[] out = new Quad[src.length];
    for (int i = 0; i < src.length; ++i) {
      out[i] = new Quad(src[i], Transform.NONE.translate(x, y, z));
    }
    return out;
  }
View Full Code Here

        new AABB(0, 1, 0, 0.5, 0, 1),
        new AABB(0, 1, 0.5, 1, 0, 0.5),
        new AABB(0, 0.5, 0.5, 1, 0.5, 1),
    };
    quads = new Quad[] {
      new Quad(new Vector3d(14/16., 16/16., 2/16.), new Vector3d(2/16., 16/16., 2/16.),
          new Vector3d(14/16., 16/16., 14/16.), new Vector4d(2/16., 14/16., 2/16., 14/16.)),
    };
  }
View Full Code Here

  private void setUpTorch() {
    quads = new Quad[4];

    // west
    quads[0] = new Quad(new Vector3d(15/16., 3/16., 0),
        new Vector3d(15/16., 3/16., 1),
        new Vector3d((11-12/10.)/16., 1, 0),
        new Vector4d(0, 1, 0, 13/16.));

    // east
    quads[1] = new Quad(new Vector3d((13-12/10.)/16., 1, 0),
        new Vector3d((13-12/10.)/16., 1, 1),
        new Vector3d(17/16., 3/16., 0),
        new Vector4d(1, 0, 13/16., 0));

    // top
    quads[2] = new Quad(
        new Vector3d(13/16., 13/16., 9/16.),
        new Vector3d(13/16., 13/16., 7/16.),
        new Vector3d(11/16., 13/16., 9/16.),
        new Vector4d(9/16., 7/16., 10/16., 8/16.));

    // bottom
    quads[3] = new Quad(
        new Vector3d(15/16., 3/16., 7/16.),
        new Vector3d(17/16., 3/16., 7/16.),
        new Vector3d(15/16., 3/16., 9/16.),
        new Vector4d(7/16., 9/16., 0/16., 2/16.));
View Full Code Here

        ray.color.w = 1;
        hit = true;
      }
    }
    for (int i = 0; i < quads.length; ++i) {
      Quad quad = quads[i];
      if (quad.intersect(ray)) {
        int bottle = (data>>i) & 1;
        float[] color = Texture.brewingStandSide.getColor(
            bottle + (1 - 2 * bottle) * ray.u, ray.v);
        if (color[3] > Ray.EPSILON) {
          ray.color.set(color);
View Full Code Here

  @SuppressWarnings("javadoc")
  public static boolean intersect(Ray ray) {
    boolean hit = false;
    ray.t = Double.POSITIVE_INFINITY;
    for (int i = 0; i < quads.length; ++i) {
      Quad quad = quads[i];
      if (quad.intersect(ray)) {
        float[] color = tex[i].getColor(ray.u, ray.v);
        if (color[3] > Ray.EPSILON) {
          ray.color.set(color);
          ray.t = ray.tNear;
          ray.n.set(quad.n);
View Full Code Here

TOP

Related Classes of se.llbit.math.Quad

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.