Changeset 3397 for trunk/psLib/src/math/psSpline.c
- Timestamp:
- Mar 9, 2005, 3:11:12 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psSpline.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psSpline.c
r3384 r3397 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.9 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-03- 08 02:27:47$9 * @version $Revision: 1.93 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-03-10 01:11:12 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1313 1313 1314 1314 psVector *tmp; 1315 psVector *myX;1316 psVector *myY;1317 psVector *myZ;1318 psS32 i;1319 1315 psS32 vecLen=x->n; 1320 1316 1321 vecLen=x->n;1317 // Determine the length of output vector from min of the input vectors 1322 1318 if (y->n < vecLen) { 1323 1319 vecLen = y->n; … … 1327 1323 } 1328 1324 1325 // Allocate output vector 1329 1326 tmp = psVectorAlloc(vecLen, PS_TYPE_F32); 1330 for (i=0;i<vecLen;i++) { 1327 1328 // Evaluate polynomial 1329 for (psS32 i = 0; i < vecLen; i++) { 1331 1330 tmp->data.F32[i] = psPolynomial3DEval(myPoly, 1332 myX->data.F32[i], 1333 myY->data.F32[i], 1334 myZ->data.F32[i]); 1335 1336 } 1337 1338 if (x->type.type != PS_TYPE_F32) { 1339 psFree(myX); 1340 } 1341 if (y->type.type != PS_TYPE_F32) { 1342 psFree(myY); 1343 } 1344 if (z->type.type != PS_TYPE_F32) { 1345 psFree(myZ); 1346 } 1331 x->data.F32[i], 1332 y->data.F32[i], 1333 z->data.F32[i]); 1334 } 1335 1336 // Return output vector 1347 1337 return(tmp); 1348 1338 } … … 1381 1371 1382 1372 psVector *tmp; 1383 psVector *myW; 1384 psVector *myX; 1385 psVector *myY; 1386 psVector *myZ; 1387 psS32 i; 1388 psS32 vecLen=x->n; 1389 1390 vecLen=w->n; 1373 psS32 vecLen=w->n; 1374 1375 // Determine output vector size from min of input vectors 1391 1376 if (y->n < vecLen) { 1392 1377 vecLen = y->n; … … 1399 1384 } 1400 1385 1386 // Allocate output vector 1401 1387 tmp = psVectorAlloc(vecLen, PS_TYPE_F32); 1402 for (i=0;i<vecLen;i++) { 1388 1389 // Evaluate polynomial 1390 for (psS32 i = 0; i < vecLen; i++) { 1403 1391 tmp->data.F32[i] = psPolynomial4DEval(myPoly, 1404 myW->data.F32[i], 1405 myX->data.F32[i], 1406 myY->data.F32[i], 1407 myZ->data.F32[i]); 1408 1409 } 1410 1411 if (w->type.type != PS_TYPE_F32) { 1412 psFree(myW); 1413 } 1414 if (x->type.type != PS_TYPE_F32) { 1415 psFree(myX); 1416 } 1417 if (y->type.type != PS_TYPE_F32) { 1418 psFree(myY); 1419 } 1420 if (z->type.type != PS_TYPE_F32) { 1421 psFree(myZ); 1422 } 1392 w->data.F32[i], 1393 x->data.F32[i], 1394 y->data.F32[i], 1395 z->data.F32[i]); 1396 } 1397 1398 // Return output vector 1423 1399 return(tmp); 1424 1400 } … … 1708 1684 1709 1685 psVector *tmp; 1710 psVector *myX;1711 psVector *myY;1712 psVector *myZ;1713 psS32 i;1714 1686 psS32 vecLen=x->n; 1715 1687 1716 vecLen=x->n;1688 // Determine the size of output vector from min of input vectors 1717 1689 if (y->n < vecLen) { 1718 1690 vecLen = y->n; … … 1722 1694 } 1723 1695 1696 // Allocate output vector 1724 1697 tmp = psVectorAlloc(vecLen, PS_TYPE_F64); 1725 for (i=0;i<vecLen;i++) { 1698 1699 // Evaluate polynomial 1700 for (psS32 i = 0; i < vecLen; i++) { 1726 1701 tmp->data.F64[i] = psDPolynomial3DEval(myPoly, 1727 myX->data.F64[i], 1728 myY->data.F64[i], 1729 myZ->data.F64[i]); 1730 1731 } 1732 1733 if (x->type.type != PS_TYPE_F64) { 1734 psFree(myX); 1735 } 1736 if (y->type.type != PS_TYPE_F64) { 1737 psFree(myY); 1738 } 1739 if (z->type.type != PS_TYPE_F64) { 1740 psFree(myZ); 1741 } 1702 x->data.F64[i], 1703 y->data.F64[i], 1704 z->data.F64[i]); 1705 } 1706 1707 // Return output vector 1742 1708 return(tmp); 1743 1709 }
Note:
See TracChangeset
for help on using the changeset viewer.
