Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Vector3


   */
  @Override
  public void modify(ShadingContext context) {
    Basis3 basis = context.getBasis();
    RGB c = painter.getColor(context, WAVELENGTH_PACKET).toRGB();
    Vector3 n = Vector3.unit(c.r() - 0.5, c.g() - 0.5, c.b() - 0.5);
    Vector3 u = basis.u();
    Vector3 v = basis.v();

    basis = Basis3.fromWUV(n, u, v);
    context.setShadingBasis(basis);
  }
View Full Code Here


  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.path.PathNode#getCosine(ca.eandb.jmist.math.Vector3)
   */
  public double getCosine(Vector3 v) {
    Vector3 n = surf.getShadingNormal();
    return Math.abs(v.unit().dot(n));
  }
View Full Code Here

          throw new IllegalArgumentException(
              "grandChild and newParent.getParent() are different.");
        }
      }

      Vector3 v = PathUtil.getDirection(newParent, this);
      Point3 origin = newParent.isAtInfinity()
          ? surf.getPosition().minus(v)
          : newParent.getPosition().toPoint3();
      Ray3 ray = new Ray3(origin, v);
      ScatteredRay sr;
View Full Code Here

   */
  @Override
  public void modify(ShadingContext context) {
    Basis3 basis = context.getShadingBasis();
    RGB c = painter.getColor(context, WAVELENGTH_PACKET).toRGB();
    Vector3 n = basis.toStandard(c.r() - 0.5, 0.5 - c.g(), c.b() - 0.5).unit();
    Vector3 u = basis.u();
    Vector3 v = basis.v();

    basis = Basis3.fromWUV(n, u, v);
    context.setShadingBasis(basis);
  }
View Full Code Here

    boolean aAtInf = a.isAtInfinity();
    boolean bAtInf = b.isAtInfinity();
    if (aAtInf && bAtInf) {
      return 0.0;
    } else if (bAtInf) {
      Vector3 v = (Vector3) b.getPosition();
      return Math.max(a.getCosine(v), 0.0);
    } else if (aAtInf) {
      Vector3 v = (Vector3) a.getPosition();
      return Math.max(b.getCosine(v), 0.0);
    } else {
      Point3 p = (Point3) a.getPosition();
      Point3 q = (Point3) b.getPosition();
      Vector3 v = p.vectorTo(q);
      return Math.max(a.getCosine(v), 0.0) * Math.max(b.getCosine(v.opposite()), 0.0)
          / v.squaredLength();
    }
  }
View Full Code Here

    }
  }

  public static Color join(PathNode a, PathNode b) {

    Vector3 v = PathUtil.getDirection(a, b);

    if (v == null) {
      return null;
    }

    double g = PathUtil.getGeometricFactor(a, b);

    if (g <= 0.0) {
      return null;
    }

    Color etol = a.scatter(v);
    Color ltoe = b.scatter(v.opposite());
    Color c = etol.times(ltoe);

    if (ColorUtil.getTotalChannelValue(c) > 0.0
        && PathUtil.visibility(a, b)) {
View Full Code Here

    Point2 pv = new Point2(p.x(), p.y() + deltaV);
    double h = scale * height.opacity(p);
    double hu = scale * height.opacity(pu);
    double hv = scale * height.opacity(pv);

    Vector3 n = basis.toStandard(h - hu, h - hv, 1.0).unit();
    Vector3 u = basis.u();
    Vector3 v = basis.v();

    basis = Basis3.fromWUV(n, u, v);
    context.setShadingBasis(basis);

  }
View Full Code Here

    TransformableLens lens = new TransformableLens(
        PinholeLens.fromHfovAndAspect(2.0 * Math.atan2(0.25 / 2.0, 0.35), 1.0));

    lens.rotateY(Math.PI);
    lens.translate(new Vector3(278.0, 273.0, -800.0));

    return lens;

  }
View Full Code Here

   */
  public Color getSourceRadiance() {
    PathInfo path = getPathInfo();
    Material material = surf.getMaterial();
    WavelengthPacket lambda = path.getWavelengthPacket();
    Vector3 out = PathUtil.getDirection(this, getParent());
    return material.emission(surf, out, lambda);
  }
View Full Code Here

   * @see ca.eandb.jmist.framework.path.PathNode#sample(double, double, double)
   */
  public ScatteredRay sample(double ru, double rv, double rj) {
    PathInfo path = getPathInfo();
    WavelengthPacket lambda = path.getWavelengthPacket();
    Vector3 v = PathUtil.getDirection(getParent(), this);
    Material material = surf.getMaterial();
    return material.scatter(surf, v, isOnEyePath(), lambda, ru, rv, rj);
  }
View Full Code Here

TOP

Related Classes of ca.eandb.jmist.math.Vector3

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.