Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Point2


            u += 0.5;
        }

        Intersection x = super.newIntersection(ray, t, true, fromTop ? RECTANGLE_SURFACE_TOP : RECTANGLE_SURFACE_BOTTOM)
          .setLocation(p)
          .setUV(new Point2(u, v));

        recorder.record(x);

      }
View Full Code Here


   */
  public Color shadeRay(Ray3 ray, WavelengthPacket lambda) {
    SphericalCoordinates sc = SphericalCoordinates.fromCartesian(ray.direction(), basis);
    double theta = -sc.azimuthal();
    double r = 0.5 * (1.0 - (Math.PI - sc.polar()) / Math.PI);
    Point2 uv = new Point2(
        0.5 + r * Math.cos(theta),
        0.5 + r * Math.sin(theta));
    return texture.evaluate(uv, lambda);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.RayShader#shadeRay(ca.eandb.jmist.math.Ray3, ca.eandb.jmist.framework.color.WavelengthPacket)
   */
  public Color shadeRay(Ray3 ray, WavelengthPacket lambda) {
    SphericalCoordinates sc = SphericalCoordinates.fromCartesian(ray.direction(), basis);
    Point2 uv = new Point2(
        (sc.azimuthal() + Math.PI) / (2.0 * Math.PI),
        sc.polar() / Math.PI);
    return texture.evaluate(uv, lambda);
  }
View Full Code Here

   * @see ca.eandb.jmist.framework.RayShader#shadeRay(ca.eandb.jmist.math.Ray3, ca.eandb.jmist.framework.color.WavelengthPacket)
   */
  public Color shadeRay(Ray3 ray, WavelengthPacket lambda) {
    if (ray.direction().dot(basis.w()) >= 0.0) {
      SphericalCoordinates sc = SphericalCoordinates.fromCartesian(ray.direction(), basis);
      Point2 uv = new Point2(
          (sc.azimuthal() + Math.PI) / (2.0 * Math.PI),
          2.0 * sc.polar() / Math.PI);
      return texture.evaluate(uv, lambda);
    } else {
      return background.shadeRay(ray, lambda);
View Full Code Here

  protected Point2 getTextureCoordinates(GeometryIntersection x) {
    Point3 p = x.getPosition();
    switch (x.getTag()) {
    case CONE_SURFACE_BODY:
      double angle = Math.PI + Math.atan2(p.z(), p.x());
      return new Point2(angle / ((capped ? 4.0 : 2.0) * Math.PI),
          p.y() / height);

    case CONE_SURFACE_BASE:
      return new Point2(0.5 + (p.x() + radius) / (4.0 * radius),
          (p.z() + radius) / (4.0 * radius));

    default:
      throw new IllegalArgumentException("Invalid surface ID");
    }
View Full Code Here

  protected Point2 getTextureCoordinates(GeometryIntersection x) {
    Point3 p = x.getPosition();
    switch (x.getTag()) {
    case TAPERED_CYLINDER_SURFACE_BODY:
      double angle = Math.PI + Math.atan2(p.z(), p.x());
      return new Point2(angle / ((capped ? 4.0 : 2.0) * Math.PI),
          (p.y() - height1) / (height2 - height1));

    case TAPERED_CYLINDER_SURFACE_END_1:
      return new Point2(0.5 + (p.x() + radius1) / (4.0 * radius1),
          (p.z() + radius1) / (4.0 * radius1));

    case TAPERED_CYLINDER_SURFACE_END_2:
      return new Point2(0.5 + (p.x() + radius2) / (4.0 * radius2),
          (p.z() + radius2) / (4.0 * radius2));

    default:
      throw new IllegalArgumentException("Invalid surface ID");
    }
View Full Code Here

      }
      double h = v.y() / Math.hypot(v.x(), v.z());
      if (Math.abs(h) > 0.5 * height) {
        return null;
      }
      return new Point2(
          0.5 + theta / hfov,
          0.5 - h / height);
    }
View Full Code Here

      double d = v.length();

      if (-v.z() / d < MathUtil.EPSILON) {
        return null;
      }
      return new Point2(
          (v.x() / d + 1.0) / 2.0,
          (1.0 - v.y() / d) / 2.0);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#sample(double, double, double)
     */
    @Override
    public ScatteredRay sample(double ru, double rv, double rj) {
      Point2  p = pointOnImagePlane;
      double  nx = 2.0 * (p.x() - 0.5);
      double  ny = 2.0 * (0.5 - p.y());
      double  d2 = nx * nx + ny * ny;

      if (d2 > 1.0)
        return null;

View Full Code Here

      this.inner = inner;
    }

    @Override
    public Point2 project(HPoint3 x) {
      Point2 p = inner.project(x);
      return p != null && bounds.contains(p)
        ? new Point2(
          (p.x() - bounds.minimumX()) / bounds.lengthX(),
          (p.y() - bounds.minimumY()) / bounds.lengthY())
        : null;
    }
View Full Code Here

TOP

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

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.