Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Vector2


    public Node(Point2 p, PathInfo pathInfo, double ru, double rv, double rj) {
      super(pathInfo, ru, rv, rj);
      this.pointOnImagePlane = p;

      Vector2 uv = RandomUtil.uniformOnDisc(apertureRadius, ru, rv).toCartesian();
      Point3 origin = new Point3(uv.x(), uv.y(), 0.0);
      Point3 focus = new Point3(
          (pointOnImagePlane.x() - 0.5) * objPlaneWidth,
          (0.5 - pointOnImagePlane.y()) * objPlaneHeight,
          -focusDistance);

View Full Code Here


      Point3 c = vertices.get(indices[decomp[tri + 2]]);

      Vector3 ab = a.vectorTo(b);
      Vector3 ac = a.vectorTo(c);

      Vector2 tab = ta.vectorTo(tb);
      Vector2 tac = ta.vectorTo(tc);

      double r = 1.0 / (tab.x() * tac.y() - tab.y() * tac.x());

      Vector3 n = plane.normal();
      Vector3 u = new Vector3(
          r * (tac.y() * ab.x() - tab.y() * ac.x()),
          r * (tac.y() * ab.y() - tab.y() * ac.y()),
          r * (tac.y() * ab.z() - tab.y() * ac.z()));
      Vector3 v = new Vector3(
          r * (tab.x() * ac.x() - tac.x() * ab.x()),
          r * (tab.x() * ac.y() - tac.x() * ab.y()),
          r * (tab.x() * ac.z() - tac.x() * ab.z()));

      return Basis3.fromWUV(n, u, v);
    }
View Full Code Here

  public static Point2 uniformOnTriangle(Point2 a, Point2 b, Point2 c, double alpha, double beta) {
    if (alpha + beta > 1.0) {
      alpha = 1.0 - alpha;
      beta = 1.0 - beta;
    }
    Vector2 ab = a.vectorTo(b).times(alpha);
    Vector2 ac = a.vectorTo(c).times(beta);
    return a.plus(ab).plus(ac);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.geometry.PrimitiveGeometry#generateRandomSurfacePoint(ca.eandb.jmist.framework.ShadingContext)
   */
  @Override
  public void generateRandomSurfacePoint(ShadingContext context, double ru, double rv, double rj) {
    Vector2 uv = RandomUtil.uniformOnDisc(boundingSphere.radius(), ru, rv).toCartesian();
    Basis3 basis = Basis3.fromW(this.plane.normal(), Basis3.Orientation.RIGHT_HANDED);

    Point3 p = boundingSphere.center()
        .plus(basis.u().times(uv.x()))
        .plus(basis.v().times(uv.y()));

    int id = (twoSided && RandomUtil.coin(rj))
        ? DISC_SURFACE_BOTTOM
        : DISC_SURFACE_TOP;

View Full Code Here

TOP

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

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.