public Ray(V3 origin, V3 direction, Object3D originObject = null)
        {
            Origin = origin;

            Direction = direction;
            Direction.Normalize();

            OriginObject = originObject;

            Distance = float.MaxValue;
        }
 public V3(V3 t)
 {
     X = t.X;
     Y = t.Y;
     Z = t.Z;
 }
        public V3 RefractedVector(V3 normalVec, float n1, float n2)
        {
            float n;
               float cosI;
               if (normalVec * this < 0.0f) { // medium 1 -> medium 2
               n = n1 / n2;
               cosI = -normalVec * this;
               }
               else { // medium 2 -> medium 1
               n = n2 / n1;
               cosI = normalVec * this;
               }

               float sinT_pow2 = n * n * (1.0f - (cosI * cosI));
               float cosT = Mathf.Sqrt(1.0f - sinT_pow2);
               return n * this + (n * cosI - cosT) * normalVec;
        }
 /// Gets the reflected vector to the surface defined by normalVec for
 /// the current (incident) vector.
 public V3 ReflectedVector(V3 normalVec)
 {
     return 2 * (normalVec * this)
              * normalVec - this;
 }
Esempio n. 5
0
 /// Gets the reflected vector to the surface defined by normalVec for
 /// the current (incident) vector.
 public V3 ReflectedVector(V3 normalVec)
 {
     return(2 * (normalVec * this)
            * normalVec - this);
 }
Esempio n. 6
0
 public V3(V3 t)
 {
     X = t.X;
     Y = t.Y;
     Z = t.Z;
 }