1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

Added override (in gnuplot file) for inside/outside path detection.

- cameo/cameo.c (process_paths): explain the inside/outside path detection
  heuristics
- cameo/path.h (struct path), cameo/path.c (path_new): added attribute
  "outside" to explicitly mark paths as outside edges
- cameo/path.c (path_from): new function to make a path that takes the
  attributes of another path
- cameo/path.c (path_reverse, path_offset): use path_from instead of
  path_new
- cameo/gnuplot.c (gnuplot_read, gnuplot_do_write): read and write the
  #%outside hint
This commit is contained in:
Werner Almesberger
2010-11-01 18:50:24 -03:00
parent 17afa3e2bb
commit d77b4c8570
4 changed files with 37 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "path.h"
#include "gnuplot.h"
@@ -25,6 +26,7 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
char buf[1024];
double x, y, z, tmp;
double r_tool = r_tool_default;
int outside = 0;
int n;
struct path *paths = NULL, *path = NULL;
struct path **lnk = &paths;
@@ -39,6 +41,8 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
lineno++;
if (sscanf(buf, "#%%r_tool=%lf\n", &tmp) == 1)
r_tool = tmp;
if (!strcmp(buf, "#%outside\n"))
outside = 1;
if (*buf == '#')
continue;
n = sscanf(buf, "%lf %lf %lf\n", &x, &y, &z);
@@ -46,6 +50,7 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
case -1:
path = NULL;
r_tool = r_tool_default;
outside = 0;
continue;
case 2:
z = 0;
@@ -60,6 +65,7 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
if (!path) {
path = path_new(r_tool);
path->outside = outside;
*lnk = path;
lnk = &path->next;
}
@@ -81,6 +87,8 @@ static int gnuplot_do_write(FILE *file, const struct path *paths)
return 0;
if (fprintf(file, "#%%r_tool=%f\n", path->r_tool) < 0)
return 0;
if (path->outside && fprintf(file, "#%%outside\n") < 0)
return 0;
for (p = path->first; p; p = p->next)
if (fprintf(file, "%f %f %f\n", p->x, p->y, p->z) < 0)
return 0;