Changeset 12330
- Timestamp:
- Mar 8, 2007, 12:12:56 PM (19 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
astro/psCoord.c (modified) (6 diffs)
-
imageops/psImageGeomManip.c (modified) (2 diffs)
-
types/psPixels.c (modified) (5 diffs)
-
types/psPixels.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r11686 r12330 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.13 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-0 2-07 23:52:53$12 * @version $Revision: 1.135 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-08 22:12:56 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 67 67 simply inverts the supplied psPlaneTransform transform. It assumes that 68 68 "transform" is linear. 69 69 70 70 XXX: This code no longer makes sense. The merge must be reviewed. 71 71 72 72 XXX: below is the code using the standard matrix representation. note that 73 73 this inversion requires x->nX == 1, y->nY == 1 and x->nY <= 1, y->nX <= 1 … … 144 144 if the supplied psPlaneTransform transform is linear: if any of the 145 145 cooefficients of order 2 are higher are non-zero, then it is not linear. 146 146 147 147 Returns: 148 148 true: if linear 149 149 false: otherwise 150 150 151 151 Why isn't this called p_psIsPlaneTransformLinear()? 152 152 *****************************************************************************/ … … 882 882 /***************************************************************************** 883 883 psPlaneTransformFit(trans, source, dest, nRejIter, sigmaClip) 884 884 885 885 XXX: This code ignores nRejIter and sigmaClip. We must call the ClipFit 886 886 routines instead. … … 931 931 /***************************************************************************** 932 932 psPlaneTransformInvert(out, in, region, nSamples) 933 933 934 934 *****************************************************************************/ 935 935 psPlaneTransform *psPlaneTransformInvert( … … 1129 1129 // out->data[m].y = fxnVal->y + y; 1130 1130 // m++; 1131 out = p _psPixelsAppend(out, 1, (float)(fxnVal->x+j),1132 (float)(fxnVal->y+k) );1131 out = psPixelsAdd(out, 1, (float)(fxnVal->x+j), 1132 (float)(fxnVal->y+k) ); 1133 1133 } 1134 1134 } -
trunk/psLib/src/imageops/psImageGeomManip.c
r12248 r12330 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-03-0 6 02:14:55$12 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-08 22:12:56 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 907 907 if (isnan(value)) { \ 908 908 if (blankPixels != NULL) { \ 909 p _psPixelsAppend(*blankPixels, (*blankPixels)->nalloc, outPosition.x, outPosition.y); \909 psPixelsAdd(*blankPixels, (*blankPixels)->nalloc, outPosition.x, outPosition.y); \ 910 910 } \ 911 911 value = exposedValue; \ -
trunk/psLib/src/types/psPixels.c
r12289 r12330 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-03-0 7 02:50:15$9 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-03-08 22:12:56 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 60 60 } 61 61 62 63 static psPixels *pixelsAlloc(const char *file, 64 unsigned int lineno, 65 const char *func, 66 long nalloc) 67 { 68 psPixels* out = p_psAlloc(file, lineno, func, sizeof(psPixels)); 69 psMemSetDeallocator(out, (psFreeFunc)pixelsFree); 70 71 out->data = p_psAlloc(file, lineno, func, sizeof(psPixelCoord)*nalloc); 72 P_PSPIXELS_SET_NALLOC(out,nalloc); 73 74 return out; 75 } 76 62 77 psPixels* p_psPixelsAlloc(const char *file, 63 78 unsigned int lineno, … … 65 80 long nalloc) 66 81 { 67 psPixels* out = p_psAlloc(file, lineno, func, sizeof(psPixels)); 68 69 if (nalloc > 0) { 70 out->data = p_psAlloc(file, lineno, func, sizeof(psPixelCoord)*nalloc); 71 } else { 72 out->data = NULL; 73 } 82 psPixels *out = pixelsAlloc(file, lineno, func, nalloc); 83 out->n = nalloc; 84 return out; 85 } 86 87 psPixels* p_psPixelsAllocEmpty(const char *file, 88 unsigned int lineno, 89 const char *func, 90 long nalloc) 91 { 92 psPixels *out = pixelsAlloc(file, lineno, func, nalloc); 74 93 out->n = 0; 75 P_PSPIXELS_SET_NALLOC(out,nalloc);76 77 psMemSetDeallocator(out, (psFreeFunc)pixelsFree);78 79 94 return out; 80 95 } … … 94 109 long nalloc) 95 110 { 96 if ( pixels == NULL) {111 if (!pixels) { 97 112 return p_psPixelsAlloc(file, lineno, func, nalloc); 98 113 } 99 100 if (nalloc > 0) { 101 pixels->data = p_psRealloc(file, lineno, func, pixels->data, sizeof(psPixelCoord)*nalloc); 102 } else { 103 psFree(pixels->data); 104 pixels->data = NULL; 105 } 106 114 if (nalloc < 0) { 115 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 116 "Can't reallocate a psPixels to negative size."); 117 return pixels; 118 } 119 120 if (pixels->n == nalloc) { 121 return pixels; 122 } 123 if (nalloc < pixels->n) { 124 pixels->n = nalloc; 125 } 126 pixels->data = p_psRealloc(file, lineno, func, pixels->data, sizeof(psPixelCoord)*nalloc); 107 127 P_PSPIXELS_SET_NALLOC(pixels,nalloc); 108 128 109 if (pixels->n > pixels->nalloc) {110 pixels->n = pixels->nalloc;111 }112 113 129 return pixels; 114 130 } 115 131 116 psPixels* p_psPixelsAppend(psPixels* pixels, 117 long growth, 118 float x, 119 float y) 120 { 121 if (growth < 1) { 132 psPixels* psPixelsAdd(psPixels* pixels, 133 long growth, 134 float x, 135 float y) 136 { 137 PS_ASSERT_PIXELS_NON_NULL(pixels, NULL); 138 139 if (growth <= 0) { 122 140 growth = PIXELS_DEFAULT_ADD; 123 141 } 124 142 125 if ( (pixels == NULL) || (pixels->n >= pixels->nalloc)) {126 pixels =psPixelsRealloc(pixels, pixels->nalloc+growth);143 if (pixels->n >= pixels->nalloc) { 144 pixels = psPixelsRealloc(pixels, pixels->nalloc + growth); 127 145 } 128 146 … … 354 372 position += pixels->n; 355 373 } 356 if (position < 0 || position > pixels->n) {374 if (position < 0 || position >= pixels->n) { 357 375 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position: %ld\n", position); 358 376 return false; -
trunk/psLib/src/types/psPixels.h
r12289 r12330 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-03-0 7 02:50:15$8 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-08 22:12:56 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 79 79 #endif // ifdef DOXYGEN 80 80 81 /** Allocates a new empty psPixels structure 82 * 83 * @return psPixels* new psPixels 84 */ 85 #ifdef DOXYGEN 86 psPixels* psPixelsAllocEmpty( 87 long nalloc ///< the size of the coordinate vectors 88 ); 89 #else // ifdef DOXYGEN 90 psPixels* p_psPixelsAllocEmpty( 91 const char *file, ///< File of caller 92 unsigned int lineno, ///< Line number of caller 93 const char *func, ///< Function name of caller 94 long nalloc ///< the size of the coordinate vectors 95 ); 96 #define psPixelsAllocEmpty(nalloc) \ 97 p_psPixelsAllocEmpty(__FILE__, __LINE__, __func__, nalloc) 98 #endif // ifdef DOXYGEN 99 81 100 82 101 /** Checks the type of a particular pointer. … … 121 140 * @return psPixels* psPixels with the value appended. 122 141 */ 123 psPixels* p _psPixelsAppend(142 psPixels* psPixelsAdd( 124 143 psPixels* pixels, ///< psPixels to append new coordinate to. 125 144 long growth, ///< Number of elements to grow the pixels list if necessary.
Note:
See TracChangeset
for help on using the changeset viewer.
