From 78a31caf9c482706040a38173c8e2d6913fa282e Mon Sep 17 00:00:00 2001 From: rodri Date: Tue, 28 Apr 2020 12:39:05 +0000 Subject: improve lerp code and add formatting procedures. --- fmt.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 fmt.c (limited to 'fmt.c') diff --git a/fmt.c b/fmt.c new file mode 100644 index 0000000..359b4ba --- /dev/null +++ b/fmt.c @@ -0,0 +1,28 @@ +#include +#include +#include + +int +vfmt(Fmt *f) +{ + Point2 p; + + p = va_arg(f->args, Point2); + return fmtprint(f, "[%g %g %g]", p.x, p.y, p.w); +} + +int +Vfmt(Fmt *f) +{ + Point3 p; + + p = va_arg(f->args, Point3); + return fmtprint(f, "[%g %g %g %g]", p.x, p.y, p.z, p.w); +} + +void +GEOMfmtinstall(void) +{ + fmtinstall('v', vfmt); + fmtinstall('V', Vfmt); +} -- cgit v1.2.3