Ejemplo n.º 1
0
 override public Vector3 intersect(Vector3Pair ray)
 {
     //static int count = 0;
     //count++;
     if (_feder_algo)
     {
         Vector3Pair v3p = compute_intersection(ray.origin(), ray.direction(), this);
         if (v3p == null)
         {
             return(null);
         }
         return(v3p.point());
         // normal.normalize();
         //	  if (ok && count % 25 == 0)
         //	    {
         //	      printf ("{ %.16f, %.16f", this->_r, this->_k);
         //	      printf (", %.16f, %.16f, %.16f, %.16f, %.16f, %.16f",
         //this->_A4,              this->_A6, this->_A8, this->_A10, this->_A12, this->_A14);
         //	      printf (", %.16f, %.16f, %.16f", ray.origin ().x (),
         //		      ray.origin ().y (), ray.origin ().z ());
         //	      printf (", %.16f, %.16f, %.16f", ray.direction ().x (),
         //		      ray.direction ().y (), ray.direction ().z ());
         //	      printf (", %.16f, %.16f, %.16f },\n", point.x (), point.y
         //(),             point.z ());
         //	    }
     }
     else
     {
         return(base_intersect(ray));
     }
 }
Ejemplo n.º 2
0
 public Transform3(Vector3Pair position)
 {
     this.translation = position.point();
     if (position.direction().x() == 0 && position.direction().y() == 0)
     {
         if (position.direction().z() < 0.0)
         {
             this.rotation_matrix     = Matrix3.diag(1.0, 1.0, -1.0);
             this.use_rotation_matrix = true;
         }
         else
         {
             this.rotation_matrix     = Matrix3.diag(1.0, 1.0, 1.0);
             this.use_rotation_matrix = false;
         }
     }
     else
     {
         // Get a rotation matrix representing the rotation of unit vector in z
         // to the direction vector.
         this.rotation_matrix     = Matrix3.get_rotation_between(Vector3.vector3_001, position.direction());
         this.use_rotation_matrix = true;
     }
 }
Ejemplo n.º 3
0
 public override void draw_segment(Vector3Pair l, Rgb rgb)
 {
     draw_segment(new Vector2Pair(project(l.point()), project(l.direction())), rgb);
 }