Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Interval


  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.scene.SceneElementDecorator#visibility(ca.eandb.jmist.math.Ray3)
   */
  @Override
  public boolean visibility(Ray3 ray) {
    NearestIntersectionRecorder recorder = new NearestIntersectionRecorder(new Interval(0.0, ray.limit()));
    intersect(ray, recorder);
    return recorder.isEmpty();
  }
View Full Code Here


  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.SceneElement#intersects(int, ca.eandb.jmist.math.Ray3)
   */
  public boolean visibility(int index, Ray3 ray) {
    Interval I = new Interval(0.0, ray.limit());
    NearestIntersectionRecorder recorder = new NearestIntersectionRecorder(I);
    intersect(index, ray, recorder);
    return recorder.isEmpty();
  }
View Full Code Here

   * @see ca.eandb.jmist.framework.geometry.PrimitiveGeometry#intersect(ca.eandb.jmist.math.Ray3, ca.eandb.jmist.framework.IntersectionRecorder)
   */
  @Override
  public void intersect(Ray3 ray, IntersectionRecorder recorder) {

    Interval I = this.sphere.intersect(ray);

    if (!I.isEmpty()) {
      recorder.record(super.newIntersection(ray, I.minimum(), true));
      recorder.record(super.newIntersection(ray, I.maximum(), false));
    }

  }
View Full Code Here

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.geometry.PrimitiveGeometry#intersect(ca.eandb.jmist.math.Ray3, ca.eandb.jmist.framework.IntersectionRecorder)
   */
  public void intersect(Ray3 ray, IntersectionRecorder recorder) {

    Interval  I    = recorder.interval();
    Point3    p;
    double    t;

    // first check for intersection of ray with the caps on the ends of the cylinder

    // check bottom cap
    t = (this.base.y() - ray.origin().y()) / ray.direction().y();
    if (I.contains(t))
    {
      p = ray.pointAt(t);

      if (this.base.squaredDistanceTo(p) < this.radius * this.radius)
      {
        Intersection x = super.newIntersection(ray, t, (ray.direction().y() > 0.0), CYLINDER_SURFACE_BASE)
          .setLocation(p);

        recorder.record(x);
      }
    }

    // check top cap
    t = (this.base.y() + this.height - ray.origin().y()) / ray.direction().y();
    if (I.contains(t))
    {
      p = ray.pointAt(t);

      double r = (p.x() - this.base.x()) * (p.x() - this.base.x()) + (p.z() - this.base.z()) * (p.z() - this.base.z());

View Full Code Here

  }

  private static List<Double> getIntervals(Ray3 ray) {

    ArrayList<Double> vt = new ArrayList<Double>(11);
    Interval I = SUPERELLIPSOID_BOUNDING_BOX.intersect(ray);

    if (I.isEmpty())
      return vt;

    vt.add(I.minimum());
    vt.add(I.maximum());

    for (int i = 0; i < PLANES.length; i++) {
      double t = PLANES[i].intersect(ray);
      if (I.contains(t))
        vt.add(t);
    }

    Collections.sort(vt);
    return vt;
View Full Code Here

    this.channel = channel;
    this.range = range;
  }

  public LinearChannelVisualizer(int channel, double minimum, double maximum) {
    this(channel, new Interval(minimum, maximum));
  }
View Full Code Here

        Point3 p1 = ray.pointAt(I.maximum());

        /* Get the range of y-values for the ray within the cell, and
         * get the portion of the height matrix within the cell.
         */
        Interval h = Interval.between(p0.y(), p1.y());
        Matrix slice = height.slice(cell.getX(), cell.getZ(), 2, 2);

        boolean hit = false;

        /* If the range of y-values intersect, then there may be an
         * intersection.
         */
        if (h.intersects(slice.range())) {

          Box3 bounds = cell.getBoundingBox();

          /* Get the points on the height field. */
          Point3 p00 = new Point3(bounds.minimumX(), slice.at(0, 0), bounds.minimumZ());
View Full Code Here

TOP

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

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.