|
From: <kin...@us...> - 2024-07-23 16:52:55
|
Revision: 7225
http://sourceforge.net/p/teem/code/7225
Author: kindlmann
Date: 2024-07-23 16:52:53 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
clang format, and using nrrdHestNrrdNoTTY
Modified Paths:
--------------
teem/trunk/src/limn/test/clip.c
teem/trunk/src/limn/test/off2eps.c
teem/trunk/src/limn/test/tbc.c
Modified: teem/trunk/src/limn/test/clip.c
===================================================================
--- teem/trunk/src/limn/test/clip.c 2024-07-23 16:51:37 UTC (rev 7224)
+++ teem/trunk/src/limn/test/clip.c 2024-07-23 16:52:53 UTC (rev 7225)
@@ -27,7 +27,7 @@
main(int argc, const char *argv[]) {
const char *me;
char *err, *outS;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
limnPolyData *pld;
@@ -37,18 +37,15 @@
int bitflag;
me = argv[0];
- hestOptAdd(&hopt, "vi", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input values",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "pi", "lpld", airTypeOther, 1, 1, &pld, NULL,
- "input polydata",
- NULL, NULL, limnHestPolyDataLMPD);
+ hestOptAdd(&hopt, "vi", "nin", airTypeOther, 1, 1, &nin, NULL, "input values", NULL,
+ NULL, nrrdHestNrrdNoTTY);
+ hestOptAdd(&hopt, "pi", "lpld", airTypeOther, 1, 1, &pld, NULL, "input polydata", NULL,
+ NULL, limnHestPolyDataLMPD);
hestOptAdd(&hopt, "th", "thresh", airTypeDouble, 1, 1, &thresh, NULL,
"threshold value");
hestOptAdd(&hopt, "o", "output LMPD", airTypeString, 1, 1, &outS, "out.lmpd",
"output file to save LMPD into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -56,22 +53,22 @@
bitflag = limnPolyDataInfoBitFlag(pld);
fprintf(stderr, "!%s: bitflag = %d\n", me, bitflag);
fprintf(stderr, "!%s: rgba %d, norm %d, tex2 %d\n", me,
- (1 << limnPolyDataInfoRGBA) & bitflag,
- (1 << limnPolyDataInfoNorm) & bitflag,
+ (1 << limnPolyDataInfoRGBA) & bitflag, (1 << limnPolyDataInfoNorm) & bitflag,
(1 << limnPolyDataInfoTex2) & bitflag);
file = airFopen(outS, stdout, "w");
if (!file) {
fprintf(stderr, "%s: couldn't open \"%s\" for writing", me, outS);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, file, (airMopper)airFclose, airMopAlways);
- if (limnPolyDataClip(pld, nin, thresh)
- || limnPolyDataWriteLMPD(file, pld)) {
+ if (limnPolyDataClip(pld, nin, thresh) || limnPolyDataWriteLMPD(file, pld)) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopOkay(mop);
Modified: teem/trunk/src/limn/test/off2eps.c
===================================================================
--- teem/trunk/src/limn/test/off2eps.c 2024-07-23 16:51:37 UTC (rev 7224)
+++ teem/trunk/src/limn/test/off2eps.c 2024-07-23 16:52:53 UTC (rev 7225)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "../limn.h"
const char *info = ("Renders an OFF file to an EPS file.");
@@ -30,7 +29,7 @@
char *err, *inS, *outS;
limnCamera *cam;
float bg[3], winscale, edgeWidth[5], creaseAngle;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
limnObject *obj;
limnWindow *win;
@@ -43,9 +42,8 @@
airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways);
me = argv[0];
- hestOptAdd(&hopt, "i", "input OFF", airTypeString, 1, 1, &inS, NULL,
- "input OFF file");
- hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from,"4 4 4",
+ hestOptAdd(&hopt, "i", "input OFF", airTypeString, 1, 1, &inS, NULL, "input OFF file");
+ hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from, "4 4 4",
"position of camera, used to determine view vector");
hestOptAdd(&hopt, "at", "at point", airTypeDouble, 3, 3, cam->at, "0 0 0",
"camera look-at point, used to determine view vector");
@@ -55,15 +53,14 @@
"use a right-handed UVN frame (V points down)");
hestOptAdd(&hopt, "or", NULL, airTypeInt, 0, 0, &(cam->orthographic), NULL,
"use orthogonal projection");
- hestOptAdd(&hopt, "ur", "uMin uMax", airTypeDouble, 2, 2, cam->uRange,
- "-1 1", "range in U direction of image plane");
- hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange,
- "-1 1", "range in V direction of image plane");
+ hestOptAdd(&hopt, "ur", "uMin uMax", airTypeDouble, 2, 2, cam->uRange, "-1 1",
+ "range in U direction of image plane");
+ hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange, "-1 1",
+ "range in V direction of image plane");
hestOptAdd(&hopt, "e", "envmap", airTypeOther, 1, 1, &nmap, "",
- "16octa-based environment map",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "ws", "winscale", airTypeFloat, 1, 1, &winscale,
- "200", "world to points (PostScript) scaling");
+ "16octa-based environment map", NULL, NULL, nrrdHestNrrdNoTTY);
+ hestOptAdd(&hopt, "ws", "winscale", airTypeFloat, 1, 1, &winscale, "200",
+ "world to points (PostScript) scaling");
hestOptAdd(&hopt, "wire", NULL, airTypeInt, 0, 0, &wire, NULL,
"just do wire-frame rendering");
hestOptAdd(&hopt, "concave", NULL, airTypeInt, 0, 0, &concave, NULL,
@@ -87,8 +84,7 @@
"dihedral angles greater than this are creases");
hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps",
"output file to render postscript into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -107,13 +103,15 @@
airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways);
if (!(file = airFopen(inS, stdin, "r"))) {
fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, inS);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, file, (airMopper)airFclose, airMopAlways);
if (limnObjectReadOFF(obj, file)) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (describe) {
fprintf(stdout, "----------------- POST-READ -----------------\n");
@@ -124,7 +122,8 @@
if (limnObjectFaceReverse(obj)) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
if (describe) {
@@ -149,12 +148,12 @@
win->scale = winscale;
if (limnObjectRender(obj, cam, win)
- || (concave
- ? limnObjectPSDrawConcave(obj, cam, nmap, win)
- : limnObjectPSDraw(obj, cam, nmap, win))) {
+ || (concave ? limnObjectPSDrawConcave(obj, cam, nmap, win)
+ : limnObjectPSDraw(obj, cam, nmap, win))) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
fclose(win->file);
@@ -167,4 +166,3 @@
airMopOkay(mop);
return 0;
}
-
Modified: teem/trunk/src/limn/test/tbc.c
===================================================================
--- teem/trunk/src/limn/test/tbc.c 2024-07-23 16:51:37 UTC (rev 7224)
+++ teem/trunk/src/limn/test/tbc.c 2024-07-23 16:52:53 UTC (rev 7225)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
/*
test/tbc -s 0.95 -i s.txt -loop -n 13 -m 800 -t 55 170 > ! out.ps
*/
@@ -43,7 +42,6 @@
0 -10
*/
-
#include "../limn.h"
const char *info = ("Visualize the space of BC cubics with a spline.");
@@ -53,7 +51,7 @@
const char *me;
char *err;
limnSpline *spline;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
int bi, ci, i, N, M, loop;
Nrrd *ncptA, *ncptB, *nout;
@@ -64,8 +62,8 @@
me = argv[0];
hestOptAdd(&hopt, "i", "spline data", airTypeOther, 1, 1, &ncptA, NULL,
- "data points for the spline, must be 2-vectors",
- NULL, NULL, nrrdHestNrrd);
+ "data points for the spline, must be 2-vectors", NULL, NULL,
+ nrrdHestNrrdNoTTY);
hestOptAdd(&hopt, "loop", NULL, airTypeInt, 0, 0, &loop, NULL,
"the last control point is in fact the first");
hestOptAdd(&hopt, "n", "N", airTypeInt, 1, 1, &N, "10",
@@ -76,22 +74,20 @@
"translation for drawing");
hestOptAdd(&hopt, "s", "scale", airTypeDouble, 1, 1, &scale, "1.0",
"scaling for drawing");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
- if (!( 2 == ncptA->dim && 2 == ncptA->axis[0].size )) {
+ if (!(2 == ncptA->dim && 2 == ncptA->axis[0].size)) {
fprintf(stderr, "%s: didn't get a 2-D 2xN nrrd)\n", me);
airMopError(mop);
return 1;
}
spec = limnSplineTypeSpecNew(limnSplineTypeBC, 0, 0);
- airMopAdd(mop, ncptB=nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
- if (limnSplineNrrdCleverFix(ncptB, ncptA, limnSplineInfo2Vector,
- limnSplineTypeBC)
+ airMopAdd(mop, ncptB = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
+ if (limnSplineNrrdCleverFix(ncptB, ncptA, limnSplineInfo2Vector, limnSplineTypeBC)
|| !(spline = limnSplineNew(ncptB, limnSplineInfo2Vector, spec))) {
- airMopAdd(mop, err=biffGetDone(LIMN), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
airMopError(mop);
return 1;
@@ -98,13 +94,13 @@
}
spline->loop = loop;
airMopAdd(mop, spline, (airMopper)limnSplineNix, airMopAlways);
- airMopAdd(mop, nout=nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
+ airMopAdd(mop, nout = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
minT = limnSplineMinT(spline);
maxT = limnSplineMaxT(spline);
/* try one for error checking */
if (limnSplineSample(nout, spline, minT, M, maxT)) {
- airMopAdd(mop, err=biffGetDone(LIMN), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
airMopError(mop);
return 1;
@@ -114,21 +110,21 @@
printf("1 setlinewidth\n");
printf("%g %g translate\n", tran[0], tran[1]);
- for (ci=0; ci<N; ci++) {
- C = AIR_AFFINE(0, ci, N-1, 0.0, 1.0);
- for (bi=0; bi<N; bi++) {
- B = AIR_AFFINE(0, bi, N-1, 0.0, 1.0);
+ for (ci = 0; ci < N; ci++) {
+ C = AIR_AFFINE(0, ci, N - 1, 0.0, 1.0);
+ for (bi = 0; bi < N; bi++) {
+ B = AIR_AFFINE(0, bi, N - 1, 0.0, 1.0);
limnSplineBCSet(spline, B, C);
limnSplineSample(nout, spline, minT, M, maxT);
- out = (double*)(nout->data); /* shouldn't actually change */
+ out = (double *)(nout->data); /* shouldn't actually change */
printf("gsave\n");
- printf("%g %g translate\n", bi*500.0/(N-1), ci*500.0/(N-1));
+ printf("%g %g translate\n", bi * 500.0 / (N - 1), ci * 500.0 / (N - 1));
printf("%g %g scale\n", scale, scale);
- printf("%g %g moveto\n", out[0 + 2*0], out[1 + 2*0]);
- for (i=1; i<M; i++) {
- printf("%g %g lineto\n", out[0 + 2*i], out[1 + 2*i]);
+ printf("%g %g moveto\n", out[0 + 2 * 0], out[1 + 2 * 0]);
+ for (i = 1; i < M; i++) {
+ printf("%g %g lineto\n", out[0 + 2 * i], out[1 + 2 * i]);
}
if (spline->loop) {
printf("closepath\n");
@@ -144,4 +140,3 @@
airMopOkay(mop);
return 0;
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|