Subversion Repositories gelsvn

Rev

Rev 569 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 569 Rev 570
Line 43... Line 43...
43
             ArithVec3Float<T,V>& b1, 
43
             ArithVec3Float<T,V>& b1, 
44
             ArithVec3Float<T,V>& b2)
44
             ArithVec3Float<T,V>& b2)
45
    {
45
    {
46
      if(n[2] < -0.9999999f) // Handle the singularity
46
      if(n[2] < -0.9999999f) // Handle the singularity
47
      {
47
      {
48
        b1 = V( 0.0f, -1.0f, 0.0f);
48
        b1 = V(1.0f,  0.0f, 0.0f);
49
        b2 = V(-1.0f,  0.0f, 0.0f);
49
        b2 = V(0.0f, -1.0f, 0.0f);
50
        return;
50
        return;
51
      }
51
      }
52
      const T a = 1.0f/(1.0f + n[2]);
52
      const T a = 1.0f/(1.0f + n[2]);
53
      const T b = -n[0]*n[1]*a;
53
      const T b = n[0]*n[1]*a;
54
      b1 = V(1.0f - n[0]*n[0]*a, b, -n[0]);
54
      b1 = V(b, n[1]*n[1]*a - 1.0f, n[1]);
55
      b2 = V(b, 1.0f - n[1]*n[1]*a, -n[1]);
55
      b2 = V(1.0f - n[0]*n[0]*a, -b, -n[0]);
56
    }
56
    }
57
 
57
 
58
		template class ArithVec3Float<float, Vec3f>;
58
		template class ArithVec3Float<float, Vec3f>;
59
		template void orthogonal<float,Vec3f>(const ArithVec3Float<float,Vec3f>& a, 
59
		template void orthogonal<float,Vec3f>(const ArithVec3Float<float,Vec3f>& n, 
60
																					ArithVec3Float<float,Vec3f>& b, 
60
																					ArithVec3Float<float,Vec3f>& b1, 
61
																					ArithVec3Float<float,Vec3f>& c);
61
																					ArithVec3Float<float,Vec3f>& b2);
62
    template void onb<float,Vec3f>(const ArithVec3Float<float,Vec3f>& n, 
62
    template void onb<float,Vec3f>(const ArithVec3Float<float,Vec3f>& n, 
63
                                   ArithVec3Float<float,Vec3f>& b1, 
63
                                   ArithVec3Float<float,Vec3f>& b1, 
64
                                   ArithVec3Float<float,Vec3f>& b2);
64
                                   ArithVec3Float<float,Vec3f>& b2);
65
 
65
 
66
		template class ArithVec3Float<double, Vec3d>;
66
		template class ArithVec3Float<double, Vec3d>;
67
		template void orthogonal<double,Vec3d>(const ArithVec3Float<double,Vec3d>& a,
67
		template void orthogonal<double,Vec3d>(const ArithVec3Float<double,Vec3d>& n,
68
																					 ArithVec3Float<double,Vec3d>& b, 
68
																					 ArithVec3Float<double,Vec3d>& b1, 
69
																					 ArithVec3Float<double,Vec3d>& c);
69
																					 ArithVec3Float<double,Vec3d>& b2);
70
    template void onb<double,Vec3d>(const ArithVec3Float<double,Vec3d>& n, 
70
    template void onb<double,Vec3d>(const ArithVec3Float<double,Vec3d>& n, 
71
                                    ArithVec3Float<double,Vec3d>& b1, 
71
                                    ArithVec3Float<double,Vec3d>& b1, 
72
                                    ArithVec3Float<double,Vec3d>& b2);
72
                                    ArithVec3Float<double,Vec3d>& b2);
73
}
73
}