Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Point3.z()


      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


      Point3 p = x.getPosition();

      return Vector3.unit(
          p.x() * dh2,
          -dr * (dr * p.y() + det),
          p.z() * dh2);
//
//      double dh = height2 - height1;
//      double dr = radius2 - radius1;
//      double side = Math.hypot(dr, dh);
//      double c = dr / side;
View Full Code Here

  @Override
  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),
 
View Full Code Here

      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));

 
View Full Code Here

      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

   */
  @Override
  protected Vector3 getNormal(GeometryIntersection x) {

    Point3  p = x.getPosition();
    Vector3  rel = new Vector3(p.x(), 0.0, p.z());

    double  length = rel.length();

    if (length > 0.0)
    {
View Full Code Here

   */
  @Override
  protected Basis3 getBasis(GeometryIntersection x) {

    Point3  p  = x.getPosition();
    Vector3  u  = new Vector3(-p.z(), 0.0, p.x()).unit();

    return Basis3.fromWU(x.getNormal(), u, Basis3.Orientation.RIGHT_HANDED);

  }

View Full Code Here

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

      if (r < this.radius * this.radius)
      {
        Intersection x = super.newIntersection(ray, t, (ray.direction().y() < 0.0), CYLINDER_SURFACE_TOP)
          .setLocation(p);
View Full Code Here

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

      if (r < this.radius * this.radius)
      {
        Intersection x = super.newIntersection(ray, t, (ray.direction().y() < 0.0), CYLINDER_SURFACE_TOP)
          .setLocation(p);
View Full Code Here

    case CYLINDER_SURFACE_TOP:
      return Vector3.J;

    case CYLINDER_SURFACE_BODY:
      Point3 p = x.getPosition();
      return new Vector3(p.x() - this.base.x(), 0.0, p.z()
          - this.base.z()).unit();

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

TOP
Copyright © 2018 www.massapi.com. 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.