X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=tools%2Flinogram.cpp;h=31b3b56a8f87e17c7b607bdafbf4cc849d9bd694;hp=16e78ad343747faade392e99942bca60d3f58460;hb=3d52fe3684ae9f5bf411c6ec4476381932ca6d00;hpb=52b5db7fecd29a8ffe42c53e4e27fd2a698075bb diff --git a/tools/linogram.cpp b/tools/linogram.cpp index 16e78ad..31b3b56 100644 --- a/tools/linogram.cpp +++ b/tools/linogram.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: linogram.cpp,v 1.2 2003/04/01 18:56:59 kevin Exp $ +** $Id: linogram.cpp,v 1.3 2003/04/01 19:49:41 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -38,7 +38,7 @@ static struct option my_options[] = {0, 0, 0, 0} }; -static const char* g_szIdStr = "$Id: linogram.cpp,v 1.2 2003/04/01 18:56:59 kevin Exp $"; +static const char* g_szIdStr = "$Id: linogram.cpp,v 1.3 2003/04/01 19:49:41 kevin Exp $"; void @@ -102,13 +102,28 @@ linogram_main (int argc, char *const argv[]) int n = atol (in_n); double d = atof (in_d); - int size = 2 * (2 * n - 1) + 1; - double divisor = 4 * n + 3; + int size = 4 * n + 3; + double theta_base = PI/8; - for (int itheta = 0; itheta < size; itheta++) { - double theta = atan (2 * itheta / divisor); - printf ("%lf: ", theta); - double step = d * cos(theta); + double theta_vec [size]; + for (int i = 0; i < size; i++) { + int m = i - (2 * n + 1); + theta_vec[i] = atan (static_cast(2 * m) / size); + } + + int m; + for (m = 0; m < size; m++) { + printf ("%lf: ", theta_vec[m] + theta_base); + double step = d * cos(theta_vec[m]); + for (int id = 0; id < size; id++) { + printf ("%lf ", id * step); + } + printf ("\n"); + } + + for (m = 0; m < size; m++) { + printf ("%lf: ", theta_vec[m] + PI/2. + theta_base); + double step = d * cos(theta_vec[m]); for (int id = 0; id < size; id++) { printf ("%lf ", id * step); }