2018-03-02 05:00:01 +01:00
|
|
|
#ifndef _seg_h_
|
|
|
|
#define _seg_h_
|
|
|
|
|
|
|
|
#include "v3.h"
|
|
|
|
|
|
|
|
typedef struct _seg_t seg_t;
|
|
|
|
struct _seg_t {
|
|
|
|
v3_t p[2];
|
|
|
|
v3_t src[2];
|
|
|
|
seg_t * next;
|
|
|
|
};
|
|
|
|
|
2018-03-03 02:00:51 +01:00
|
|
|
static inline seg_t *
|
2018-03-02 05:00:01 +01:00
|
|
|
seg_new(
|
|
|
|
const v3_t p0,
|
|
|
|
const v3_t p1
|
|
|
|
)
|
|
|
|
{
|
|
|
|
seg_t * const s = calloc(1, sizeof(*s));
|
|
|
|
if (!s)
|
|
|
|
return NULL;
|
|
|
|
s->p[0] = p0;
|
|
|
|
s->p[1] = p1;
|
|
|
|
s->src[0] = p0;
|
|
|
|
s->src[1] = p1;
|
|
|
|
s->next = NULL;
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-03 02:00:51 +01:00
|
|
|
static inline void
|
2018-03-02 05:00:01 +01:00
|
|
|
seg_print(
|
|
|
|
const seg_t * const s
|
|
|
|
)
|
|
|
|
{
|
2018-03-03 20:14:06 +01:00
|
|
|
fprintf(stderr, "%+5.1f,%+5.1f,%5.1f -> %+5.1f,%+5.1f,%5.1f\n",
|
2018-03-02 05:00:01 +01:00
|
|
|
s->p[0].p[0],
|
|
|
|
s->p[0].p[1],
|
2018-03-03 20:14:06 +01:00
|
|
|
s->p[0].p[2],
|
2018-03-02 05:00:01 +01:00
|
|
|
s->p[1].p[0],
|
|
|
|
s->p[1].p[1],
|
2018-03-03 20:14:06 +01:00
|
|
|
s->p[1].p[2]
|
|
|
|
//s->src[0].p[0],
|
|
|
|
//s->src[0].p[1],
|
|
|
|
//s->src[1].p[0],
|
|
|
|
//s->src[1].p[1]
|
2018-03-02 05:00:01 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|