Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Point2


    /* (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());

      Ray3    init  = new Ray3(new Point3(nx, ny, 1.0), Vector3.K);
      Interval  I    = LENS_SPHERE.intersect(init);

      if (I.isEmpty()) {
View Full Code Here


   * @param circle The circle to include in the bounding box.
   */
  public void add(Circle circle) {
    if (!circle.isEmpty()) {
      double r = circle.radius();
      Point2 c = circle.center();

      if (this.isEmpty()) {
        minimumX = c.x() - r;
        minimumY = c.y() - r;
        maximumX = c.x() + r;
        maximumY = c.y() + r;
      } else {
        minimumX = Math.min(c.x() - r, minimumX);
        minimumY = Math.min(c.y() - r, minimumY);
        maximumX = Math.max(c.x() + r, maximumX);
        maximumY = Math.max(c.y() + r, maximumY);
      }
    }
  }
View Full Code Here

      final double  v        = 0.5 - y / objPlaneHeight;
      if (!MathUtil.inRangeCC(v, 0.0, 1.0)) {
        return null;
      }

      return new Point2(u, v);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.EyeNode#sample(ca.eandb.jmist.math.Point2, ca.eandb.jmist.framework.Random)
     */
    public ScatteredRay sample(double ru, double rv, double rj) {
      Point2 p = pointOnImagePlane;
      Vector3 v = new Vector3(
          width * (p.x() - 0.5),
          height * (0.5 - p.y()),
          -1.0);
      Ray3 ray = new Ray3(Point3.ORIGIN, v.unit());
      Color color = getWhite();
      double z = v.x() * v.x() + v.y() * v.y() + 1.0;
      double pdf = z * z / (width * height);
 
View Full Code Here

      Ray3 ray = new Ray3(Point3.ORIGIN, x);
      Vector3 v = ray.direction();
      if (-v.z() < MathUtil.EPSILON) {
        return null;
      }
      Point2 p = new Point2(
          0.5 - v.x() / (width * v.z()),
          0.5 + v.y() / (height * v.z()));
      return Box2.UNIT.contains(p) ? p : null;
    }
View Full Code Here

    this.plane = Plane3.throughPoint(this.origin, this.basis.w());

    this.vertices.clear();
    for (int i = 0; i < vertices.length; i++) {
      Vector3 r = this.origin.vectorTo(vertices[i]);
      this.vertices.add(new Point2(r.dot(basis.u()), r.dot(basis.v())));
    }

    for (int i = 0; i < components.length; i++) {
      this.insert(new Component(components[i]), null);
    }
View Full Code Here

    int i, count = 0;

    for (i = 0; i < component.indices.length; i++) {
      int    ni = (i < component.indices.length - 1) ? i + 1 : 0;
      Point2  a = this.vertices.get(component.indices[i]);
      Point2  b = this.vertices.get(component.indices[ni]);

      if (this.intersects(p, a, b)) count++;
    }

    if (count % 2 == 0)
View Full Code Here

    if (!recorder.interval().contains(t))
      return;

    Point3      p = ray.pointAt(t);
    Vector3      r = p.vectorFrom(this.origin);
    Point2      uv = new Point2(r.dot(basis.u()), r.dot(basis.v()));

    if (!this.inside(uv))
      return;

    Point2      inversion = new Point2(
              (uv.x() - this.bound.minimumX()) / this.bound.lengthX(),
              (uv.y() - this.bound.minimumY()) / this.bound.lengthY()
            );

    Vector3      N = this.plane.normal();
View Full Code Here

  private Iterable<Point3> getVertices() {

    List<Point3> vertexList = new ArrayList<Point3>();

    for (int i = 0; i < this.vertices.size(); i++) {
      Point2 p = this.vertices.get(i);
      Point3 vertex = this.pointAt(p);

      vertexList.add(vertex);
    }
View Full Code Here

    }

    private double getOuterArea() {
      double area = 0.0;
      for (int i = 0; i < indices.length - 1; i++) {
        Point2 a = vertices.get(indices[i]);
        Point2 b = vertices.get(indices[i + 1]);

        area += a.x() * b.y() - b.x() * a.y();
      }
      area /= 2.0;
      return area;
    }
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.