mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-22 23:16:27 +02:00
gp2rml: improved distance calculation; corrected compiler invocation
This commit is contained in:
parent
fb117b20e5
commit
76b1b3e42e
@ -16,7 +16,7 @@ MAIN=gp2rml
|
|||||||
OBJS=gp2rml.o
|
OBJS=gp2rml.o
|
||||||
|
|
||||||
CFLAGS = -g -Wall -Wshadow
|
CFLAGS = -g -Wall -Wshadow
|
||||||
LDFLAGS = -lm
|
LDLIBS = -lm
|
||||||
|
|
||||||
$(MAIN): $(OBJS)
|
$(MAIN): $(OBJS)
|
||||||
# $(CC) $(LDFLAGS) -o $(MAIN) $(OBJS)
|
# $(CC) $(LDFLAGS) -o $(MAIN) $(OBJS)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* gp2rml.c - Convert from gnuplot to RML
|
* gp2rml.c - Convert from gnuplot to RML
|
||||||
*
|
*
|
||||||
* Written 2010-2011 by Werner Almesberger
|
* Written 2010-2012 by Werner Almesberger
|
||||||
* Copyright 2010-2011 Werner Almesberger
|
* Copyright 2010-2012 Werner Almesberger
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -131,6 +131,7 @@ static void output_paths(double z_clear, double xy_speed, double z_speed)
|
|||||||
const struct segment *seg;
|
const struct segment *seg;
|
||||||
double x = 0, y = 0, z = 0;
|
double x = 0, y = 0, z = 0;
|
||||||
double d, s = 0, t = 0;
|
double d, s = 0, t = 0;
|
||||||
|
double txy, tz;
|
||||||
|
|
||||||
printf("IN;!MC1;PA\n");
|
printf("IN;!MC1;PA\n");
|
||||||
printf("!ZO%d;!PZ0,%d;PU\n", units(z_max), units(z_clear));
|
printf("!ZO%d;!PZ0,%d;PU\n", units(z_max), units(z_clear));
|
||||||
@ -153,9 +154,12 @@ static void output_paths(double z_clear, double xy_speed, double z_speed)
|
|||||||
while (seg) {
|
while (seg) {
|
||||||
printf("!ZZ%d,%d,%d\n", units(seg->x), units(seg->y),
|
printf("!ZZ%d,%d,%d\n", units(seg->x), units(seg->y),
|
||||||
units(seg->z-z_max));
|
units(seg->z-z_max));
|
||||||
d = hypot(hypot(x-seg->x, y-seg->y), z-seg->z);
|
d = hypot(x-seg->x, y-seg->y);
|
||||||
|
txy = d/xy_speed;
|
||||||
|
tz = fabs(z-seg->z)/z_speed;
|
||||||
|
t += txy > tz ? txy : tz;
|
||||||
|
d = hypot(d, z-seg->z);
|
||||||
s += d;
|
s += d;
|
||||||
t += d/z_speed;
|
|
||||||
x = seg->x;
|
x = seg->x;
|
||||||
y = seg->y;
|
y = seg->y;
|
||||||
z = seg->z;
|
z = seg->z;
|
||||||
|
Loading…
Reference in New Issue
Block a user