コード例 #1
0
        public bool validFlatPlaneModification(Intersection in_before, Intersection in_after, Trace aTrace)
        {
            Vector     in_dir                  = aTrace.traceline.direction;
            UnitVector old_norm                = in_before.enter.flatshape.plane.getNorm();
            UnitVector new_norm                = in_after.enter.flatshape.plane.getNorm();
            Vector     refl_dir                = in_dir.reflectOnSurface(new_norm);
            bool       reflection_ok           = in_dir.dotProduct(old_norm) * refl_dir.dotProduct(old_norm) < 0;
            bool       incident_side_unchanged = in_dir.dotProduct(old_norm) * in_dir.dotProduct(new_norm) > 0;

/*		Console.WriteLine("reflection: "+reflection_ok+ ", side: "+incident_side_unchanged);
 *      Console.WriteLine("Incident beam dir: "+in_dir.ToString()+" dotp:"+in_dir.dotProduct(old_norm));
 *      Console.WriteLine("Refl beam dir: "+refl_dir.ToString()+" dotp:"+refl_dir.dotProduct(new_norm));*/
            return(incident_side_unchanged && reflection_ok);
        }
コード例 #2
0
 public Scientrace.Vector dotProductMatrixWithVector(Scientrace.Vector a, Scientrace.Vector b, Scientrace.Vector c, Scientrace.Vector aVector)
 {
     Scientrace.Vector retvec = new Scientrace.Vector(0, 0, 0);
     Scientrace.Vector tvec   = null;
     for (int irow = 0; irow <= 2; irow++)
     {
         tvec = new Vector(a.readIndex(irow), b.readIndex(irow), c.readIndex(irow));
         retvec.onIndexWrite(irow, tvec.dotProduct(aVector));
     }
     return(retvec);
 }