Diff of /ptpicker.c [357c36] .. [91c838]  Maximize  Restore

Switch to unified view

a/ptpicker.c b/ptpicker.c
...
...
86
}
86
}
87
87
88
88
89
89
90
JNIEXPORT void JNICALL Java_ptutils_CSetControlPointCount
90
JNIEXPORT void JNICALL Java_ptutils_CSetControlPointCount
91
  (JNIEnv *env, jobject obj, jint nc){
91
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint nc){
92
    if( gl && nc != gl->numPts ){
92
    if( gl && nc != gl->numPts ){
93
        free(gl->cpt);
93
        free(gl->cpt);
94
        gl->numPts = nc;
94
        gl->numPts = nc;
95
        gl->cpt = (controlPoint*) malloc( gl->numPts * sizeof( controlPoint ) );
95
        gl->cpt = (controlPoint*) malloc( gl->numPts * sizeof( controlPoint ) );
96
    }
96
    }
97
}
97
}
98
98
99
JNIEXPORT void JNICALL Java_ptutils_CSetCP
99
JNIEXPORT void JNICALL Java_ptutils_CSetCP
100
  (JNIEnv *env, jobject obj, jint i, jint n0, jint n1, jdouble x0, jdouble x1, jdouble y0, jdouble y1, jint type){
100
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint i, jint n0, jint n1, jdouble x0, jdouble x1, jdouble y0, jdouble y1, jint type){
101
    if( gl && i < gl->numPts ){
101
    if( gl && i < gl->numPts ){
102
        controlPoint *c = &(gl->cpt[i]);
102
        controlPoint *c = &(gl->cpt[i]);
103
        c->num[0] = n0;
103
        c->num[0] = n0;
104
        c->num[1] = n1;
104
        c->num[1] = n1;
105
        c->x[0] = x0;
105
        c->x[0] = x0;
...
...
109
        c->type = type;
109
        c->type = type;
110
    }
110
    }
111
}
111
}
112
112
113
JNIEXPORT void JNICALL Java_ptutils_CSetTriangleCount
113
JNIEXPORT void JNICALL Java_ptutils_CSetTriangleCount
114
  (JNIEnv *env, jobject obj, jint nt){
114
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint nt){
115
    if( gl && nt != gl->nt ){
115
    if( gl && nt != gl->nt ){
116
        free( gl->t );
116
        free( gl->t );
117
        gl->nt = nt;
117
        gl->nt = nt;
118
        gl->t = (triangle*)malloc( gl->nt * sizeof(triangle) );
118
        gl->t = (triangle*)malloc( gl->nt * sizeof(triangle) );
119
    }
119
    }
120
}
120
}
121
121
122
JNIEXPORT void JNICALL Java_ptutils_CSetTR
122
JNIEXPORT void JNICALL Java_ptutils_CSetTR
123
  (JNIEnv *env, jobject obj, jint i, jint v0, jint v1, jint v2, jint nIm){
123
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint i, jint v0, jint v1, jint v2, jint nIm){
124
    if( gl && i< gl->nt ){
124
    if( gl && i< gl->nt ){
125
        triangle *t = &(gl->t[i]);
125
        triangle *t = &(gl->t[i]);
126
        t->vert[0] = v0;
126
        t->vert[0] = v0;
127
        t->vert[1] = v1;
127
        t->vert[1] = v1;
128
        t->vert[2] = v2;
128
        t->vert[2] = v2;
...
...
152
        return;
152
        return;
153
    }
153
    }
154
}
154
}
155
155
156
JNIEXPORT jint JNICALL Java_ptutils_CGetImageCount
156
JNIEXPORT jint JNICALL Java_ptutils_CGetImageCount
157
  (JNIEnv *env, jobject obj){
157
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED){
158
    if( gl )
158
    if( gl )
159
        return (jint)gl->numIm;
159
        return (jint)gl->numIm;
160
    else
160
    else
161
        return (jint)0;
161
        return (jint)0;
162
}
162
}
...
...
169
    else
169
    else
170
        return (*env)->NewStringUTF(env, "");
170
        return (*env)->NewStringUTF(env, "");
171
}
171
}
172
172
173
JNIEXPORT jint JNICALL Java_ptutils_CGetControlPointCount
173
JNIEXPORT jint JNICALL Java_ptutils_CGetControlPointCount
174
  (JNIEnv *env, jobject obj){
174
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED){
175
    if( gl )
175
    if( gl )
176
        return (jint)gl->numPts;
176
        return (jint)gl->numPts;
177
    else
177
    else
178
        return (jint)0;
178
        return (jint)0;
179
}
179
}
180
180
181
JNIEXPORT jint JNICALL Java_ptutils_CGetCP_1n
181
JNIEXPORT jint JNICALL Java_ptutils_CGetCP_1n
182
  (JNIEnv *env, jobject obj, jint ncpt, jint nim){
182
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint ncpt, jint nim){
183
    if(gl)
183
    if(gl)
184
        return (jint)gl->cpt[(int)ncpt].num[(int)nim];
184
        return (jint)gl->cpt[(int)ncpt].num[(int)nim];
185
    else
185
    else
186
        return (jint) 0;
186
        return (jint) 0;
187
}
187
}
188
188
189
JNIEXPORT jdouble JNICALL Java_ptutils_CGetCP_1x
189
JNIEXPORT jdouble JNICALL Java_ptutils_CGetCP_1x
190
  (JNIEnv *env, jobject obj, jint ncpt, jint nim){
190
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint ncpt, jint nim){
191
    if( gl )
191
    if( gl )
192
        return (jdouble)gl->cpt[(int)ncpt].x[(int)nim];
192
        return (jdouble)gl->cpt[(int)ncpt].x[(int)nim];
193
    else
193
    else
194
        return (jdouble) 0.0;
194
        return (jdouble) 0.0;
195
}
195
}
196
196
197
JNIEXPORT jdouble JNICALL Java_ptutils_CGetCP_1y
197
JNIEXPORT jdouble JNICALL Java_ptutils_CGetCP_1y
198
  (JNIEnv *env, jobject obj, jint ncpt, jint nim){
198
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint ncpt, jint nim){
199
    if(gl)
199
    if(gl)
200
        return (jdouble)gl->cpt[(int)ncpt].y[(int)nim];
200
        return (jdouble)gl->cpt[(int)ncpt].y[(int)nim];
201
    else
201
    else
202
        return (jdouble) 0.0;
202
        return (jdouble) 0.0;
203
}
203
}
204
204
205
JNIEXPORT jint JNICALL Java_ptutils_CGetCP_1t
205
JNIEXPORT jint JNICALL Java_ptutils_CGetCP_1t
206
  (JNIEnv *env, jobject obj, jint ncpt){
206
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint ncpt){
207
    if( gl )
207
    if( gl )
208
         return (jint)gl->cpt[(int)ncpt].type;
208
         return (jint)gl->cpt[(int)ncpt].type;
209
    else
209
    else
210
        return (jint ) 0;
210
        return (jint ) 0;
211
}
211
}
212
  
212
  
213
JNIEXPORT jint JNICALL Java_ptutils_CGetTriangleCount
213
JNIEXPORT jint JNICALL Java_ptutils_CGetTriangleCount
214
  (JNIEnv *env, jobject obj){
214
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED){
215
    if( gl )
215
    if( gl )
216
        return (jint)gl->nt;
216
        return (jint)gl->nt;
217
    else
217
    else
218
        return (jint ) 0;
218
        return (jint ) 0;
219
}
219
}
220
220
221
JNIEXPORT jint JNICALL Java_ptutils_CGetTR_1v
221
JNIEXPORT jint JNICALL Java_ptutils_CGetTR_1v
222
  (JNIEnv *env, jobject obj, jint ntr, jint nv){
222
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint ntr, jint nv){
223
    if( gl )
223
    if( gl )
224
        return (jint)gl->t[(int)ntr].vert[(int)nv];
224
        return (jint)gl->t[(int)ntr].vert[(int)nv];
225
    else
225
    else
226
        return (jint ) 0;
226
        return (jint ) 0;
227
}
227
}
228
  
228
  
229
JNIEXPORT jint JNICALL Java_ptutils_CGetTR_1i
229
JNIEXPORT jint JNICALL Java_ptutils_CGetTR_1i
230
  (JNIEnv *env, jobject obj, jint ntr){
230
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint ntr){
231
    return (jint)gl->t[(int)ntr].nIm;
231
    return (jint)gl->t[(int)ntr].nIm;
232
}
232
}
233
  
233
  
234
JNIEXPORT void JNICALL Java_ptutils_CSetImageName
234
JNIEXPORT void JNICALL Java_ptutils_CSetImageName
235
  (JNIEnv *env, jobject obj, jint n, jstring jname){
235
  (JNIEnv *env, jobject obj PT_UNUSED, jint n, jstring jname){
236
    const char *name = (*env)->GetStringUTFChars(env, jname, 0);
236
    const char *name = (*env)->GetStringUTFChars(env, jname, 0);
237
    if( n < gl->numIm ){
237
    if( n < gl->numIm ){
238
        strcpy( gl->im[n].name, name );
238
        strcpy( gl->im[n].name, name );
239
    }
239
    }
240
    (*env)->ReleaseStringUTFChars(env, jname, name);
240
    (*env)->ReleaseStringUTFChars(env, jname, name);
241
}
241
}
242
242
243
JNIEXPORT jint JNICALL Java_ptutils_CGetIndex
243
JNIEXPORT jint JNICALL Java_ptutils_CGetIndex
244
 (JNIEnv *env, jobject obj, jstring jname){
244
 (JNIEnv *env, jobject obj PT_UNUSED, jstring jname){
245
 
245
 
246
    const char *name =(*env)->GetStringUTFChars(env, jname, 0);
246
    const char *name =(*env)->GetStringUTFChars(env, jname, 0);
247
    jint i;
247
    jint i;
248
    
248
    
249
    for( i=0; i<gl->numIm; i++){
249
    for( i=0; i<gl->numIm; i++){
...
...
402
}
402
}
403
    
403
    
404
404
405
405
406
JNIEXPORT void JNICALL Java_ptutils_CGetImageRow
406
JNIEXPORT void JNICALL Java_ptutils_CGetImageRow
407
  (JNIEnv *env, jobject obj, jintArray jdata, jint nrow){
407
  (JNIEnv *env, jobject obj PT_UNUSED, jintArray jdata, jint nrow){
408
    if(im.data != NULL){
408
    if(im.data != NULL){
409
#ifdef PT_BIGENDIAN
409
#ifdef PT_BIGENDIAN
410
        (*env)->SetIntArrayRegion( env, jdata, 0, im.width , 
410
        (*env)->SetIntArrayRegion( env, jdata, 0, im.width , 
411
                                (jint*)((*im.data) + im.bytesPerLine * nrow) ) ;
411
                                (jint*)((*im.data) + im.bytesPerLine * nrow) ) ;
412
#else
412
#else
...
...
434
        }
434
        }
435
    }
435
    }
436
}
436
}
437
    
437
    
438
JNIEXPORT jint JNICALL Java_ptutils_CGetImageWidth
438
JNIEXPORT jint JNICALL Java_ptutils_CGetImageWidth
439
  (JNIEnv *env, jobject obj, jint n){
439
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint n){
440
    if( n == -1 )
440
    if( n == -1 )
441
        return (jint)gl->pano.width;
441
        return (jint)gl->pano.width;
442
    if( im.data != NULL )
442
    if( im.data != NULL )
443
        return (jint)gl->im[n].width;
443
        return (jint)gl->im[n].width;
444
    else
444
    else
445
        return (jint)0;
445
        return (jint)0;
446
    }
446
    }
447
447
448
JNIEXPORT jint JNICALL Java_ptutils_CGetImageHeight
448
JNIEXPORT jint JNICALL Java_ptutils_CGetImageHeight
449
   (JNIEnv *env, jobject obj, jint n){
449
   (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint n){
450
    if( n == -1 )
450
    if( n == -1 )
451
        return (jint)gl->pano.height;
451
        return (jint)gl->pano.height;
452
    if( im.data != NULL )
452
    if( im.data != NULL )
453
        return (jint)gl->im[n].height;
453
        return (jint)gl->im[n].height;
454
    else
454
    else
455
        return (jint)0;
455
        return (jint)0;
456
    }
456
    }
457
457
458
458
459
JNIEXPORT jint JNICALL Java_ptutils_CGetImageFormat
459
JNIEXPORT jint JNICALL Java_ptutils_CGetImageFormat
460
  (JNIEnv *env, jobject obj, jint n){
460
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint n){
461
    if( n == -1 )
461
    if( n == -1 )
462
        return (jint)gl->pano.format;
462
        return (jint)gl->pano.format;
463
    else if( n < gl->numIm )
463
    else if( n < gl->numIm )
464
        return (jint)gl->im[n].format;
464
        return (jint)gl->im[n].format;
465
    else
465
    else
466
        return -1;
466
        return -1;
467
}
467
}
468
468
469
JNIEXPORT jdouble JNICALL Java_ptutils_CGetHfov
469
JNIEXPORT jdouble JNICALL Java_ptutils_CGetHfov
470
  (JNIEnv *env, jobject obj, jint n){
470
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint n){
471
    if( n == -1 )
471
    if( n == -1 )
472
        return (jdouble)gl->pano.hfov;
472
        return (jdouble)gl->pano.hfov;
473
    else if( n < gl->numIm && n >= 0 )
473
    else if( n < gl->numIm && n >= 0 )
474
        return (jdouble)gl->im[n].hfov;
474
        return (jdouble)gl->im[n].hfov;
475
    else
475
    else
476
        return -1.0;
476
        return -1.0;
477
}
477
}
478
478
479
479
480
JNIEXPORT jdouble JNICALL Java_ptutils_CGetYaw
480
JNIEXPORT jdouble JNICALL Java_ptutils_CGetYaw
481
  (JNIEnv *env, jobject obj, jint n){
481
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint n){
482
    return (jdouble)gl->im[n].yaw;
482
    return (jdouble)gl->im[n].yaw;
483
}
483
}
484
484
485
JNIEXPORT jdouble JNICALL Java_ptutils_CGetPitch
485
JNIEXPORT jdouble JNICALL Java_ptutils_CGetPitch
486
  (JNIEnv *env, jobject obj, jint n){
486
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint n){
487
        return (jdouble)gl->im[n].pitch;
487
        return (jdouble)gl->im[n].pitch;
488
}
488
}
489
489
490
JNIEXPORT jdouble JNICALL Java_ptutils_CGetRoll
490
JNIEXPORT jdouble JNICALL Java_ptutils_CGetRoll
491
  (JNIEnv *env, jobject obj, jint n){
491
  (JNIEnv *env PT_UNUSED, jobject obj PT_UNUSED, jint n){
492
        return (jdouble)gl->im[n].roll;
492
        return (jdouble)gl->im[n].roll;
493
}
493
}
494
494
495
495
496
JNIEXPORT void JNICALL Java_ptutils_CCreateProject
496
JNIEXPORT void JNICALL Java_ptutils_CCreateProject
...
...
1075
#endif  
1075
#endif  
1076
    return 0;
1076
    return 0;
1077
}
1077
}
1078
1078
1079
1079
1080
int fcnAlign(int m, int n, double x[], double fvec[],int *iflag)
1080
int fcnAlign(int m PT_UNUSED, int n PT_UNUSED, double x[], double fvec[],int *iflag)
1081
{
1081
{
1082
    // int i;
1082
    // int i;
1083
    double r = 0.0;
1083
    double r = 0.0;
1084
    static int numIt,a=0;
1084
    static int numIt,a=0;
1085
    
1085
    

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks