Changeset 4067 for trunk/packages/vizservers/nanovis/TransferFunction.cpp
 Timestamp:
 Nov 15, 2013, 10:29:27 PM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/packages/vizservers/nanovis/TransferFunction.cpp
r3611 r4067 59 59 60 60 void 61 TransferFunction::sample(float fraction, float *key , int count, Vector3f *keyValue, Vector3f *ret)61 TransferFunction::sample(float fraction, float *keys, Vector3f *keyValues, int count, Vector3f *ret) 62 62 { 63 63 int limit = count  1; 64 if (fraction <= key [0]) {65 *ret = keyValue [0];66 } else if (fraction >= key [limit]) {67 *ret = keyValue [limit];64 if (fraction <= keys[0]) { 65 *ret = keyValues[0]; 66 } else if (fraction >= keys[limit]) { 67 *ret = keyValues[limit]; 68 68 } else { 69 69 int n; 70 for (n = 0; n < limit; n++) {71 if (fraction >= key [n] && fraction < key[n+1]) break;70 for (n = 0; n < limit; n++) { 71 if (fraction >= keys[n] && fraction < keys[n+1]) break; 72 72 } 73 73 if (n >= limit) { 74 *ret = keyValue [limit];74 *ret = keyValues[limit]; 75 75 } else { 76 float inter = (fraction  key [n]) / (key[n + 1]  key[n]);77 ret>set(inter * (keyValue [n + 1].x  keyValue[n].x) + keyValue[n].x,78 inter * (keyValue [n + 1].y  keyValue[n].y) + keyValue[n].y,79 inter * (keyValue [n + 1].z  keyValue[n].z) + keyValue[n].z);76 float inter = (fraction  keys[n]) / (keys[n + 1]  keys[n]); 77 ret>set(inter * (keyValues[n + 1].x  keyValues[n].x) + keyValues[n].x, 78 inter * (keyValues[n + 1].y  keyValues[n].y) + keyValues[n].y, 79 inter * (keyValues[n + 1].z  keyValues[n].z) + keyValues[n].z); 80 80 } 81 81 } … … 83 83 84 84 void 85 TransferFunction::sample(float fraction, float *key , int count, float *keyValue, float *ret)85 TransferFunction::sample(float fraction, float *keys, float *keyValues, int count, float *ret) 86 86 { 87 87 int limit = count  1; 88 if (fraction <= key [0]) {89 *ret = keyValue [0];90 } else if (fraction >= key [limit]) {91 *ret = keyValue [limit];88 if (fraction <= keys[0]) { 89 *ret = keyValues[0]; 90 } else if (fraction >= keys[limit]) { 91 *ret = keyValues[limit]; 92 92 } else { 93 93 int n; 94 for (n = 0; n < limit; n++) {95 if (fraction >= key [n] && fraction < key[n+1]) break;94 for (n = 0; n < limit; n++) { 95 if (fraction >= keys[n] && fraction < keys[n+1]) break; 96 96 } 97 97 if (n >= limit) { 98 *ret = keyValue [limit];98 *ret = keyValues[limit]; 99 99 } else { 100 float inter = (fraction  key [n]) / (key[n + 1]  key[n]);101 *ret = inter * (keyValue [n + 1]  keyValue[n]) + keyValue[n];100 float inter = (fraction  keys[n]) / (keys[n + 1]  keys[n]); 101 *ret = inter * (keyValues[n + 1]  keyValues[n]) + keyValues[n]; 102 102 } 103 103 }
Note: See TracChangeset
for help on using the changeset viewer.