Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Polynomial


    double z0 = org.z() / radius;
    double x1 = dir.x() / radius;
    double y1 = dir.y() / height;
    double z1 = dir.z() / radius;

    Polynomial f = new Polynomial(
        x0 * x0 - y0 * y0 + z0 * z0,
        2.0 * (x0 * x1 - y0 * y1 + z0 * z1),
        x1 * x1 - y1 * y1 + z1 * z1);

    double[] t = f.roots();

    if (t.length == 2) {
      for (int i = 0; i < 2; i++) {
        if (recorder.interval().contains(t[i])) {
          Point3 p = ray.pointAt(t[i]);
View Full Code Here


    double z0 = ray.origin().z() * dh;
    double x1 = ray.direction().x() * dh;
    double y1 = ray.direction().y() * dr;
    double z1 = ray.direction().z() * dh;

    Polynomial f = new Polynomial(
        x0 * x0 - y0 * y0 + z0 * z0,
        2.0 * (x0 * x1 - y0 * y1 + z0 * z1),
        x1 * x1 - y1 * y1 + z1 * z1);

    double[] t = f.roots();

    if (t.length == 2) {
      for (int i = 0; i < 2; i++) {
        if (recorder.interval().contains(t[i])) {
          Point3 p = ray.pointAt(t[i]);
View Full Code Here

    double    s2NormOfDir    = dir.squaredLength();
    double    s2NormOfOrig  = orig.squaredLength();
    double    dirDotOrig    = dir.dot(orig);
    double    K        = s2NormOfOrig - (sqRadius1 + sqRadius2);

    Polynomial  f = new Polynomial(
              K * K - 4.0 * sqRadius1 * (sqRadius2 - orig.y() * orig.y()),
              4.0 * dirDotOrig * (s2NormOfOrig - (sqRadius1 + sqRadius2)) + 8.0 * sqRadius1 * dir.y() * orig.y(),
              2.0 * s2NormOfDir * (s2NormOfOrig - (sqRadius1 + sqRadius2)) + 4.0 * ((dirDotOrig * dirDotOrig) + sqRadius1 * dir.y() * dir.y()),
              4.0 * dirDotOrig * s2NormOfDir,
              s2NormOfDir * s2NormOfDir
          );

    double[]  x = f.roots();

    if (x.length > 1)
    {
      Arrays.sort(x);
      for (int i = 0; i < x.length; i++)
View Full Code Here

    // now check for intersection of ray with the body
    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)
    {
      // for each solution, make sure the point lies between the base and the apex
      p = ray.pointAt(x[0]);
View Full Code Here

TOP

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

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.