Files
SaraP bf3a3fa297 Extern :
- aggiunta libreria vroni 7.6.
2023-11-23 12:09:32 +01:00

219 lines
5.8 KiB
C

/*****************************************************************************/
/* */
/* Copyright (C) 1999-2023 M. Held */
/* */
/* This code is not in the public domain. All rights reserved! Please make */
/* sure to read the full copyright statement contained in "README.txt" or in */
/* the "main" file of this code, such as "main.cc". */
/* */
/*****************************************************************************/
#ifndef VRONI_OFFSET_H
#define VRONI_OFFSET_H
#include "defs.h"
/* */
/* the offset curves are stored as closed loops in the array offset_list[]. */
/* the individual offset segments are stored in the array offset_data[]. */
/* the i-th offset curve contains the offset segments whose indices range */
/* from offset_list[i].start to offset_list[i].end. the actual offset */
/* distance of the i-th offset curve is stored in offset_list[i].offset. */
/* there is a total of num_offset_list many offset curves. */
/* */
struct off_list {
int start; /* index of first segment of this offset curve . */
int end; /* index of last segment of this offset curve. */
double offset; /* boundary clearance for this offset curve. */
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline off_list() {}
}; /* data for one offset curve. */
struct off_data {
int site; /* index of corresponding site (contour segment). */
t_site type; /* type of corresponding contour segment: PNT, LINE, */
/* or CCW, CW. */
coord p; /* coordinates of start point of offset segment */
#ifdef EXT_APPL_OFF
eao_type ext_appl;
#endif
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline off_data() {}
}; /* data for one offset segment */
off_list* GetOffsetList(int i);
off_data* GetOffsetData(int i);
#define SetEdgeFlagNew(I, F) \
{\
assert(InEdgeFlagList(I)); \
edge_flags[I].e_new = F;\
}
#define SetEdgeFlagDeg(I, F) \
{\
assert(InEdgeFlagList(I)); \
edge_flags[I].deg = F;\
}
#define SetEdgeDataInit(I, F) \
{\
assert(InEdgeDataList(I)); \
edge_data[I].init = F;\
}
#define GetEdgeFlagNew(I) (assert(InEdgeFlagList(I)), edge_flags[I].e_new)
#define GetEdgeFlagDeg(I) (assert(InEdgeFlagList(I)), edge_flags[I].deg)
#define GetEdgeDataInit(I) (assert(InEdgeDataList(I)), edge_data[I].init)
#define AdvanceActiveEdge(I, J, delete) \
{\
if (delete) { \
assert(InActiveEdgeList(J)); \
--num_active_edges; \
if ((num_active_edges >= 0) && (J < num_active_edges)) { \
I = active_edges[J] = active_edges[num_active_edges]; \
} \
else { \
I = NIL; \
} \
} \
else { \
++J; \
if (J < num_active_edges) { \
I = active_edges[J]; \
} \
else { \
I = NIL; \
} \
} \
}
// define from offset.cc
#define OFFS_BLOCK_SIZE 32768
#define OFFS_HALF_BLOCK_SIZE 1024
#define NewOffsetCurve \
{ \
cur_offset_list = num_offset_list; \
if (cur_offset_list >= max_num_offset_list) { \
max_num_offset_list += OFFS_HALF_BLOCK_SIZE; \
gentlyResizeSTLVector(offset_list, max_num_offset_list, "offset:offset_list"); \
} \
++num_offset_list; \
\
offset_list[cur_offset_list].start = num_offset_data; \
offset_list[cur_offset_list].offset = UnscaleV(t); \
\
}
#define SetOffsetNumber \
{\
offset_list[cur_offset_list].end = num_offset_data - 1; \
}
#define GetCurrentOffsetSegNumber num_offset_data
#ifdef EXT_APPL_OFF
#define StoreOffsetData(S, T, P) \
{ \
if (num_offset_data >= max_num_offset_data) { \
max_num_offset_data += OFFS_BLOCK_SIZE; \
gentlyResizeSTLVector(offset_data, max_num_offset_data, "offset:offset_data"); \
} \
offset_data[num_offset_data].site = S; \
offset_data[num_offset_data].type = T; \
offset_data[num_offset_data].p = P; \
offset_data[num_offset_data].ext_appl = eao_NIL; \
\
++num_offset_data; \
}
#else
#define StoreOffsetData(S, T, P) \
{ \
if (num_offset_data >= max_num_offset_data) { \
max_num_offset_data += OFFS_BLOCK_SIZE; \
gentlyResizeSTLVector(offset_data, max_num_offset_data, "offset:offset_data"); \
} \
offset_data[num_offset_data].site = S; \
offset_data[num_offset_data].type = T; \
offset_data[num_offset_data].p = P; \
\
++num_offset_data; \
}
#endif
#ifdef EXT_APPL_OFF
#define GetExtApplOffset(O) \
(\
assert(InOffsetData(O)), \
offset_data[O].ext_appl)
#define SetExtApplOffset(O, X) \
{\
assert(InOffsetData(O)), \
offset_data[O].ext_appl = X; \
}
#endif
#define GetOffsetListStart(i) \
(\
assert(InOffsetList(i)), \
offset_list[i].start)
#define GetOffsetListEnd(i) \
(\
assert(InOffsetList(i)), \
offset_list[i].end)
#define GetOffsetEleType(j) \
(\
assert(InOffsetData(j)), \
offset_data[j].type)
#define GetOffsetEleSite(j) \
(\
assert(InOffsetData(j)), \
offset_data[j].site)
#define GetOffsetXCoord(j) \
(\
assert(InOffsetData(j)), \
offset_data[j].p.x)
#define GetOffsetYCoord(j) \
(\
assert(InOffsetData(j)), \
offset_data[j].p.y)
#define GetOffsetPntCoords(j) \
(\
assert(InOffsetData(j)), \
offset_data[j].p)
#endif