Package ca.eandb.jmist.math

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


      Vector3 v = ray.direction();
      double theta = Math.atan2(v.x(), -v.z());
      if (Math.abs(theta) > 0.5 * hfov) {
        return null;
      }
      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,
View Full Code Here


    public Point2 project(HPoint3 x) {
      Vector3 v = x.isPoint() ? x.toPoint3().vectorFromOrigin()
                              : x.toVector3();
      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

  }

  public static CIEXYZ convertRGB2XYZ(double r, double g, double b) {
    Vector3 rgb = new Vector3(linearize(r), linearize(g), linearize(b));
    Vector3 xyz = sRGBLin_TO_XYZ.times(rgb);
    return new CIEXYZ(xyz.x(), xyz.y(), xyz.z());
  }

  public static CIEXYZ convertRGB2XYZ(RGB rgb) {
    return convertRGB2XYZ(rgb.r(), rgb.g(), rgb.b());
  }
View Full Code Here

    Vector3 xyz = new Vector3(x, y, z);
    Vector3 rgb = XYZ_TO_sRGBLin.times(xyz);
    return new RGB(
        delinearize(rgb.x()),
        delinearize(rgb.y()),
        delinearize(rgb.z()));
  }

  public static RGB convertXYZ2RGB(CIEXYZ xyz) {
    return convertXYZ2RGB(xyz.X(), xyz.Y(), xyz.Z());
  }
View Full Code Here

     * @see ca.eandb.jmist.framework.path.EyeNode#project(ca.eandb.jmist.math.HPoint3)
     */
    public Point2 project(HPoint3 x) {
      Ray3 ray = new Ray3(Point3.ORIGIN, x);
      Vector3 v = ray.direction().unit();
      double phi = Math.atan2(v.x(), -v.z());
      if (Math.abs(phi) > 0.5 * hfov) {
        return null;
      }
      double theta = Math.asin(v.y());
      if (Math.abs(theta) > 0.5 * vfov) {
View Full Code Here

   * @see ca.eandb.jmist.framework.geometry.AbstractGeometry#getTextureCoordinates(ca.eandb.jmist.framework.geometry.AbstractGeometry.GeometryIntersection)
   */
  @Override
  protected Point2 getTextureCoordinates(GeometryIntersection x) {
    Vector3          n = x.getNormal();
    SphericalCoordinates  sc = SphericalCoordinates.fromCartesian(new Vector3(n.x(), -n.z(), n.y()));

    return new Point2(
        (Math.PI + sc.azimuthal()) / (2.0 * Math.PI),
        sc.polar() / Math.PI
    );
View Full Code Here

    Vector3    orig  = this.base.vectorTo(ray.origin());
    Vector3    dir    = ray.direction();

    Polynomial  f    = new Polynomial(
                orig.x() * orig.x() + orig.z() * orig.z() - this.radius * this.radius,
                2.0 * (orig.x() * dir.x() + orig.z() * dir.z()),
                dir.x() * dir.x() + dir.z() * dir.z()
              );
    double[]  x    = f.roots();

    if (x.length == 2)
View Full Code Here

    Vector3    dir    = ray.direction();

    Polynomial  f    = new Polynomial(
                orig.x() * orig.x() + orig.z() * orig.z() - this.radius * this.radius,
                2.0 * (orig.x() * dir.x() + orig.z() * dir.z()),
                dir.x() * dir.x() + dir.z() * dir.z()
              );
    double[]  x    = f.roots();

    if (x.length == 2)
    {
View Full Code Here

    Vector3    dir    = ray.direction();

    Polynomial  f    = new Polynomial(
                orig.x() * orig.x() + orig.z() * orig.z() - this.radius * this.radius,
                2.0 * (orig.x() * dir.x() + orig.z() * dir.z()),
                dir.x() * dir.x() + dir.z() * dir.z()
              );
    double[]  x    = f.roots();

    if (x.length == 2)
    {
View Full Code Here

   */
  @Override
  protected Point2 getTextureCoordinates(GeometryIntersection x) {

    Vector3    r    = this.base.vectorTo(x.getPosition());
    double    tx    = (Math.PI + Math.atan2(r.z(), r.x())) / (2.0 * Math.PI);
    double    ty;

    switch (x.getTag()) {

    case CYLINDER_SURFACE_BASE:
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.