Explorar o código

remove unused translib

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49956 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz %!s(int64=13) %!d(string=hai) anos
pai
achega
33a673d833

+ 0 - 1
lib/vector/Makefile

@@ -6,7 +6,6 @@ SUBDIRS = rtree \
 	dglib \
 	diglib \
 	Vlib \
-	transform \
 	vedit \
 	neta
 

+ 0 - 12
lib/vector/transform/Makefile

@@ -1,12 +0,0 @@
-
-MODULE_TOPDIR = ../../..
-
-LIB = TRANS
-
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
-default: lib
-
-
-
-

+ 0 - 57
lib/vector/transform/TODO

@@ -1,58 +0,0 @@
-From glynn.clements@virgin.net  Wed Dec 12 19:13:35 2001
-Return-Path: <glynn.clements@virgin.net>
-Received: from camelot.itc.it (camelot [195.223.171.5])
-	by artemide.itc.it (8.11.3/8.11.3) with ESMTP id fBCIDX728309
-	for <neteler@itc.it>; Wed, 12 Dec 2001 19:13:33 +0100 (MET)
-Received: from mta2-svc.virgin.net (mta2-svc.virgin.net [62.253.164.42])
-	by camelot.itc.it (8.11.3/8.11.3) with ESMTP id fBCIDWd06840
-	for <neteler@itc.it>; Wed, 12 Dec 2001 19:13:32 +0100 (MET)
-Received: from cerise.nosuchdomain.co.uk ([62.252.69.31])
-          by mta2-svc.virgin.net (InterMail vM.4.01.02.27 201-229-119-110)
-          with ESMTP
-          id <20011212181330.PKYR10663.mta2-svc.virgin.net@cerise.nosuchdomain.co.uk>
-          for <neteler@itc.it>; Wed, 12 Dec 2001 18:13:30 +0000
-Received: (from glynn@localhost)
-	by cerise.nosuchdomain.co.uk (8.11.6/8.11.6) id fBCIAC301072;
-	Wed, 12 Dec 2001 18:10:12 GMT
-From: Glynn Clements <glynn.clements@virgin.net>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Content-Transfer-Encoding: 7bit
-Message-ID: <15383.40324.300167.67864@cerise.nosuchdomain.co.uk>
-Date: Wed, 12 Dec 2001 18:10:12 +0000
-To: Markus Neteler <neteler@itc.it>
-Subject: Re: affine transform
-In-Reply-To: <20011212165039.B4313@itc.it>
-References: <20011212165039.B4313@itc.it>
-X-Mailer: VM 6.94 under 21.4 (patch 4) "Artificial Intelligence (candidate #1)" XEmacs Lucid
-Status: RO
-Content-Length: 986
-Lines: 26
-
-
-Markus Neteler wrote:
-
-> by chance I have found another implementation for affine
-> transform (or whatever there is implemented):
-> src/libes/vect32/libes/transform/
-> It is used in v.digit and maybe other programs.
-> 
-> Is this a candidate for the GMATH library?
-> I think yes.
-
-The code there seems fairly specialised.
-
-The transformations are affine, but the means of generating the
-coefficients seems rather odd; in particular, the requirement that at
-least four reference points are provided. Three points will define an
-affine transformation; any more are either redundant or contradictory.
-
-If it were to go into the gmath library, it might be better for
-compute_transformation_coef() to return the resulting transformation
-in a gmath "mat_struct". transform_a_into_b() and transform_b_into_a()
-are largely redundant; they're either just a matrix multiplication (if
-using homogeneous coordinates) or multiply-and-add (otherwise).
-
-Glynn Clements <glynn.clements@virgin.net>
-

+ 0 - 139
lib/vector/transform/inverse.c

@@ -1,139 +0,0 @@
-/*  @(#)inverse.c       2.1  6/26/87  */
-#include <math.h>
-#include <grass/transform.h>
-
-#define EPSILON 1.0e-16
-
-/* DIM_matrix is defined in "libtrans.h" */
-#define N	DIM_matrix
-
-/*
- * inverse: invert a square matrix (puts pivot elements on main diagonal).
- *          returns arg2 as the inverse of arg1.
- *
- *  This routine is based on a routine found in Andrei Rogers, "Matrix
- *  Methods in Urban and Regional Analysis", (1971), pp. 143-153.
- */
-int inverse(double m[N][N])
-{
-    int i, j, k, l, ir = 0, ic = 0;
-    int ipivot[N], itemp[N][2];
-    double pivot[N], t;
-    double fabs();
-
-
-    if (isnull(m))
-	return (-1);
-
-
-    /* initialization */
-    for (i = 0; i < N; i++)
-	ipivot[i] = 0;
-
-    for (i = 0; i < N; i++) {
-	t = 0.0;		/* search for pivot element */
-
-	for (j = 0; j < N; j++) {
-	    if (ipivot[j] == 1)	/* found pivot */
-		continue;
-
-	    for (k = 0; k < N; k++)
-		switch (ipivot[k] - 1) {
-		case 0:
-		    break;
-		case -1:
-		    if (fabs(t) < fabs(m[j][k])) {
-			ir = j;
-			ic = k;
-			t = m[j][k];
-		    }
-		    break;
-		case 1:
-		    return (-1);
-		    break;
-		default:	/* shouldn't get here */
-		    return (-1);
-		    break;
-		}
-	}
-
-	ipivot[ic] += 1;
-	if (ipivot[ic] > 1) {	/* check for dependency */
-	    return (-1);
-	}
-
-	/* interchange rows to put pivot element on diagonal */
-	if (ir != ic)
-	    for (l = 0; l < N; l++) {
-		t = m[ir][l];
-		m[ir][l] = m[ic][l];
-		m[ic][l] = t;
-	    }
-
-	itemp[i][0] = ir;
-	itemp[i][1] = ic;
-	pivot[i] = m[ic][ic];
-
-	/* check for zero pivot */
-	if (fabs(pivot[i]) < EPSILON) {
-	    return (-1);
-	}
-
-	/* divide pivot row by pivot element */
-	m[ic][ic] = 1.0;
-
-	for (j = 0; j < N; j++)
-	    m[ic][j] /= pivot[i];
-
-	/* reduce nonpivot rows */
-	for (k = 0; k < N; k++)
-	    if (k != ic) {
-		t = m[k][ic];
-		m[k][ic] = 0.0;
-
-		for (l = 0; l < N; l++)
-		    m[k][l] -= (m[ic][l] * t);
-	    }
-    }
-
-    /* interchange columns */
-    for (i = 0; i < N; i++) {
-	l = N - i - 1;
-	if (itemp[l][0] == itemp[l][1])
-	    continue;
-
-	ir = itemp[l][0];
-	ic = itemp[l][1];
-
-	for (k = 0; k < N; k++) {
-	    t = m[k][ir];
-	    m[k][ir] = m[k][ic];
-	    m[k][ic] = t;
-	}
-    }
-
-    return 1;
-}
-
-
-
-
-#define ZERO 1.0e-8
-
-/*
- * isnull: returns 1 if matrix is null, else 0.
- */
-
-int isnull(double a[N][N])
-{
-    register int i, j;
-    double fabs();
-
-
-    for (i = 0; i < N; i++)
-	for (j = 0; j < N; j++)
-	    if ((fabs(a[i][j]) - ZERO) > ZERO)
-		return 0;
-
-    return 1;
-}

+ 0 - 24
lib/vector/transform/m_mult.c

@@ -1,24 +0,0 @@
-/*  @(#)m_mult.c        2.1  6/26/87  */
-#include <stdio.h>
-#include <grass/transform.h>
-
-#define		N	3
-
-/*
- * m_mult: matrix multiplication (return c = a * b)
- *  3x3 matric by 3x1 matric
- */
-
-int m_mult(double a[N][N], double b[N], double c[N])
-{
-    register int i, j;
-
-    for (i = 0; i < N; i++) {
-	c[i] = 0.0;
-
-	for (j = 0; j < N; j++)
-	    c[i] += (a[i][j] * b[j]);
-    }
-
-    return 1;
-}

+ 0 - 280
lib/vector/transform/transform.c

@@ -1,280 +0,0 @@
-
-/**
- * \file transform.c
- *
- * \brief This file contains routines which perform (affine?)
- * transformations from one coordinate system into another.
- *
- * The second system may be translated, stretched, and rotated relative
- * to the first. The input system is system <em>a</em> and the output
- * system is <em>b</em>.
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1987-2007
- */
-
-/****************************************************************
-note: uses sqrt() from math library
-*****************************************************************
-Points from one system may be converted into the second by
-use of one of the two equation routines.
-
-transform_a_into_b (ax,ay,bx,by)
-
-    double ax,ay;            input point from system a
-    double *bx,*by;          resultant point in system b
-
-transform_b_into_a (bx,by,ax,ay)
-
-    double bx,by;            input point from system b
-    double *ax,*ay;          resultant point in system a
-*****************************************************************
-Residual analysis on the equation can be run to test how well
-the equations work.  Either test how well b is predicted by a
-or vice versa.
-
-residuals_a_predicts_b (ax,ay,bx,by,use,n,residuals,rms)
-residuals_b_predicts_a (ax,ay,bx,by,use,n,residuals,rms)
-
-    double ax[], ay[];       coordinate from system a
-    double bx[], by[];       coordinate from system b
-    char   use[];            use point flags
-    int n;                   number of points in ax,ay,bx,by
-    double residual[]        residual error for each point
-    double *rms;             overall root mean square error
-****************************************************************/
-
-#include <stdio.h>
-#include <math.h>
-#include <grass/transform.h>
-
-/* the coefficients */
-static double A0, A1, A2, A3, A4, A5;
-static double B0, B1, B2, B3, B4, B5;
-
-/* function prototypes */
-static int resid(double *, double *, double *, double *, int *, int, double *,
-		 double *, int);
-
-
-/**
- * \fn int compute_transformation_coef (double ax[], double ay[], double bx[], double by[], char *use, int n)
- *
- * \brief The first step is to compute coefficients for a set of equations
- * which are then used to convert from the one system to the other.
- *
- * A set of x,y points from both systems is input into the equation
- * generator which determines the equation coefficients which most
- * nearly represent the original points. These coefficients are kept
- * in a static variables internal to this file.
- *
- * NOTE: use[i] must be true for ax[i],ay[i],bx[i],by[i] to be used
- * in the equation.  Also, the total number of used points must be
- * 4 or larger.
- *
- * \param[in] ax coordinate from system a
- * \param[in] ay coordinate from system a
- * \param[in] bx coordinate from system b
- * \param[in] by coordinate from system b
- * \param[in] use use point flags
- * \param[in] n number of points in ax, ay, bx, by
- * \return int 1 if successful
- * \return int -1 if could not solve equation. Points probably colinear.
- * \return int -2 if less than 4 points used
- */
-
-int compute_transformation_coef(double ax[], double ay[], double bx[],
-				double by[], int *use, int n)
-{
-    int i;
-    int j;
-    int count;
-    double aa[3];
-    double aar[3];
-    double bb[3];
-    double bbr[3];
-
-    double cc[3][3];
-    double x;
-
-    count = 0;
-    for (i = 0; i < n; i++)
-	if (use[i])
-	    count++;
-    if (count < 4)
-	return -2;		/* must have at least 4 points */
-
-    for (i = 0; i < 3; i++) {
-	aa[i] = bb[i] = 0.0;
-
-	for (j = 0; j < 3; j++)
-	    cc[i][j] = 0.0;
-    }
-
-    for (i = 0; i < n; i++) {
-	if (!use[i])
-	    continue;		/* skip this point */
-	cc[0][0] += 1;
-	cc[0][1] += bx[i];
-	cc[0][2] += by[i];
-
-	cc[1][1] += bx[i] * bx[i];
-	cc[1][2] += bx[i] * by[i];
-	cc[2][2] += by[i] * by[i];
-
-	aa[0] += ay[i];
-	aa[1] += ay[i] * bx[i];
-	aa[2] += ay[i] * by[i];
-
-	bb[0] += ax[i];
-	bb[1] += ax[i] * bx[i];
-	bb[2] += ax[i] * by[i];
-    }
-
-    cc[1][0] = cc[0][1];
-    cc[2][0] = cc[0][2];
-    cc[2][1] = cc[1][2];
-
-    /* aa and bb are solved */
-    if (inverse(cc) < 0)
-	return (-1);
-    if (m_mult(cc, aa, aar) < 0 || m_mult(cc, bb, bbr) < 0)
-	return (-1);
-
-    /* the equation coefficients */
-    B0 = aar[0];
-    B1 = aar[1];
-    B2 = aar[2];
-
-    B3 = bbr[0];
-    B4 = bbr[1];
-    B5 = bbr[2];
-
-    /* the inverse equation */
-    x = B2 * B4 - B1 * B5;
-
-    if (!x)
-	return (-1);
-
-    A0 = (B1 * B3 - B0 * B4) / x;
-    A1 = -B1 / x;
-    A2 = B4 / x;
-    A3 = (B0 * B5 - B2 * B3) / x;
-    A4 = B2 / x;
-    A5 = -B5 / x;
-
-    return 1;
-}
-
-
-int transform_a_into_b(double ax, double ay, double *bx, double *by)
-{
-    *by = A0 + A1 * ax + A2 * ay;
-    *bx = A3 + A4 * ax + A5 * ay;
-
-    return 0;
-}
-
-
-int transform_b_into_a(double bx, double by, double *ax, double *ay)
-{
-    *ay = B0 + B1 * bx + B2 * by;
-    *ax = B3 + B4 * bx + B5 * by;
-
-    return 0;
-}
-
-/**************************************************************
-These routines are internal to this source code
-
-solve (a, b)
-    double a[3][3]
-    double b[3]
-
-    equation solver used by compute_transformation_coef()
-**************************************************************/
-
-/*  #define abs(xx) (xx >= 0 ? xx : -xx)  */
-/*      #define N 3  */
-
-
-int residuals_a_predicts_b(double ax[], double ay[], double bx[], double by[],
-			   int use[], int n, double residuals[], double *rms)
-{
-    resid(ax, ay, bx, by, use, n, residuals, rms, 1);
-
-    return 0;
-}
-
-
-int residuals_b_predicts_a(double ax[], double ay[], double bx[], double by[],
-			   int use[], int n, double residuals[], double *rms)
-{
-    resid(ax, ay, bx, by, use, n, residuals, rms, 0);
-
-    return 0;
-}
-
-
-/**
- * \fn int print_transform_matrix (void)
- *
- * \brief Prints matrix to stdout in human readable format.
- *
- * \return int 1
- */
-
-int print_transform_matrix(void)
-{
-    fprintf(stdout, "\nTransformation Matrix\n");
-    fprintf(stdout, "| xoff a b |\n");
-    fprintf(stdout, "| yoff d e |\n");
-    fprintf(stdout, "-------------------------------------------\n");
-    fprintf(stdout, "%f %f %f \n", -B3, B2, -B5);
-    fprintf(stdout, "%f %f %f \n", -B0, -B1, B4);
-    fprintf(stdout, "-------------------------------------------\n");
-
-    return 1;
-}
-
-
-static int resid(double ax[], double ay[], double bx[], double by[],
-		 int use[], int n, double residuals[], double *rms, int atob)
-{
-    double x, y;
-    int i;
-    int count;
-    double sum;
-    double delta;
-    double dx, dy;
-
-    count = 0;
-    sum = 0.0;
-    for (i = 0; i < n; i++) {
-	if (!use[i])
-	    continue;
-
-	count++;
-	if (atob) {
-	    transform_a_into_b(ax[i], ay[i], &x, &y);
-	    dx = x - bx[i];
-	    dy = y - by[i];
-	}
-	else {
-	    transform_b_into_a(bx[i], by[i], &x, &y);
-	    dx = x - ax[i];
-	    dy = y - ay[i];
-	}
-
-	delta = dx * dx + dy * dy;
-	residuals[i] = sqrt(delta);
-	sum += delta;
-    }
-    *rms = sqrt(sum / count);
-
-    return 0;
-}