59 #include <config_auto.h>
63 #include "allheaders.h"
98 mat = (l_float32 *)LEPT_CALLOC(9,
sizeof(l_float32));
99 mat[0] = mat[4] = mat[8] = 1;
135 mat = (l_float32 *)LEPT_CALLOC(9,
sizeof(l_float32));
183 l_float32 sina, cosa;
186 mat = (l_float32 *)LEPT_CALLOC(9,
sizeof(l_float32));
189 mat[0] = mat[4] = cosa;
191 mat[2] = xc * (1.0 - cosa) + yc * sina;
193 mat[5] = yc * (1.0 - cosa) - xc * sina;
226 return (
PTA *)ERROR_PTR(
"ptas not defined", __func__, NULL);
230 return (
PTA *)ERROR_PTR(
"ptad not made", __func__, NULL);
231 for (i = 0; i < npts; i++) {
233 ptaAddPt(ptad, x + transx, y + transy);
263 return (
PTA *)ERROR_PTR(
"ptas not defined", __func__, NULL);
267 return (
PTA *)ERROR_PTR(
"ptad not made", __func__, NULL);
268 for (i = 0; i < npts; i++) {
270 ptaAddPt(ptad, scalex * x, scaley * y);
309 l_float32 x, y, xp, yp, sina, cosa;
313 return (
PTA *)ERROR_PTR(
"ptas not defined", __func__, NULL);
317 return (
PTA *)ERROR_PTR(
"ptad not made", __func__, NULL);
320 for (i = 0; i < npts; i++) {
322 xp = xc + (x - xc) * cosa - (y - yc) * sina;
323 yp = yc + (x - xc) * sina + (y - yc) * cosa;
354 return (
BOXA *)ERROR_PTR(
"boxas not defined", __func__, NULL);
385 return (
BOXA *)ERROR_PTR(
"boxas not defined", __func__, NULL);
388 ptad =
ptaScale(ptas, scalex, scaley);
417 return (
BOXA *)ERROR_PTR(
"boxas not defined", __func__, NULL);
443 l_float32 vecs[3], vecd[3];
447 return (
PTA *)ERROR_PTR(
"ptas not defined", __func__, NULL);
449 return (
PTA *)ERROR_PTR(
"transform not defined", __func__, NULL);
454 return (
PTA *)ERROR_PTR(
"ptad not made", __func__, NULL);
455 for (i = 0; i < npts; i++) {
456 ptaGetPt(ptas, i, &vecs[0], &vecs[1]);
480 return (
BOXA *)ERROR_PTR(
"boxas not defined", __func__, NULL);
482 return (
BOXA *)ERROR_PTR(
"transform not defined", __func__, NULL);
514 return ERROR_INT(
"matrix not defined", __func__, 1);
516 return ERROR_INT(
"input vector not defined", __func__, 1);
518 return ERROR_INT(
"result vector not defined", __func__, 1);
520 for (i = 0; i < size; i++) {
522 for (j = 0; j < size; j++) {
523 vecd[i] += mat[size * i + j] * vecs[j];
545 l_int32 i, j, k, index;
548 return ERROR_INT(
"matrix 1 not defined", __func__, 1);
550 return ERROR_INT(
"matrix 2 not defined", __func__, 1);
552 return ERROR_INT(
"result matrix not defined", __func__, 1);
554 for (i = 0; i < size; i++) {
555 for (j = 0; j < size; j++) {
556 index = size * i + j;
558 for (k = 0; k < size; k++)
559 matd[index] += mat1[size * i + k] * mat2[size * k + j];
586 return ERROR_INT(
"matrix 1 not defined", __func__, 1);
588 return ERROR_INT(
"matrix 2 not defined", __func__, 1);
590 return ERROR_INT(
"matrix 3 not defined", __func__, 1);
592 return ERROR_INT(
"result matrix not defined", __func__, 1);
594 if ((matt = (l_float32 *)LEPT_CALLOC((
size_t)size * size,
595 sizeof(l_float32))) == NULL)
596 return ERROR_INT(
"matt not made", __func__, 1);
626 return ERROR_INT(
"matrix 1 not defined", __func__, 1);
628 return ERROR_INT(
"matrix 2 not defined", __func__, 1);
630 return ERROR_INT(
"matrix 3 not defined", __func__, 1);
632 return ERROR_INT(
"result matrix not defined", __func__, 1);
634 if ((matt = (l_float32 *)LEPT_CALLOC((
size_t)size * size,
635 sizeof(l_float32))) == NULL)
636 return ERROR_INT(
"matt not made", __func__, 1);
l_ok l_productMat4(l_float32 *mat1, l_float32 *mat2, l_float32 *mat3, l_float32 *mat4, l_float32 *matd, l_int32 size)
l_productMat4()
BOXA * boxaRotate(BOXA *boxas, l_float32 xc, l_float32 yc, l_float32 angle)
boxaRotate()
BOXA * boxaScale(BOXA *boxas, l_float32 scalex, l_float32 scaley)
boxaScale()
PTA * ptaRotate(PTA *ptas, l_float32 xc, l_float32 yc, l_float32 angle)
ptaRotate()
PTA * ptaScale(PTA *ptas, l_float32 scalex, l_float32 scaley)
ptaScale()
l_float32 * createMatrix2dRotate(l_float32 xc, l_float32 yc, l_float32 angle)
createMatrix2dRotate()
BOXA * boxaTranslate(BOXA *boxas, l_float32 transx, l_float32 transy)
boxaTranslate()
l_ok l_productMat3(l_float32 *mat1, l_float32 *mat2, l_float32 *mat3, l_float32 *matd, l_int32 size)
l_productMat3()
PTA * ptaTranslate(PTA *ptas, l_float32 transx, l_float32 transy)
ptaTranslate()
l_float32 * createMatrix2dTranslate(l_float32 transx, l_float32 transy)
createMatrix2dTranslate()
PTA * ptaAffineTransform(PTA *ptas, l_float32 *mat)
ptaAffineTransform()
l_float32 * createMatrix2dScale(l_float32 scalex, l_float32 scaley)
createMatrix2dScale()
BOXA * boxaAffineTransform(BOXA *boxas, l_float32 *mat)
boxaAffineTransform()
l_ok l_productMatVec(l_float32 *mat, l_float32 *vecs, l_float32 *vecd, l_int32 size)
l_productMatVec()
l_ok l_productMat2(l_float32 *mat1, l_float32 *mat2, l_float32 *matd, l_int32 size)
l_productMat2()
BOXA * ptaConvertToBoxa(PTA *pta, l_int32 ncorners)
ptaConvertToBoxa()
PTA * boxaConvertToPta(BOXA *boxa, l_int32 ncorners)
boxaConvertToPta()
l_ok ptaAddPt(PTA *pta, l_float32 x, l_float32 y)
ptaAddPt()
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
PTA * ptaCreate(l_int32 n)
ptaCreate()
void ptaDestroy(PTA **ppta)
ptaDestroy()