diff --git a/vroni/Include/defs.h b/vroni/Include/defs.h index 49575be..60302e5 100644 --- a/vroni/Include/defs.h +++ b/vroni/Include/defs.h @@ -26,8 +26,8 @@ #include "mydefs.h" #define PROG_NAME "V R O N I" -#define PROG_VERSION "7.6" -#define PROG_YEAR "1999-2023" +#define PROG_VERSION "7.7" +#define PROG_YEAR "1999-2024" /* */ /* get the definitions for "exterior applications" */ @@ -67,6 +67,8 @@ #define SiteCurrColor VroniBlue #define DTColor VroniWhite #define OffColor VroniWhite +#define PathColor VroniMagenta #define WMATColor VroniBlue +#define TOOLColor VroniWhite #endif diff --git a/vroni/Include/elapsed.h b/vroni/Include/elapsed.h deleted file mode 100644 index 8b13789..0000000 --- a/vroni/Include/elapsed.h +++ /dev/null @@ -1 +0,0 @@ - diff --git a/vroni/Include/ext_appl_defs.h b/vroni/Include/ext_appl_defs.h index 7ea69eb..97b0d03 100644 --- a/vroni/Include/ext_appl_defs.h +++ b/vroni/Include/ext_appl_defs.h @@ -25,7 +25,6 @@ #include "defs.h" #include -#include /* */ /* the following data types are used for user-defined entities that are to */ @@ -45,6 +44,7 @@ typedef int ean_type; /* ext. appl. hook for node */ typedef int eae_type; /* ext. appl. hook for edge */ typedef int eam_type; /* ext. appl. hook for wmat */ typedef int eao_type; /* ext. appl. hook for off_data */ +typedef int eah_type; /* ext. appl. hook for path_data */ /* * sample user-specific eap data: @@ -61,6 +61,7 @@ extern const ean_type ean_NIL; extern const eam_type eam_NIL; extern const eao_type eao_NIL; extern const eae_type eae_NIL; +extern const eah_type eah_NIL; #define ExtApplFuncNewInput diff --git a/vroni/Include/geom.h b/vroni/Include/geom.h index 6118202..61b6f4f 100644 --- a/vroni/Include/geom.h +++ b/vroni/Include/geom.h @@ -62,21 +62,21 @@ inline coord vroniObject::Centroid(coord pi, coord pj, coord pk) /** Build linar combination of vectors p and r by parameter t */ inline coord vroniObject::LinearComb(const coord & p, const coord & r, - double_arg t) + double_arg t_param) { coord q; - q.x = p.x + t*(r.x-p.x); - q.y = p.y + t*(r.y-p.y); + q.x = p.x + t_param*(r.x-p.x); + q.y = p.y + t_param*(r.y-p.y); return q; } /** Get the point q = p + t*v */ inline coord vroniObject::RayPnt(const coord & p, const coord & v, - double_arg t) + double_arg t_param) { coord q; - q.x = p.x + t*v.x; - q.y = p.y + t*v.y; + q.x = p.x + t_param*v.x; + q.y = p.y + t_param*v.y; return q; } diff --git a/vroni/Include/ipe_io.h b/vroni/Include/ipe_io.h index 488f0c2..640c5a1 100644 --- a/vroni/Include/ipe_io.h +++ b/vroni/Include/ipe_io.h @@ -37,19 +37,26 @@ #define LAYER1 "voronoi" #define LAYER2 "MAT" #define LAYER3 "delaunay" +#ifdef HSM +#define LAYER4 "path" +#else #define LAYER4 "offset" +#endif #define LAYER5 "MIC" #define LAYER6 "bd_vertices" #define LAYER7 "vd_nodes" +#define LAYER8 "tool" #define COLOR0 "seagreen" #define COLOR1 "red" #define COLOR2 "black" #define COLOR3 "blue" -#define COLOR4 "lightgray" +#define COLOR4 "purple" +//#define COLOR4 "lightgray" #define COLOR5 "yellow" #define COLOR6 "black" #define COLOR7 "violet" +#define COLOR8 "brown" #define PEN0 "ultrafat" #define PEN1 "normal" @@ -59,11 +66,13 @@ #define PEN5 "normal" #define PEN6 "normal" #define PEN7 "normal" +#define PEN8 "normal" FILE *InitIpeFile(char *filename); -FILE *InitIpe(char *filename, double_arg xl, double_arg xr, double_arg yl, double_arg yr); +FILE *InitIpe(char *filename, double_arg xl, double_arg xr, + double_arg yl, double_arg yr); void CloseIpeFile(FILE *ipe_file); @@ -82,14 +91,18 @@ void WriteArcCW(FILE *ipe_file, double_arg xc, double_arg yc, double_arg r, void WriteMark(FILE *ipe_file, int type, int size, double_arg x, double_arg y); -void SetIpeDimensions(double_arg xmin, double_arg xmax, double_arg ymin, double_arg ymax); +void SetIpeDimensions(double_arg xmin, double_arg xmax, + double_arg ymin, double_arg ymax); -void SetWorldDimensions(double_arg xmin, double_arg xmax, double_arg ymin, double_arg ymax); +void SetWorldDimensions(double_arg xmin, double_arg xmax, + double_arg ymin, double_arg ymax); void SetScaleFactor(void); -void InitIpeDimensions(double_arg xmin, double_arg ymin, double_arg xmax, double_arg ymax, - double_arg ixmin, double_arg iymin, double_arg ixmax, double_arg iymax); +void InitIpeDimensions(double_arg xmin, double_arg ymin, + double_arg xmax, double_arg ymax, + double_arg ixmin, double_arg iymin, + double_arg ixmax, double_arg iymax); double scaleX(double x); double scaleY(double y); @@ -98,7 +111,9 @@ void WriteLineSegment(FILE *ipe_file, double x1, double y1, double x2, double y2); void WriteCircularArc(FILE *ipe_file, double_arg xc, double_arg yc, - double_arg x1, double_arg y1, double_arg x2, double_arg y2, vr_bool ccw); + double_arg x1, double_arg y1, double_arg x2, double_arg y2, + vr_bool ccw); +void WriteCircle(FILE *ipe_file, double_arg xc, double_arg yc, double_arg rad); #endif diff --git a/vroni/Include/path.h b/vroni/Include/path.h new file mode 100644 index 0000000..f32083d --- /dev/null +++ b/vroni/Include/path.h @@ -0,0 +1,19 @@ +#ifndef VRONI_PATH_H +#define VRONI_PATH_H + +#include "coord.h" +#include "vddata.h" + +struct pth_data { + t_site type; /* type of path element: SEG, CCW, or CW. */ + coord start; /* coordinates of start point of element */ + coord center; /* coordinates of center (if CW/CCW arc) */ +#ifdef EXT_APPL_OFF + eah_type ext_appl; +#endif + //Ensure construction doesn't implicitly initialize elements - done explicitly later anyway + inline pth_data() {} +}; /* data for one path element */ + + +#endif diff --git a/vroni/Include/util.h b/vroni/Include/util.h index 70cc785..d0a22ce 100644 --- a/vroni/Include/util.h +++ b/vroni/Include/util.h @@ -273,8 +273,10 @@ inline static double CubicRoot(double_arg x) /* */ -/* some macros for epsilon-based comparisons with respect to zero... */ -/* */ +/* some macros for epsilon-based comparisons with respect to zero. */ +/* we assumed zero to be replaced by the interval [-b,b], for some small */ +/* value b, and the comparisons are carried out accordingly. */ +/* */ #define lt(a, b) ( ((a) < -b) ) #define ge(a, b) (! ((a) < -b) ) #define le(a, b) ( ((a) <= b) ) diff --git a/vroni/Include/vroni_object.h b/vroni/Include/vroni_object.h index f93fb0d..da1be45 100644 --- a/vroni/Include/vroni_object.h +++ b/vroni/Include/vroni_object.h @@ -56,6 +56,7 @@ #include "ext_appl_inout.h" #include "defs.h" #include "offset.h" +#include "path.h" #include "util.h" /* */ @@ -394,8 +395,36 @@ public: int num_offset_loops, int num_offset_segs, int num_offset_arcs)); + - + void apiResetPathData(void); /* discard path computed so far */ + + void apiOutputPath(void *output, /* this is a pointer to a */ + /* user-defined object, such as */ + /* a file or a structure; */ + void (vroniObject::*StartPathFuncPtr)( + void *output, + int num_path_ele), + void (vroniObject::*WritePathSegFuncPtr)( + void *output, +#ifdef EXT_APPL_PATH + eah_type ext_appl_path, +#endif + double_arg x1, double_arg y1, + double_arg x2, double_arg y2), + void (vroniObject::*WritePathArcFuncPtr)( + void *output, +#ifdef EXT_APPL_PATH + eah_type ext_appl_path, +#endif + double_arg x1, double_arg y1, + double_arg x2, double_arg y2, + double_arg xc, double_arg yc, + vr_bool ccw), + void (vroniObject::*EndPathFuncPtr)( + void *output)); + + // // INPUT GEOMETRY // @@ -991,6 +1020,7 @@ public: vr_bool computed; vr_bool wmat_computed; vr_bool mic_computed; + vr_bool path_computed; vr_bool vd_output; vr_bool first_input; int first_pnt; @@ -1082,6 +1112,17 @@ public: vronivector cir_buf; int num_cir_buf, max_num_cir_buf; + + struct dsk_buffer + { + coord cntr; /* center of a circle */ + double radius; /* radius of a circle */ + //Ensure construction doesn't implicitly initialize elements - done explicitly later anyway + inline dsk_buffer() {} + }; + + vronivector dsk_buf; + int num_dsk_buf, max_num_dsk_buf; #endif /* api_functions.cc */ @@ -1096,6 +1137,7 @@ public: vr_bool draw_dte; vr_bool draw_mat; vr_bool draw_mic; + vr_bool draw_tool; #endif /* data_off.cc */ @@ -1355,6 +1397,7 @@ public: void AddEdgeToBuffer(double_arg x1, double_arg y1, double_arg x2, double_arg y2, int color, double dPar1, double dPar2); void AddCirToBuffer(coord cntr, double_arg radius); + void AddDskToBuffer(coord cntr, double_arg radius); void WriteIpeOutput(char *filename); void AddOffToBuffer(double_arg x1, double_arg y1, double_arg x2, double_arg y2, @@ -1386,8 +1429,6 @@ public: /* driver.cc: */ - - void HandleWriteVDOutput(void); void ParseCommandLineArgs(int argc, char *argv[], vr_bool *graphics, vr_bool *color_graphics, vr_bool *full_screen); @@ -1596,7 +1637,10 @@ public: vr_bool *write_vd, char *vd_file, double *vd_apx_dist, vr_bool *left_vd, vr_bool *right_vd, vr_bool *vr_incr, char *vr_file, - int *inputprec, int *mpfr_prec, int *vr_seed); + int *inputprec, int *mpfr_prec, int *vr_seed, + vr_bool *compute_path, double *radius, double *angle, + double *step_over, + vr_bool *write_path, char *path_file); void EvalError(void); @@ -1808,6 +1852,12 @@ public: void UpdateRecursive(int i, t_site t, int n, int e, int *el, int *er, int *nl, int *nr); + void InsertBisectorClose(int i, t_site t, int e, int k, + int e1r, int e2l, int n1r, int n2l); + + void InsertReplacement(int i, t_site t, int n, int e, int k, + int* el, int* er, int* nl, int* nr); + void ResetTreeDeleteStatus(int e, int n); void InsertApexDegreeTwoNodeSeg(int e, int i, int i1, t_site t1); @@ -2430,6 +2480,7 @@ public: vr_bool pnts_deleted; vr_bool desperate; + double cpu_time_path; double cpu_time_pre; double cpu_time_pnt; double cpu_time_seg; @@ -3072,6 +3123,68 @@ public: double_arg y_max, int root); #endif + /* hsm/path.cc */ + vronivector path_data; + int num_path_data; + int max_num_path_data; + + vr_bool compute_path; + double tool_rad; + double step_over; + double angle; + vr_bool write_path; + char path_file[256]; + int path_VD_ID; + + int GetNumPathData(void); + + void StorePathData(coord start, coord center, t_site type, + double_arg tool_rad); + + void FreePathData(void); + + void ResetPathData(void); + + coord GetPathPntCoords(int i); + + coord GetPathCntrCoords(int i); + + t_site GetPathEleType(int i); + + void ComputePath(vr_bool time, char path_file[], + vr_bool write_path, vr_bool dxf_format, + double_arg tool_rad, double_arg step_over, + double_arg angle_); + +#ifdef GRAPHICS + void StartPathBuf(void*, int); + + void WritePathSegBuf(void*, +#ifdef EXT_APPL_PATH + eah_type ext_appl_path, +#endif + double_arg x1, double_arg y1, + double_arg x2, double_arg y2); + void WritePathArcBuf(void*, +#ifdef EXT_APPL_PATH + eah_type ext_appl_path, +#endif + double_arg x1, double_arg y1, + double_arg x2, double_arg y2, + double_arg xc, double_arg yc, vr_bool ccw); + + void EndPathBuf(void*); + + void AddPathToBuffer(void); +#endif + + void StartPathDXF(void *output, int ); + + void EndPathDXF(void *output); + + void WritePathDXF(char pth_file[]); + + diff --git a/vroni/Lib/vroniD32.lib b/vroni/Lib/vroniD32.lib index 93d6eca..7605d07 100644 Binary files a/vroni/Lib/vroniD32.lib and b/vroni/Lib/vroniD32.lib differ diff --git a/vroni/Lib/vroniD32.pdb b/vroni/Lib/vroniD32.pdb index d6651cf..94bcd7f 100644 Binary files a/vroni/Lib/vroniD32.pdb and b/vroni/Lib/vroniD32.pdb differ diff --git a/vroni/Lib/vroniD64.lib b/vroni/Lib/vroniD64.lib index a262321..9ff9efb 100644 Binary files a/vroni/Lib/vroniD64.lib and b/vroni/Lib/vroniD64.lib differ diff --git a/vroni/Lib/vroniR32.lib b/vroni/Lib/vroniR32.lib index 5b7df58..0224454 100644 Binary files a/vroni/Lib/vroniR32.lib and b/vroni/Lib/vroniR32.lib differ diff --git a/vroni/Lib/vroniR64.lib b/vroni/Lib/vroniR64.lib index efa69f2..2f2ab7b 100644 Binary files a/vroni/Lib/vroniR64.lib and b/vroni/Lib/vroniR64.lib differ