vroni 7.6 :

- modifiche per integrare vroni con le nostre librerie
- spostamento header in Extern per evitare duplicati.
This commit is contained in:
SaraP
2023-11-23 11:26:13 +01:00
parent f3e15b8c8d
commit de65914f43
56 changed files with 456 additions and 9864 deletions
+2 -174
View File
@@ -50,175 +50,7 @@
/* */
/*****************************************************************************/
/* */
/* get standard libraries */
/* */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <float.h>
#include <assert.h>
#include <string.h>
/* */
/* get my header files */
/* */
#include "fpkernel.h"
#include "coord.h"
#include "vroni_object.h"
/* */
/* function prototypes of functions provided in this file; see arg_eval.cc */
/* for the default values of most of those parameters. */
/* */
vroniObject& API_VD(); /* get access to underlying VD */
void API_ParseCommandLineArgs(int argc, char *argv[], vr_bool *graphics,
vr_bool *color_graphics, vr_bool *full_screen);
void API_InitializeProgram(void); /* call this routine once prior */
/* calling any other routine of */
/* VRONI */
void API_GetInputData(vr_bool *input_received);
void API_ProceedWithoutGraphics(vr_bool new_input);
void API_ResetAll(void); /* call this routine whenever */
/* new data is to be input and */
/* VRONI's data structures are */
/* to be reset; note that this */
/* function won't free memory */
/* allocated */
void API_TerminateProgram(void); /* call this routine to release */
/* all memory allocated by VRONI*/
void API_HandleInput(char input_file[], /* name of the input file */
vr_bool *new_input, /* true if new data has been */
/* read */
vr_bool read_polygon, /* read ".dat" format */
vr_bool read_poly, /* read ".poly" format */
vr_bool read_sites, /* read ".site" format */
vr_bool read_xdr, /* read ".xdr" format */
vr_bool read_e00, /* read ".e00" format */
vr_bool read_polylines, /* read ".polylines" format */
vr_bool read_usgs, /* read ".usgs" format */
vr_bool read_dxf, /* read ".dxf" format */
vr_bool read_pnts, /* read ".pnt" format */
vr_bool read_graphml); /* read ".graphml" format */
void API_FileInput(char input_file[], /* name of the input file */
vr_bool *new_input); /* true if new data has been */
/* read */
/* this function requires the */
/* user to stick to my naming */
/* convention for the extension */
/* of the input file relative */
/* to the data format used */
void API_ArrayInput(int number_of_points, /* data in point_data[0,..,k] */
/* for k := number_of_points-1 */
in_pnts *point_data, /* see ext_appl_inout.h */
int number_of_segments,
in_segs *segment_data, /* see ext_appl_inout.h */
int number_of_arcs,
in_arcs *arc_data, /* see ext_appl_inout.h */
vr_bool *new_input);
void API_ComputeVD(vr_bool save_data, /* save input data to file? */
vr_bool new_data, /* first call for this data? */
vr_bool time, /* do you want to time the */
/* computation? */
int bound, /* scale factor for bounding */
/* box; default value: 3 */
int sample, /* sampling factor for sampling */
/* segs/arcs; default: 0; */
/* see SampleData() in */
/* approx.cc */
int approx, /* approximation factor for */
/* circular arcs; default: 0; */
/* see ApproxArcsHeuristic() in */
/* approx.cc. obsolet by now! */
char output_file[], /* name of the output file; */
/* irrelevant if save_data is */
/* false */
vr_bool discard_duplicate_sites,
/* shall the code check prior */
/* to the computation whether */
/* duplicate segs/arcs have */
/* been input? default: false. */
vr_bool pnts_only, /* compute VD/DT of points only */
vr_bool write_vd_dt, /* output point VD/DT */
char vd_dt_file[], /* output file for point VD/DT */
vr_bool clean_up); /* shall we clean up the data */
/* prior to the VD computation? */
void API_ComputeOff(vr_bool time, /* do you want to time the */
/* computation? */
char off_file[], /* name of the file that will */
/* contain the offsets computed */
vr_bool write_off, /* shall we output the offsets */
/* to off_file[]? */
vr_bool dxf_format, /* if offsets are to be output: */
/* shall we use DXF format? */
double t_offset, /* compute offset curve(s) for */
/* offset distance t_offset */
double d_offset, /* incremental step-over */
/* distance for further offset */
/* curves */
vr_bool auto_offset, /* shall we use my heuristic */
/* for finding offset distances */
/* that create a family of */
/* offsets? */
vr_bool left_offset, /* true if offsets are to be */
/* computed only on the left */
/* side of input segments */
vr_bool right_offset); /* true if offsets are to be */
/* computed only on the right */
/* side of input segments */
#ifdef MAT
void API_ComputeWMAT(vr_bool auto_wmat, /* shall we use my heuristic */
/* for finding nice WMAT */
/* thresholds? */
double wmat_angle, /* angle threshold for WMAT */
/* computation;in radians, out */
/* of the interval [0, pi] */
double wmat_dist, /* distance threshold for WMAT */
/* computation */
vr_bool time, /* do you want to time the */
/* computation? */
vr_bool left_wmat, /* true if WMAT is to be */
/* computed only on the left */
/* side of input segments */
vr_bool right_wmat); /* true if WMAT is to be */
/* computed only on the right */
/* side of input segments */
#endif
#ifdef WRITE_VD
void API_Output_VD(char vd_file[], /* name of the file that will */
/* contain the VD polygons */
double vd_apx_dist, /* sampling distance used for */
/* approximating conic VD edges */
vr_bool left_vd, /* true if VD is to be */
/* output only on the left */
/* side of input segments */
vr_bool right_vd); /* true if VD is to be */
/* output on the right */
/* side of input segments */
#endif
void API_ComputeOutputMIC(vr_bool time, /* do you want to time the */
/* computation? */
vr_bool left_mic, /* true if MIC is to be */
/* computed only on the left */
/* side of input segments */
vr_bool right_mic, /* true if MIC is to be */
/* computed only on the right */
/* side of input segments */
coord *center, /* x,y-coordinates of a MIC */
/* center */
double *radius); /* radius of a MIC circle */
void API_ResetOffsetData(void); /* discard all offsets computed */
/* so far */
void API_HandleError(void); /* VRONI exception handling */
const char* API_GetProgName();
const char* API_GetProgVersion();
const char* API_GetProgYear();
#include "api_functions.h"
/* */
@@ -554,8 +386,4 @@ const char* API_GetProgVersion()
const char* API_GetProgYear()
{
return static_vd.apiGetProgYear();
}
#include "ext_appl_defs.cc"
}
-101
View File
@@ -1,101 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2003--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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_APPROX_H
#define VRONI_APPROX_H
inline void ApproxArc(const coord & p1, const coord & p2,
double_arg xc3, double_arg yc3, double_arg radius,
vr_bool ccw_orientation, double_arg apx_absolute,
vronivector<coord> & apx_vtx, int & max_num_apx_vtx,
double_arg max_incr, int & number)
{
double incr;
/* */
/* determine the start angle and end angle of the arc */
/* */
double angle_s = atan2(p1.y - yc3, p1.x - xc3);
double angle_e = atan2(p2.y - yc3, p2.x - xc3);
if (angle_s < 0.0) angle_s += M_2PI;
if (angle_e < 0.0) angle_e += M_2PI;
if (angle_e < angle_s) angle_e += M_2PI;
/* */
/* determine the angular increment incr: we will insert points at */
/* the angles angle_s + 0.5 * incr, angle_s + 1.5 * incr, ..., */
/* angle_e - 0.5 * incr (for a CCW arc). */
/* */
if (apx_absolute > 0.0) {
incr = acos(radius / (radius + apx_absolute));
incr = Min(incr, max_incr);
}
else {
incr = max_incr;
}
incr *= 10.0;
assert(gt(incr, ZERO));
double diff = (angle_e - angle_s);
incr = diff / (2.0 * incr);
number = REAL_TO_INT(Ceiling(incr));
if (number <= 0) number = 1;
incr = diff / ((double) (number));
/* */
/* the new pnts will lie at a distance lgth from the arc's center */
/* */
// double lgth = radius / cos(incr / 2.0);
double lgth = radius;
double alpha;
if (ccw_orientation) {
alpha = angle_s + incr / 2.0;
}
else {
alpha = angle_e - incr / 2.0;
incr = - incr;
}
/* */
/* allocate memory for the new vertices to be computed */
/* */
if (number > max_num_apx_vtx) {
max_num_apx_vtx = number;
gentlyResizeSTLVector(apx_vtx, max_num_apx_vtx, "approx:apx_vtx");
}
/* */
/* compute and store the new pnts and segs */
/* */
//printf("p1.x = %20.16f, p1.y = %20.16f\n", p1.x, p1.y);
//printf("p2.x = %20.16f, p2.y = %20.16f\n", p2.x, p2.y);
for (int k = 0; k < number; ++k) {
assert(k <= max_num_apx_vtx);
apx_vtx[k].x = xc3 + lgth * cos(alpha);
apx_vtx[k].y = yc3 + lgth * sin(alpha);
//printf("alpha = %20.16f\n", alpha);
alpha += incr;
}
}
#endif
+59 -59
View File
@@ -226,9 +226,9 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e,
if (jk_joint) { /* keep original i-j-k order */
}
else if (ik_joint) { /* put into the order j-i-k */
Swap(i, j, tmpi);
Swap(spi, spj, tmp);
Swap(epi, epj, tmp);
VroniSwap(i, j, tmpi);
VroniSwap(spi, spj, tmp);
VroniSwap(epi, epj, tmp);
jk_joint = true;
ik_joint = false;
}
@@ -237,24 +237,24 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e,
}
else if (ik_joint) {
if (jk_joint) { /* put into the order i-k-j */
Swap(j, k, tmpi);
Swap(spj, spk, tmp);
Swap(epj, epk, tmp);
VroniSwap(j, k, tmpi);
VroniSwap(spj, spk, tmp);
VroniSwap(epj, epk, tmp);
ij_joint = true;
ik_joint = false;
}
else { /* put into the order i-k-j */
Swap(j, k, tmpi);
Swap(spj, spk, tmp);
Swap(epj, epk, tmp);
VroniSwap(j, k, tmpi);
VroniSwap(spj, spk, tmp);
VroniSwap(epj, epk, tmp);
ij_joint = true;
ik_joint = false;
}
}
else if (jk_joint) { /* put into the order k-j-i */
Swap(i, k, tmpi);
Swap(spi, spk, tmp);
Swap(epi, epk, tmp);
VroniSwap(i, k, tmpi);
VroniSwap(spi, spk, tmp);
VroniSwap(epi, epk, tmp);
ij_joint = true;
jk_joint = false;
}
@@ -324,45 +324,45 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e,
if (!(ij_counter || ij_tangent)) {
if (ik_tangent || ik_counter) {
Swap(ij_counter, ik_counter, tmpi);
Swap(ij_tangent, ik_tangent, tmpi);
Swap(j, k, tmpi);
Swap(spj, spk, tmp);
Swap(epj, epk, tmp);
Swap(c2, c3, tmp);
Swap(rr2, rr3, tmpr);
Swap(d_c1c2, d_c1c3, tmpr);
VroniSwap(ij_counter, ik_counter, tmpi);
VroniSwap(ij_tangent, ik_tangent, tmpi);
VroniSwap(j, k, tmpi);
VroniSwap(spj, spk, tmp);
VroniSwap(epj, epk, tmp);
VroniSwap(c2, c3, tmp);
VroniSwap(rr2, rr3, tmpr);
VroniSwap(d_c1c2, d_c1c3, tmpr);
}
else if (jk_tangent || jk_counter) {
Swap(ij_counter, jk_counter, tmpi);
Swap(ij_tangent, jk_tangent, tmpi);
Swap(i, k, tmpi);
Swap(spi, spk, tmp);
Swap(epi, epk, tmp);
Swap(c1, c3, tmp);
Swap(rr1, rr3, tmpr);
Swap(d_c1c2, d_c2c3, tmpr);
VroniSwap(ij_counter, jk_counter, tmpi);
VroniSwap(ij_tangent, jk_tangent, tmpi);
VroniSwap(i, k, tmpi);
VroniSwap(spi, spk, tmp);
VroniSwap(epi, epk, tmp);
VroniSwap(c1, c3, tmp);
VroniSwap(rr1, rr3, tmpr);
VroniSwap(d_c1c2, d_c2c3, tmpr);
}
}
else if (!(jk_counter || jk_tangent)) {
if (ik_tangent || ik_counter) {
Swap(ij_counter, ik_counter, tmpi);
Swap(ij_tangent, ik_tangent, tmpi);
Swap(j, k, tmpi);
Swap(spj, spk, tmp);
Swap(epj, epk, tmp);
Swap(c2, c3, tmp);
Swap(rr2, rr3, tmpr);
Swap(d_c1c2, d_c1c3, tmpr);
VroniSwap(ij_counter, ik_counter, tmpi);
VroniSwap(ij_tangent, ik_tangent, tmpi);
VroniSwap(j, k, tmpi);
VroniSwap(spj, spk, tmp);
VroniSwap(epj, epk, tmp);
VroniSwap(c2, c3, tmp);
VroniSwap(rr2, rr3, tmpr);
VroniSwap(d_c1c2, d_c1c3, tmpr);
Swap(ij_counter, jk_counter, tmpi);
Swap(ij_tangent, jk_tangent, tmpi);
Swap(i, j, tmpi);
Swap(spi, spj, tmp);
Swap(epi, epj, tmp);
Swap(c1, c2, tmp);
Swap(rr1, rr2, tmpr);
Swap(d_c2c3, d_c1c3, tmpr);
VroniSwap(ij_counter, jk_counter, tmpi);
VroniSwap(ij_tangent, jk_tangent, tmpi);
VroniSwap(i, j, tmpi);
VroniSwap(spi, spj, tmp);
VroniSwap(epi, epj, tmp);
VroniSwap(c1, c2, tmp);
VroniSwap(rr1, rr2, tmpr);
VroniSwap(d_c2c3, d_c1c3, tmpr);
}
}
@@ -491,14 +491,14 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e,
/* two arcs on the same circle, but without common endpoint */
/* */
if (ik_tangent) {
Swap(j, k, tmpi);
Swap(c2, c3, tmp);
Swap(rr2, rr3, tmpr);
VroniSwap(j, k, tmpi);
VroniSwap(c2, c3, tmp);
VroniSwap(rr2, rr3, tmpr);
}
else if (jk_tangent) {
Swap(i, k, tmpi);
Swap(c1, c3, tmp);
Swap(rr1, rr3, tmpr);
VroniSwap(i, k, tmpi);
VroniSwap(c1, c3, tmp);
VroniSwap(rr1, rr3, tmpr);
}
//printf("\tspecial case: cocircular disjoint circles: %d-%d-%d\n", i, j ,k);
num_sol = 1;
@@ -572,25 +572,25 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e,
coord tmpc;
double tmpd;
int tmpi;
Swap(c1,c2, tmpc);
Swap(rr1,rr2, tmpd);
Swap(i,j, tmpi);
VroniSwap(c1,c2, tmpc);
VroniSwap(rr1,rr2, tmpd);
VroniSwap(i,j, tmpi);
}
if ( rr1 < rr3 ) {
coord tmpc;
double tmpd;
int tmpi;
Swap(c1,c3, tmpc);
Swap(rr1,rr3, tmpd);
Swap(i,k, tmpi);
VroniSwap(c1,c3, tmpc);
VroniSwap(rr1,rr3, tmpd);
VroniSwap(i,k, tmpi);
}
if ( rr2 < rr3 ) {
coord tmpc;
double tmpd;
int tmpi;
Swap(c2,c3, tmpc);
Swap(rr2,rr3, tmpd);
Swap(j,k, tmpi);
VroniSwap(c2,c3, tmpc);
VroniSwap(rr2,rr3, tmpd);
VroniSwap(j,k, tmpi);
}
num_sol = CircCircCircCenters(c1, c2, c3, rr1, rr2, rr3, centers,
+2 -2
View File
@@ -122,8 +122,8 @@ vr_bool vroniObject::ArcArcPntCntr(int i, int j, int k, int e,
/* make sure that first arc has the larger radius */
/* */
double tmpr;
Swap(rr1, rr2, tmpr);
Swap(i, j, t);
VroniSwap(rr1, rr2, tmpr);
VroniSwap(i, j, t);
}
c1 = GetArcCenter(i);
-46
View File
@@ -1,46 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2007-2023 M. Held, S. Huber */
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber, Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_ARC_COMMON_H
#define VRONI_ARC_COMMON_H
//Uncomment this line to print quality messages
//#define ARC_QUALITY_MSG
/** Test if pnt is in arc-cone. */
inline vr_bool vroniObject::IsPntInArcCone(int arc, coord pnt)
{
return IsPntInArcConeEps(arc, pnt, ZERO);
}
/** Test if pnt is in arc-cone. */
inline vr_bool vroniObject::IsPntInArcConeStrict(int arc, coord pnt)
{
return IsPntInArcConeEps(arc, pnt, -ZERO);
}
#endif
+1 -1
View File
@@ -95,7 +95,7 @@ vr_bool vroniObject::ArcPntPntCntr(int i, int j, int k, int e,
/* */
/* check whether one of the points is an endpoint of arcs[i]. */
/* */
if (IsArcStartPnt(i, k) || IsArcEndPnt(i, k)) Swap(j, k, t);
if (IsArcStartPnt(i, k) || IsArcEndPnt(i, k)) VroniSwap(j, k, t);
c2 = GetPntCoords(j);
c3 = GetPntCoords(k);
if (IsArcStartPnt(i, j) || IsArcEndPnt(i, j)) {
+4 -4
View File
@@ -136,10 +136,10 @@ vr_bool vroniObject::ArcSegSegCntr(int i, int j, int k, int e, coord* cntr,
int tmpi;
double tmpd;
Swap(j, k, tmpi);
Swap(s1a, s2a, tmpd);
Swap(s1b, s2b, tmpd);
Swap(s1c, s2c, tmpd);
VroniSwap(j, k, tmpi);
VroniSwap(s1a, s2a, tmpd);
VroniSwap(s1b, s2b, tmpd);
VroniSwap(s1c, s2c, tmpd);
}
spi = GetArcStartCoord(i);
-117
View File
@@ -1,117 +0,0 @@
/*****************************************************************************/
/* */
/* 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.c". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_BASIC_H
#define VRONI_BASIC_H
#include "consts.h"
#include "util.h"
#include "types.h"
#define BASIC_MINI 1.0e-20
#ifndef RAND
#define RND_MAX 2147483647
#define UniformRandom(x) \
{\
x = ((double) random()) / RND_MAX; }
#define RandomInteger(N) \
(\
assert(N > 0), \
basic_i_local = random(), \
basic_i_local - (basic_i_local / (N)) * (N))
#define InitRandom(seed) \
{\
srandom(seed); }
#else
#ifdef RAND_MAX
#define RND_MAX RAND_MAX
#else
#define RND_MAX 32767
#endif
#define UniformRandom(x) \
{\
x = ((double) rand()) / RND_MAX; \
}
#define RandomInteger(N) \
(\
assert(N > 0), \
basic_i_local = rand(), \
basic_i_local - (basic_i_local / (N)) * (N))
#define InitRandom(seed) \
{\
srand(seed); }
#endif
/*
#define ScaleX(xc) (scale_factor * (xc - shift.x))
#define ScaleY(yc) (scale_factor * (yc - shift.y))
#define ScaleV(value) (value * scale_factor)
#define UnscaleX(xc) (assert(scale_factor > 0.0), xc / scale_factor + shift.x)
#define UnscaleY(yc) (assert(scale_factor > 0.0), yc / scale_factor + shift.y)
#define UnscaleV(value) (assert(scale_factor > 0.0), value / scale_factor)
*/
#define CirBBox(p, r, bb_min, bb_max) {\
(bb_min).x = (p).x - r; \
(bb_min).y = (p).y - r; \
(bb_max).x = (p).x + r; \
(bb_max).y = (p).y + r; }
#define TriBBox(a, b, c, bb_min, bb_max) {\
MinMax3((a).x, (b).x, (c).x, (bb_min).x, (bb_max).x); \
MinMax3((a).y, (b).y, (c).y, (bb_min).y, (bb_max).y); }
#endif
+3
View File
@@ -952,6 +952,9 @@ void vroniObject::ComputeVD(vr_bool save_data, vr_bool new_input,
*finished = true;
initialized = false;
// Funzione ausiliaria per debug
// MyWriteVoronoiRegion(vr_file_handle);
return;
}
-191
View File
@@ -1,191 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2010-2023 M. Held, S. Huber */
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber, Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_CONSTS_H
#define VRONI_CONSTS_H
#ifndef DOUBLE_OVERRIDE
/* */
/* please do not change the following tolerance thresholds */
/* */
#define TINY 1.0e-14 /* about the size of the machine precision */
#define SMALL 0.0078125 /* 0.01 >= SMALL = 1/128 >> ZERO */
#define INVERSE_SMALL 128.0 /* INVERSE_SMALL = 1/SMALL */
/* */
/* the following tolerance thresholds may be changed if you know what you do */
/* */
#define ZERO 1.0e-13 /* small number with ZERO >= TINY */
#define ZERO_MAX 1.0e-5 /* SMALL >> ZERO_MAX >= ZERO */
#define ZERO_IO 1.0e-5 /* SMALL >> ZERO_IO >= ZERO_MAX */
#define DECENT 1.0e-10 /* = ZERO_MAX / 1000 */
#define GRAZE 1.0e-4 /* = ZERO_MAX * 10 */
/* */
/* the following thresholds depend on thresholds defined in previous lines */
/* */
#define THRESHOLD 1.0e-6 /* THRESHOLD = ZERO_MAX / 10.0 */
#define ZERO2 1.0e-26 /* ZERO2 = ZERO * ZERO */
#endif
#define NIL -1
#define APPROX 10
#define MAX_RESTART 50 /* max. number of retries if computation fails */
#ifdef WITH_MPFRBACKEND
extern double SMALL;
extern double INVERSE_SMALL;
extern double ZERO_IO;
extern double ZERO_MAX;
extern double ZERO;
extern double ZERO2;
extern double THRESHOLD;
extern double TINY;
#elif defined(WITH_COREBACKEND)
const double SMALL = 0;
/* INVERSE_SMALL is not used anyway of SMALL == 0, so keep value from
plain value. */
const double INVERSE_SMALL = 128;
const double ZERO_IO = 1.0e-6;
const double ZERO_MAX = 0;
const double ZERO = 0;
const double ZERO2 = 0;
const double THRESHOLD = 0;
const double TINY = 0;
#endif
#ifndef DOUBLE_OVERRIDE
#ifndef M_E
#define M_E 2.71828182845904553488
#endif
#ifndef M_1_E
#define M_1_E 0.36787944117144227851
#endif
#ifndef M_LOG2E
#define M_LOG2E 1.44269504088896360904
#endif
#ifndef M_LOG10E
#define M_LOG10E 0.43429448190325182765
#endif
#ifndef M_LN2
#define M_LN2 0.69314718055994530942
#endif
#ifndef M_LN10
#define M_LN10 2.30258509299404568402
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif
#ifndef M_PI_4
#define M_PI_4 0.78539816339744830962
#endif
#ifndef M_PI_8
#define M_PI_8 0.39269908169872415481
#endif
#ifndef M_1_PI
#define M_1_PI 0.31830988618379067154
#endif
#ifndef M_2_PI
#define M_2_PI 0.63661977236758134308
#endif
#ifndef M_2PI
#define M_2PI 6.28318530717958623199
#endif
#ifndef M_180_PI
#define M_180_PI 57.2957795130823208767
#endif
#ifndef M_PI_180
#define M_PI_180 0.01745329251994329576
#endif
#ifndef M_2_SQRTPI
#define M_2_SQRTPI 1.12837916709551257390
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 0.70710678118654752440
#endif
#ifndef M_SQRT3
#define M_SQRT3 1.73205080756887719317
#endif
#ifndef M_SQRT1_3
#define M_SQRT1_3 0.57735026918962584208
#endif
#ifndef M_1_3
#define M_1_3 0.33333333333333333333
#endif
#elif defined(WITH_MPFRBACKEND)
extern double M_1_3;
extern double M_180_PI;
extern double M_PI_180;
#undef M_SQRT2
extern double M_SQRT2;
#undef M_PI_4
extern double M_PI_4;
#undef M_PI_2
extern double M_PI_2;
#undef M_PI
extern double M_PI;
#undef M_2PI
extern double M_2PI;
#else
//defined(WITH_COREBACKEND)
const double M_1_3 = double(1) / 3;
#undef M_SQRT2
const double M_SQRT2 = sqrt(double(2));
#undef M_PI
const double M_PI = pi();
#undef M_PI_4
const double M_PI_4 = M_PI / 4;
#undef M_PI_2
const double M_PI_2 = M_PI / 2;;
#undef M_2PI
const double M_2PI = M_PI * 2;
const double M_180_PI = 180 / M_PI;
const double M_PI_180 = M_PI * 180;
#endif
#endif
-31
View File
@@ -1,31 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2010-2023 M. Held, S. Huber */
/* */
/* 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.c". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber */
/* Modified: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
/* */
/* get my header files */
/* */
#include "fpkernel.h"
#include "coord.h"
-171
View File
@@ -1,171 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2010-2023 M. Held, S. Huber */
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber */
/* Modified: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_COORD_H
#define VRONI_COORD_H
#ifndef DOUBLE_OVERRIDE
#include <math.h>
#endif
#include "fpkernel.h"
/** Defines a vector in the plane */
struct coord {
double x;
double y;
inline coord(double_arg x, double_arg y) : x(x), y(y) {}
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline coord() {}
};
struct coord3D {
double x;
double y;
double z;
inline coord3D(double_arg x, double_arg y, double_arg z) : x(x), y(y), z(z) {}
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline coord3D() {}
};
/** Computes determinant of 3x3 matrix given by homogeneous coordinates
* of the three column vectors u, v and w. */
inline static double VecDet(coord u, coord v, coord w)
{
return (((u).x - (v).x) * ((v).y - (w).y) + ((v).y - (u).y) * ((v).x - (w).x));
}
/** Computes standard inner-product of vectors u and v */
inline static double VecDotProd(coord u, coord v)
{
return (((u).x * (v).x) + ((u).y * (v).y));
}
/** Adds two vectors */
inline static coord VecAdd(coord p, coord q)
{
coord r;
r.x = p.x + q.x;
r.y = p.y + q.y;
return r;
}
/** Subtracs two vectors */
inline static coord VecSub(coord p, coord q)
{
coord r;
r.x = p.x - q.x;
r.y = p.y - q.y;
return r;
}
/** Multiply vector with scalar */
inline static coord VecMult(double_arg scalar, const coord & u)
{
coord r;
r.x = scalar * u.x;
r.y = scalar * u.y;
return r;
}
/** Divide vector by scalar */
inline static coord VecDiv(double_arg scalar, const coord & u)
{
return VecMult(1.0/scalar, u);
}
/** Get vector -p of p */
inline static coord VecInv(coord p)
{
coord q;
q.x = -p.x;
q.y = -p.y;
return q;
}
/** Squared vector length */
inline static double VecLenSq(coord p)
{
return (p.x*p.x + p.y*p.y);
}
/** Vector length */
inline static double VecLen(coord p)
{
return sqrt(VecLenSq(p));
}
/** Normalize vector */
inline static coord VecNorm(coord p)
{
return VecDiv(VecLen(p), p);
}
/** Get counter clock-wise 90 degree rotation */
inline static coord VecCCW(coord p)
{
coord q;
q.x = -p.y;
q.y = p.x;
return q;
}
/** Get clock-wise 90 degree rotation */
inline static coord VecCW(coord p)
{
coord q;
q.x = p.y;
q.y = -p.x;
return q;
}
/** Make vector by its coordinates */
inline static coord MakeVec(double_arg x, double_arg y)
{
coord p;
p.x = x;
p.y = y;
return p;
}
#endif
-81
View File
@@ -1,81 +0,0 @@
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_CORE_ATAN2_H
#define VRONI_CPRE_ATAN2_H
inline double atan2local(const double &y, const double &x)
{
if( fabs(x) >= fabs(y) )
{
// Sector to the right
if( x > 0 )
{
const double phi = y/x;
return atan(phi);
}
// Sector to the left
else if( x < 0 )
{
const double phi = y/x;
if( y >= 0) {
return atan(phi) + M_PI;
} else {
return atan(phi) - M_PI;
}
}
// Hence, x and y are zero
else
{
return 0.0;
}
}
else if( fabs(y) >= fabs(x) )
{
// Sector to the top
if( y > 0 )
{
const double phi = x/y;
return M_PI_2 - atan(phi);
}
// Sector to the bottom
if( y < 0 )
{
const double phi = x/y;
return - M_PI_2 - atan(phi);
}
// Actually, the impossible case, x=y=0. Should be catched above.
else
{
assert(false);
return 0.0;
}
}
// This can only happen, if x or y is NaN.
else
{
return 0.0;
}
}
#endif
+6 -6
View File
@@ -584,8 +584,8 @@ void vroniObject::HandleSeg(double_arg xc1, double_arg yc1, double_arg xc2, doub
int i1, i2, i3;
#ifdef EXT_APPL_PNTS
i1 = StorePnt(xc1, yc1, eap_NIL);
i2 = StorePnt(xc2, yc2, eap_NIL);
i1 = StorePnt(xc1, yc1, ext_appl);
i2 = StorePnt(xc2, yc2, ext_appl);
#else
i1 = StorePnt(xc1, yc1);
i2 = StorePnt(xc2, yc2);
@@ -618,7 +618,7 @@ void vroniObject::AddSeg(int *i1, double_arg xc2, double_arg yc2)
int i2, i3;
#ifdef EXT_APPL_PNTS
i2 = StorePnt(xc2, yc2, eap_NIL);
i2 = StorePnt(xc2, yc2, {ext_appl.first, ext_appl.second + 1});
#else
i2 = StorePnt(xc2, yc2);
#endif
@@ -650,7 +650,7 @@ void vroniObject::AddArc(int *i1, double_arg xc3, double_arg yc3, double_arg xc2
int i2, i3;
#ifdef EXT_APPL_PNTS
i2 = StorePnt(xc3, yc3, eap_NIL);
i2 = StorePnt(xc3, yc3, {ext_appl.first, ext_appl.second + 1});
#else
i2 = StorePnt(xc3, yc3);
#endif
@@ -685,8 +685,8 @@ void vroniObject::HandleArc(double_arg xc1, double_arg yc1, double_arg xc2, doub
int i1, i2, i3;
#ifdef EXT_APPL_PNTS
i1 = StorePnt(xc1, yc1, eap_NIL);
i2 = StorePnt(xc2, yc2, eap_NIL);
i1 = StorePnt(xc1, yc1, ext_appl);
i2 = StorePnt(xc2, yc2, ext_appl);
#else
i1 = StorePnt(xc1, yc1);
i2 = StorePnt(xc2, yc2);
+12 -12
View File
@@ -689,8 +689,8 @@ void vroniObject::EvaluateDegenerateEdge(int i, double_arg t, coord *w)
}
if (t1 > t2) {
Swap(u, v, p);
Swap(t1, t2, delta);
VroniSwap(u, v, p);
VroniSwap(t1, t2, delta);
}
assert(t1 <= t2);
@@ -977,8 +977,8 @@ void vroniObject::EvaluateDegenerateHyperEll(int i, double t, coord *w)
/* */
p = MidPoint(p1, p2);
if (VecDet(p, u, v) < 0.0) {
Swap(u, v, *w);
Swap(t1, t2, delta);
VroniSwap(u, v, *w);
VroniSwap(t1, t2, delta);
}
angle_s = atan2(u.y - p.y, u.x - p.x);
angle_e = atan2(v.y - p.y, v.x - p.x);
@@ -1048,13 +1048,13 @@ void vroniObject::EvaluateHyperbolaEllipseData(int i, double_arg t, coord *w)
assert((rtype == PNT) || (rtype == ARC));
if (i2 > i1) {
Swap(i1, i2, i3);
Swap(ltype, rtype, itype);
VroniSwap(i1, i2, i3);
VroniSwap(ltype, rtype, itype);
}
else if (i1 == i2) {
if (rtype == PNT) {
Swap(i1, i2, i3);
Swap(ltype, rtype, itype);
VroniSwap(i1, i2, i3);
VroniSwap(ltype, rtype, itype);
}
}
@@ -1128,13 +1128,13 @@ vr_bool vroniObject::ComputeHyperbolaEllipseData(int i, e_formula *coeff)
assert((rtype == PNT) || (rtype == ARC));
if (i2 > i1) {
Swap(i1, i2, i3);
Swap(ltype, rtype, itype);
VroniSwap(i1, i2, i3);
VroniSwap(ltype, rtype, itype);
}
else if (i1 == i2) {
if (rtype == PNT) {
Swap(i1, i2, i3);
Swap(ltype, rtype, itype);
VroniSwap(i1, i2, i3);
VroniSwap(ltype, rtype, itype);
}
}
-70
View File
@@ -1,70 +0,0 @@
/*****************************************************************************/
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-172 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_DEFS_H
#define VRONI_DEFS_H
#define PROG_NAME "V R O N I"
#define PROG_VERSION "7.6"
#define PROG_YEAR "1999-2023"
/* */
/* get the definitions for "exterior applications" */
/* */
#include "ext_appl_defs.h"
/* */
/* colors for OpenGL drawing */
/* */
#define Brown 0
#define Green 1
#define Blue 2
#define White 3
#define Red 4
#define Cyan 5
#define Yellow 6
#define Orange 7
#define Magenta 8
#define Black 9
#define NumColors 10
#define NoColor Black
#define SupColor White
#define PntColor Green
#define SegColor Green
#define ArcColor Cyan
#define CirColor Yellow
#define AlertColor Red
#define CurrColor Blue
#define MICColor Yellow
#define VDColor Red
#define GridColor Brown
#define TreeColor Brown
#define VDCurrColor Magenta
#define DTCurrColor Orange
#define SiteCurrColor Blue
#define DTColor White
#define OffColor White
#define WMATColor Blue
#endif
-46
View File
@@ -1,46 +0,0 @@
/*****************************************************************************/
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
void API_ParseCommandLineArgs(int argc, char *argv[], vr_bool *graphics,
vr_bool *color_graphics, vr_bool *full_screen);
void API_InitializeProgram(void);
void API_GetInputData(vr_bool *input_received);
void API_ProceedWithoutGraphics(vr_bool new_input);
void InitializeGraphics(int argc, char *argv[], vr_bool color_graphics,
vr_bool full_screen);
void ProcessGraphicsEvents(void);
void API_TerminateProgram(void);
void API_HandleError(void);
const char* API_GetProgName();
const char* API_GetProgVersion();
const char* API_GetProgYear();
-1
View File
@@ -1 +0,0 @@
+4 -2
View File
@@ -20,14 +20,16 @@
/* */
/*****************************************************************************/
#include "ext_appl_defs.h"
#ifdef EXT_APPL_PNTS
const eap_type eap_NIL = -1;
const eap_type eap_NIL = {-1, -1};
#else
#define eap_NIL -1
#endif
#ifdef EXT_APPL_SITES
const eas_type eas_NIL = -1;
const eas_type eas_NIL = {- 1, -1};
#else
#define eas_NIL -1
#endif
-187
View File
@@ -1,187 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2002--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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_EXT_APPL_DEFS_H
#define VRONI_EXT_APPL_DEFS_H
/* */
/* the following data types are used for user-defined entities that are to */
/* be stored as part of my data structures. you are welcome to redefine them */
/* according to your needs. however, please note that it is your task to */
/* make sure that the functions and macros for I/O operations are modified */
/* accordingly in io_parse.c !! also, you'd need to redefine the constants */
/* eap_NIL, eas_NIL, ean_NIL, eae_NIL, eam_NIL, and eao_NIL in the file */
/* ext_appl_defs.c to whatever constant integral value or structure that can */
/* be used for initializing the exterior application structures. see the */
/* sample use for eap_... below. */
/* */
typedef int eap_type; /* ext. appl. hook for pnt */
typedef int eas_type; /* ext. appl. hook for seg and arc */
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 */
/*
* sample user-specific eap data:
*
* typedef struct {
* long id;
* char ch[10];
* } eap_type;
*/
extern const eap_type eap_NIL;
extern const eas_type eas_NIL;
extern const ean_type ean_NIL;
extern const eam_type eam_NIL;
extern const eao_type eao_NIL;
extern const eae_type eae_NIL;
#define ExtApplFuncNewInput
#define ExtApplFuncRestart
#define ExtApplFuncFirstPnts
#define ExtApplFuncDonePnts
#define ExtApplFuncFirstSegs
#define ExtApplFuncDoneSegs
#define ExtApplFuncDoneSegs
#define ExtApplFuncDoneArcs
#define ExtApplFuncFirstArcs
#define ExtApplFuncDoneVD
#define ExtApplFuncReset
#define ExtApplFuncIsoOffset
#define ExtApplFuncIsoOffsetDone
#define ExtApplFuncOffsetInit
#define ExtApplFuncOffsetRepeat
#define ExtApplFuncOffLoops
#define ExtApplFuncOffDone
#define ExtApplFuncOffStart
#define ExtApplFuncOffSegment
#define ExtApplFuncOffsetEnd
#define ExtApplFuncWMATInit
#define ExtApplFuncWMATLoop
#define ExtApplFuncWMATComputed
#define ExtApplFuncWMATDone
#define ExtApplFuncMICInit
#define ExtApplFuncMICDone
#define ExtApplFuncMICNotFound
#define ExtApplFuncVD_Warning
#define ExtApplFuncVD_Dbg_Warning
#define ExtApplFuncVD_IO_Warning
#define ExtApplFuncVD_Info
#define ExtApplFuncArgEvalParse
#define ExtApplFuncArgEvalInit
#define ExtApplFuncArgEvalDone
#define ExtApplFuncEvalErrorOption
#define ExtApplFuncEvalErrorExplain
#define ExtApplFuncReadOptCoord
#define ExtApplFuncReadOptNumber
#define ExtApplFuncReadNumber
#define ExtApplFuncReadPntData
#define ExtApplFuncReadSiteData
#define ExtApplFuncReadVectorData
#define ExtApplFuncWritePntData
#define ExtApplIsCorrectSide
#define ExtApplInsertDummyNode
#define ExtApplResetGraphicsData
#define ExtApplInitializeEdgeData
#define ExtApplInitializeProgram
#define ExtApplRemoveSeg
#define ExtApplRemoveArc
#define ExtApplSetStepSize
#define ExtApplSegPntIntersection
#define ExtApplArcPntIntersection
#define ExtApplSegSegIntersection
#define ExtApplSegArcIntersection
#define ExtApplArcArcIntersection
#define ExtApplHandleSeg
#define ExtApplHandleArc
#define ExtApplComputeRestarts
#define ExtApplAddDummyCorners
#define ExtApplScanVDEdges
#define ExtApplFuncVRONI_HandleError
#endif
-151
View File
@@ -1,151 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2003--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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_EXT_APPL_INOUT_H
#define VRONI_EXT_APPL_INOUT_H
#include "types.h"
class vroniObject;
#ifndef VRONI_COORD_H
typedef struct {
double x; /* x-coordinate */
double y; /* y-coordinate */
} coord; /********** point/vector ******************************/
#endif
/* Make sure that double arg is defined, to ensure that external appliations do
not break if they don't include fpkernel.h */
#ifndef double_arg
#define double_arg double
#endif
/*****************************************************************************/
/* */
/* The following data structures and macros may be modified at the user's */
/* discretion. They are only used in API_HandleArrayInput() in */
/* api_functions.c. */
/* */
/*****************************************************************************/
typedef struct {
double x1; /* x-coordinate */
double y1; /* y-coordinate */
#ifdef EXT_APPL_PNTS
eap_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
} in_pnts; /********** point/vector ******************************/
typedef struct {
double x1; /* x-coordinate start */
double y1; /* y-coordinate start */
double x2; /* x-coordinate end */
double y2; /* y-coordinate end */
#ifdef EXT_APPL_SITES
eas_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
} in_segs; /********** point/vector ******************************/
typedef struct {
double x1; /* x-coordinate start */
double y1; /* y-coordinate start */
double x2; /* x-coordinate end */
double y2; /* y-coordinate end */
double x3; /* x-coordinate center */
double y3; /* y-coordinate center */
vr_bool attr; /* orientation; true for CCW arcs, false for CW arcs */
#ifdef EXT_APPL_SITES
eas_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
} in_arcs; /********** point/vector ******************************/
/* api_functions.c */
vroniObject& API_VD();
void API_HandleError(void);
void API_ResetAll(void);
void API_ComputeOutputMIC(vr_bool time, vr_bool left_mic, vr_bool right_mic,
coord *center, double *radius);
#ifdef MAT
void API_ComputeWMAT(vr_bool auto_wmat, double wmat_angle, double wmat_dist,
vr_bool time, vr_bool left_wmat, vr_bool right_wmat);
#endif
#ifdef WRITE_VD
void API_Output_VD(char vd_file[], double vd_apx_dist,
vr_bool left_vd, vr_bool right_vd);
#endif
void API_CheckThresholds(void); /* obsolet; calls API_InitializeProgram() */
void API_InitializeProgram(void);
void API_HandleInput(char input_file[], vr_bool *new_input,
vr_bool read_polygon, vr_bool read_poly,
vr_bool read_sites, vr_bool read_xdr,
vr_bool read_e00, vr_bool read_polylines,
vr_bool read_usgs, vr_bool read_dxf,
vr_bool read_pnts, vr_bool read_graphml);
void API_FileInput(char input_file[], vr_bool *new_input);
void API_ComputeVD(vr_bool save_data, vr_bool new_input, vr_bool time,
int bound, int sample, int approx, char output_file[],
vr_bool discard_dupl_s, vr_bool pnts_only, vr_bool write_vd,
char vd_dt_file[], vr_bool clean_up);
void API_TerminateProgram(void);
void API_ComputeOff(vr_bool time, char off_file[], vr_bool write_off,
vr_bool dxf_format, double t_offset,
double d_offset, vr_bool auto_offset, vr_bool left_offset,
vr_bool right_offset);
void API_ArrayInput(int number_of_points, in_pnts *point_data,
int number_of_segments, in_segs *segment_data,
int number_of_arcs, in_arcs *arc_data,
vr_bool *new_input);
void API_OutputMA(char vdma_file[]);
void API_ResetOffsetData(void);
const char* API_GetProgName();
const char* API_GetProgVersion();
const char* API_GetProgYear();
#endif
-63
View File
@@ -1,63 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2002--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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_EXT_APPL_VRONI_OBJECT_H
#define VRONI_EXT_APPL_VRONI_OBJECT_H
#include "vroni_object.h"
/* */
/* VRONI object derived class declaration */
/* */
class extApplVroniObject : public vroniObject
{
public:
//
// CONSTRUCTOR / DESTRUCTOR
//
extApplVroniObject();
virtual ~extApplVroniObject();
//
// EXTRA FUNCTIONS
//
bool EdgeDataNeedInitializing();
void InitializeAllEdgeData();
bool IsDegenerateEdge(int ie);
protected:
private:
};
#endif
-231
View File
@@ -1,231 +0,0 @@
/*****************************************************************************/
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_FP_KERNEL_H
#define VRONI_FP_KERNEL_H
#ifdef WITH_COREBACKEND
/* Set CORE Level to 4. Otherwise all unsigned long no longer work */
#define CORE_LEVEL 4
#ifdef WITH_CORE_EXPR_WRAPPER
#include<ExprWrapper.h>
#else
#include<CORE/CORE.h>
#endif /* WITH_CORE_EXPR_WRAPPER */
#undef double
#ifdef WITH_COREBACKEND_BIGFLOAT
#define double CORE::BigFloat
#else
/* allow double to be used as Expr */
#define double Expr
#endif
#define double_arg const double &
//This is used to indicate that double gets a different meaning!
#define DOUBLE_OVERRIDE
#include <formattedIO.h>
#define TO_MDOUBLE(x) (x).doubleValue()
inline CORE::BigInt cut_comma(const Expr & x) {
CORE::BigInt v = floor(x);
if(v < 0) {
return v + 1;
} else {
return v;
}
}
#include "coreatan2.h"
inline int intfloor(const Expr & e) {
return floor(e).intValue();
}
inline unsigned int uintceil(const Expr & e) {
return (unsigned)ceil(e).intValue();
}
//REAL_TO_INT behaves like (int)(x)
#define REAL_TO_INT(x) cut_comma(x).intValue()
#define REAL_TO_GLINT(x) cut_comma(x).intValue()
#define REAL_TO_FLOAT(x) (x).floatValue()
#define BIGINT_TO_INT(x) (x).intValue()
#define TO_REAL(x) double(x)
//Definitions for functions undefined in CORE
#define isnan(x) 0
#define atan2(y,x) atan2local((y),(x))
#define signbit(x) ((x) < 0 ? 1 : 0)
#define CORE_EXPR_OPS(name, x) { \
std::map<std::string, unsigned int > m; \
(x).rep()->rekCollectOp(m); \
for(std::map<std::string, unsigned int>::iterator it = m.begin(); it != m.end(); ++it) { \
std::cout << it->second << "\t: " << it->first << std::endl; \
}}
#ifdef WITH_CORE_EXPR_WRAPPER
inline void CORE_EXPR_SEQ(std::string name, const Expr & x) {
std::map<unsigned int, std::string > m;
(x).rep()->rekSequen(m);
for (std::map<unsigned int, std::string>::iterator it = m.begin(); it != m.end(); ++it) {
std::cout << it->second << std::endl;
}
}
inline void CORE_EXPR_DEBUG1(std::string name, const Expr & x) {
std::cout << name << " depth: " << (x).rep()->getDepth() << std::endl;
std::cout << name << " elementCount: " << (x).rep()->getElementCount() << std::endl;
CORE_EXPR_SEQ(name, (x));
std::cout << name << " value: " << (x) << std::endl;
}
#else
inline void CORE_EXPR_SEQ(std::string name, const Expr & x) {}
inline void CORE_EXPR_DEBUG1(std::string name, const Expr & x) {}
#endif
//IO
#define FP_printf formattedIO::fmc_printf
#define FP_fprintf formattedIO::fmc_fprintf
inline const double * FP_PRNTARG(const double & x) { return &x; }
//[sf]scanf methods
#define FP_fscanf formattedIO::cfscanf
#define FP_sscanf formattedIO::csscanf
// The second argument is the SHA1sum of "shift\n". This avoids a
// conflict with a shift function in CORE - VRONI uses some
// variables named shift
#define shift a68fe7dac8c32f30ad04d52fab4aa46be1068d82
#elif defined(WITH_MPFRBACKEND)
#include <mpfr_class.h>
#include <formattedIO.h>
typedef double machine_double;
#undef double
#ifdef WITH_CORE_EXPR_WRAPPER
#include<ExprWrapper.h>
#define double Expr<Mpfr_class>
#else
#define double Mpfr_class
#endif /* WITH_CORE_EXPR_WRAPPER */
#define double_arg const double &
//This is used to indicate that double gets a different meaning!
#define DOUBLE_OVERRIDE
#define TO_MDOUBLE(x) (x).doubleValue()
#define REAL_TO_INT(x) (x).intValue()
#define REAL_TO_GLINT(x) (x).intValue()
#define REAL_TO_FLOAT(x) (x).floatValue()
#define TO_REAL(x) double(x)
inline void CORE_EXPR_DEBUG1(std::string , const double & ) {}
inline long intfloor(const double & e) {
return floor(e).intValue();
}
inline unsigned long uintceil(const double & e) {
return ceil(e).intValue();
}
//Definitions for functions undefined in CORE
#if WITH_CORE_EXPR_WRAPPER
#define is_nan(x) 0
#define sign_bit(x) ((x) < 0 ? 1 : 0)
#endif
//IO
#define FP_printf formattedIO::fmc_printf
#define FP_fprintf formattedIO::fmc_fprintf
inline const double * FP_PRNTARG(const double & x) { return &x; }
//[sf]scanf methods
#define FP_fscanf formattedIO::cfscanf
#define FP_sscanf formattedIO::csscanf
#else
#include <math.h>
#define TO_MDOUBLE(x) (x)
#define REAL_TO_INT(x) (int)(x)
#define REAL_TO_GLINT(x) (GLint)(x)
#define REAL_TO_FLOAT(x) (float)(x)
#define BIGINT_TO_INT(x) (x)
#define TO_REAL(x) (x)
#define machine_double double
#define double_arg double
inline int intfloor(const double e) {
return (int)(floor(e));
}
inline unsigned int uintceil(const double e) {
return (unsigned)ceil(e);
}
#define CORE_EXPR_DEBUG1(x,y)
#define is_nan(x) isnan(x)
#define sign_bit(x) signbit(x)
#ifdef DOUBLE_OVERRIDE
#error "DOUBLE_OVERRIDE should not be defined here!"
#endif
//IO
#define FP_printf printf
#define FP_fprintf fprintf
#define FP_PRNTARG(x) (x)
//[sf]scanf methods
#define FP_fscanf fscanf
#define FP_sscanf sscanf
#endif /* LIB_CORE */
#endif /* VRONI_FP_KERNEL_H */
-129
View File
@@ -1,129 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2010-2023 M. Held, S. Huber */
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber, Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_GEOM_H
#define VRONI_GEOM_H
#include "util.h"
/** Compute squared distance between two points */
inline double vroniObject::PntPntDistSq(coord pi, coord pj)
{
const double x = pi.x - pj.x;
const double y = pi.y - pj.y;
return x*x + y*y;
}
/** Compute distance between two points */
inline double vroniObject::PntPntDist(coord pi, coord pj)
{
const double x = pi.x - pj.x;
const double y = pi.y - pj.y;
return sqrt(x*x + y*y);
}
/** Compute mid point on the line (pi,pj) */
inline coord vroniObject::MidPoint(coord pi, coord pj)
{
coord q;
q.x = (pi.x + pj.x) / 2.0;
q.y = (pi.y + pj.y) / 2.0;
return q;
}
/** Compute centroid point of the triangle (pi,pj,pk) */
inline coord vroniObject::Centroid(coord pi, coord pj, coord pk)
{
coord q;
q.x = (pi.x + pj.x + pk.x)/3.0;
q.y = (pi.y + pj.y + pk.y)/3.0;
return q;
}
/** Build linar combination of vectors p and r by parameter t */
inline coord vroniObject::LinearComb(const coord & p, const coord & r,
double_arg t)
{
coord q;
q.x = p.x + t*(r.x-p.x);
q.y = p.y + t*(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)
{
coord q;
q.x = p.x + t*v.x;
q.y = p.y + t*v.y;
return q;
}
/** Compute (signed) distance of point p to circle (c,r). Positive
* values indicate that p is outside the circle (c,r). */
inline double vroniObject::PntCircleDist(const coord & c, double_arg r,
const coord & p)
{
return PntPntDist(p, c) - r;
}
/** Compute absolute distance of point p tor circle (c,r) */
inline double vroniObject::AbsPntCircleDist(const coord & c, double_arg r,
const coord & p)
{
return Abs(PntCircleDist(c, r, p));
}
/** Test if point p is on circle (c,r) */
inline int vroniObject::IsPntOnCircle(const coord & c, double_arg r, const coord & p)
{
return eq(PntCircleDist(c,r,p), ZERO);
}
/** Compute the signed distance of the point p to the line given by
* the equation a*x + b*y + c = 0. A positive result means that
* p lies in the positive half-plane defined by the line. */
inline double vroniObject::PntLineDist(double_arg a, double_arg b, double_arg c, const coord & p)
{
return a*p.x + b*p.y + c;
}
/** Compute the absolute distance of the point p to the line given by
* the equation a*x + b*y + c = 0 */
inline double vroniObject::AbsPntLineDist(double_arg a, double_arg b, double_arg c, const coord & p)
{
return Abs( PntLineDist(a, b, c, p));
}
inline vr_bool vroniObject::IsBetweenVoronoiNodes(int e, const coord & p, double eps)
{
return (NodeEdgeClassificator(e, p, eps) == 0.0);
}
#endif
-1476
View File
File diff suppressed because it is too large Load Diff
-27
View File
@@ -1,27 +0,0 @@
/*****************************************************************************/
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-172 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_HEADER_H
#define VRONI_HEADER_H
#endif
-4
View File
@@ -31,10 +31,6 @@
#include "vroni_object.h"
#define HEAP_BLOCK_SIZE 32768
void vroniObject::StoreHeapData(int idx, double s_key, int s_ref)
{
assert(InHeapInsert(idx));
+9 -9
View File
@@ -761,7 +761,7 @@ vr_bool vroniObject::CheckPntPnt(int i1, int i2, double_arg eps)
if (i1 == i2) return false;
if (i2 < i1) Swap(i1, i2, i3);
if (i2 < i1) VroniSwap(i1, i2, i3);
p1 = GetPntCoords(i1);
p2 = GetPntCoords(i2);
@@ -853,7 +853,7 @@ vr_bool vroniObject::GetSegSegIntersection(int i1, int i2, coord* result,
if (i1 == i2) return false;
*ident_segs = false;
if (i2 < i1) Swap(i1, i2, i3);
if (i2 < i1) VroniSwap(i1, i2, i3);
/* */
/* compute the sidedness of the end points u,v of seg 2 w.r.t. the */
@@ -970,8 +970,8 @@ int vroniObject::GetArcArcIntersection(int i1, int i2,
assert(gt(R2, eps));
if ((R1 < R2) || ((R1 == R2) && (i2 < i1))) {
Swap(R1, R2, d);
Swap(i1, i2, tmp);
VroniSwap(R1, R2, d);
VroniSwap(i1, i2, tmp);
}
/* */
@@ -1640,7 +1640,7 @@ vr_bool vroniObject::ComputeAllIntersections(double_arg eps)
if (GetSegSegIntersection(seg1->num, seg2->num, &res1, eps,
&ident)) {
if (AddSegIntersection(seg1, res1) |
if (AddSegIntersection(seg1, res1) ||
AddSegIntersection(seg2, res1))
intersections++;
}
@@ -1658,12 +1658,12 @@ vr_bool vroniObject::ComputeAllIntersections(double_arg eps)
if ((cnt = GetSegArcIntersection(seg1->num, arc1->num,
&res1, &res2, eps)) > 0) {
if (AddSegIntersection(seg1, res1) |
if (AddSegIntersection(seg1, res1) ||
AddArcIntersection(arc1, res1))
intersections++;
if (cnt > 1) {
assert(cnt == 2);
if (AddSegIntersection(seg1, res2) |
if (AddSegIntersection(seg1, res2) ||
AddArcIntersection(arc1, res2))
intersections++;
}
@@ -1684,13 +1684,13 @@ vr_bool vroniObject::ComputeAllIntersections(double_arg eps)
if ((cnt = GetArcArcIntersection(arc1->num, arc2->num, &res1,
&res2, eps, &ident)) > 0){
if (AddArcIntersection(arc1, res1) |
if (AddArcIntersection(arc1, res1) ||
AddArcIntersection(arc2, res1))
intersections++;
if (cnt > 1) {
assert(cnt == 2);
if (AddArcIntersection(arc1, res2) |
if (AddArcIntersection(arc1, res2) ||
AddArcIntersection(arc2, res2))
intersections++;
}
-88
View File
@@ -1,88 +0,0 @@
/*****************************************************************************/
/* */
/* 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.c". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* Universitaet Salzburg */
/* FB Informatik */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_INTERSECTIONS_H
#define VRONI_INTERSECTIONS_H
#include <string.h>
//#ifdef VRONI_INFO
#ifdef VRONI_DBG_WARN
#define IntWarning(S1, I1, S2, I2) \
{\
if (verbose) { \
printf("\nwarning in ComputeVD() - the %s %d and the %s %d intersect!\n",\
S1, I1, S2, I2); \
if (strcmp(S1, "pnt") == 0) { \
printf("pnt %d: (%20.16f,%20.16f)\n", I1, \
UnscaleX(pnts[I1].p.x), \
UnscaleY(pnts[I1].p.y)); \
} \
else if (strcmp(S1, "seg") == 0) { \
printf("seg %d: (%20.16f,%20.16f) to (%20.16f,%20.16f)\n", I1, \
UnscaleX(pnts[segs[I1].i1].p.x), \
UnscaleY(pnts[segs[I1].i1].p.y), \
UnscaleX(pnts[segs[I1].i2].p.x), \
UnscaleY(pnts[segs[I1].i2].p.y)); \
} \
else if (strcmp(S1, "arc") == 0) { \
printf("arc %d: (%20.16f,%20.16f) to (%20.16f,%20.16f) centered at (%20.16f,%20.16f)\n", I1, \
UnscaleX(pnts[arcs[I1].i1].p.x), \
UnscaleY(pnts[arcs[I1].i1].p.y), \
UnscaleX(pnts[arcs[I1].i2].p.x), \
UnscaleY(pnts[arcs[I1].i2].p.y), \
UnscaleX(arcs[I1].c.x), \
UnscaleY(arcs[I1].c.y)); \
} \
if (strcmp(S2, "pnt") == 0) { \
printf("pnt %d: (%20.16f,%20.16f)\n", I2, \
UnscaleX(pnts[I2].p.x), \
UnscaleY(pnts[I2].p.y)); \
} \
else if (strcmp(S2, "seg") == 0) { \
printf("seg %d: (%20.16f,%20.16f) to (%20.16f,%20.16f)\n", I2, \
UnscaleX(pnts[segs[I2].i1].p.x), \
UnscaleY(pnts[segs[I2].i1].p.y), \
UnscaleX(pnts[segs[I2].i2].p.x), \
UnscaleY(pnts[segs[I2].i2].p.y)); \
} \
else if (strcmp(S2, "arc") == 0) { \
printf("arc %d: (%20.16f,%20.16f) to (%20.16f,%20.16f) centered at (%20.16f,%20.16f)\n", I2, \
UnscaleX(pnts[arcs[I2].i1].p.x), \
UnscaleY(pnts[arcs[I2].i1].p.y), \
UnscaleX(pnts[arcs[I2].i2].p.x), \
UnscaleY(pnts[arcs[I2].i2].p.y), \
UnscaleX(arcs[I2].c.x), \
UnscaleY(arcs[I2].c.y)); \
} \
} \
}
#else
#define IntWarning(S1, I1, S2, I2) {}
#endif
#endif
-40
View File
@@ -1,40 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2003--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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_IO_DXF_H
#define VRONI_IO_DXF_H
/* */
/* I'm not sure whether those are indeed the colors used in DXF files. */
/* Unfortunately, I do not seem to be able to get my hands on a decent */
/* specification of DXF... */
/* */
#define DXF_NO_COLOR -1
#define DXF_RED 1
#define DXF_YELLOW 2
#define DXF_GREEN 2
#define DXF_CYAN 4
#define DXF_BLUE 5
#define DXF_MAGENTA 6
#define DXF_WHITE 7
#endif
+5 -4
View File
@@ -100,10 +100,11 @@ vr_bool vroniObject::ReadPntData(FILE *input, double *xc, double *yc, eap_type *
ExtApplFuncReadPntData;
if (EOF == FP_fscanf(input, "%lf %lf %d", xc, yc, eap_data))
if (EOF == FP_fscanf(input, "%lf %lf", xc, yc))
return false;
else
return true;
return true;
}
#else
vr_bool vroniObject::ReadPntData(FILE *input, double *xc, double *yc)
@@ -123,7 +124,7 @@ vr_bool vroniObject::ReadSiteData(FILE *input, double *xc, double *yc, eas_type
{
ExtApplFuncReadSiteData;
if (EOF == FP_fscanf(input, "%lf %lf %d", xc, yc, eas_data))
if (EOF == FP_fscanf(input, "%lf %lf %d %d", xc, yc, &( eas_data->first), &( eas_data->second)))
return false;
else
return true;
@@ -157,7 +158,7 @@ void vroniObject::WritePntData(FILE *output, double_arg xc, double_arg yc, eap_t
{
ExtApplFuncWritePntData;
FP_fprintf(output, "%f %f %d\n", FP_PRNTARG(xc), FP_PRNTARG(yc), *eap_data);
FP_fprintf(output, "%f %f \n", FP_PRNTARG(xc), FP_PRNTARG(yc));
/*
* sample line for user-specific eap data
*
-104
View File
@@ -1,104 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 1996-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". */
/* */
/*****************************************************************************/
/* */
/* Purpose: This is an interface to Ipe. */
/* */
/* Acknowledgements: based on fragments written by Ch. Spielberger. */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-172 */
/* Voice Mail: (+43 662) 6044-6304 */
/* Snail Mail: Martin Held */
/* Universitaet Salzburg */
/* FB Informatik */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef IPE7_IO_H
#define IPE7_IO_H
#include "types.h"
#define XMIN 0.0
#define XMAX 452.0
#define YMIN 0.0
#define YMAX 568.0
#define LAYER0 "boundary"
#define LAYER1 "voronoi"
#define LAYER2 "MAT"
#define LAYER3 "delaunay"
#define LAYER4 "offset"
#define LAYER5 "MIC"
#define LAYER6 "bd_vertices"
#define LAYER7 "vd_nodes"
#define COLOR0 "seagreen"
#define COLOR1 "red"
#define COLOR2 "black"
#define COLOR3 "blue"
#define COLOR4 "lightgray"
#define COLOR5 "yellow"
#define COLOR6 "black"
#define COLOR7 "violet"
#define PEN0 "ultrafat"
#define PEN1 "normal"
#define PEN2 "fat"
#define PEN3 "normal"
#define PEN4 "normal"
#define PEN5 "normal"
#define PEN6 "normal"
#define PEN7 "normal"
FILE *InitIpeFile(char *filename);
FILE *InitIpe(char *filename, double_arg xl, double_arg xr, double_arg yl, double_arg yr);
void CloseIpeFile(FILE *ipe_file);
void WriteBeginPath(FILE *ipe_file, double x1, double y1);
void WriteBeginGroup(FILE *ipe_file, short int layer);
void WriteEndGroup(FILE *ipe_file);
void WriteArcCCW(FILE *ipe_file, double_arg xc, double_arg yc, double_arg r,
double_arg alpha, double_arg beta);
void WriteArcCW(FILE *ipe_file, double_arg xc, double_arg yc, double_arg r,
double_arg alpha, double_arg beta);
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 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);
double scaleX(double x);
double scaleY(double y);
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);
#endif
+11 -11
View File
@@ -234,8 +234,8 @@ void vroniObject::AddParabolaToBuffer(int i, double t1, double t2,
else r = GetArcRadius(i2);
if (t1 > t2) {
Swap(t1, t2, t);
Swap(u, v, w);
VroniSwap(t1, t2, t);
VroniSwap(u, v, w);
}
t = PntPntDist(u, v) / misc_step_size;
@@ -319,13 +319,13 @@ void vroniObject::AddHyperbolaEllipseToBuffer(int i, double t1, double t2,
assert((rtype == PNT) || (rtype == ARC));
if (i2 > i1) {
Swap(i1, i2, i3);
Swap(ltype, rtype, itype);
VroniSwap(i1, i2, i3);
VroniSwap(ltype, rtype, itype);
}
else if (i1 == i2) {
if (rtype == PNT) {
Swap(i1, i2, i3);
Swap(ltype, rtype, itype);
VroniSwap(i1, i2, i3);
VroniSwap(ltype, rtype, itype);
}
}
@@ -380,8 +380,8 @@ void vroniObject::AddHyperbolaEllipseToBuffer(int i, double t1, double t2,
/* */
p = MidPoint(p1, p2);
if (VecDet(p, u, v) < 0.0) {
Swap(u, v, w);
Swap(t1, t2, t);
VroniSwap(u, v, w);
VroniSwap(t1, t2, t);
}
angle_s = atan2(u.y - p.y, u.x - p.x);
angle_e = atan2(v.y - p.y, v.x - p.x);
@@ -443,8 +443,8 @@ void vroniObject::AddHyperbolaEllipseToBuffer(int i, double t1, double t2,
else sign = -1.0;
if (t1 > t2) {
Swap(t1, t2, t);
Swap(u, v, w);
VroniSwap(t1, t2, t);
VroniSwap(u, v, w);
}
t = PntPntDist(u, v) / misc_step_size;
@@ -1029,7 +1029,7 @@ double vroniObject::NodeRadiiClassificator(int e, coord p)
n2 = GetEndNode(e);
radius1 = GetNodeParam(n1);
radius2 = GetNodeParam(n2);
if (radius2 < radius1) Swap(radius1, radius2, dist);
if (radius2 < radius1) VroniSwap(radius1, radius2, dist);
GetLftSiteData(e, &i, &t);
if (t != PNT) GetRgtSiteData(e, &i, &t);
+2 -2
View File
@@ -927,7 +927,7 @@ double vroniObject::PntSiteConeClassificator(int i, t_site ti, coord q1,
more_than_pi = true;
}
else {
Swap(q1, q2, p1);
VroniSwap(q1, q2, p1);
swapped = true;
}
}
@@ -970,7 +970,7 @@ double vroniObject::PntSiteConeClassificator(int i, t_site ti, coord q1,
v = VecSub(q2, p1);
d2 = VecDotProd(c, v);
if (d2 < d1) {
Swap(d1, d2, d);
VroniSwap(d1, d2, d);
swapped = true;
}
d = d2 - d1;
-208
View File
@@ -1,208 +0,0 @@
/*****************************************************************************/
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_NUMERICS_H
#define VRONI_NUMERICS_H
#define Det2D(u, v, w) \
(((u).x - (v).x) * ((v).y - (w).y) + ((v).y - (u).y) * ((v).x - (w).x))
/* */
/* this macro solves the equation p + s * q = u + t * v */
/* for the parameter s, with p and u being points and q and v */
/* being direction vectors of the lines through p and u. */
/* if the equation cannot be solved (since the two lines are parallel) then */
/* exists = 0; if the solution is not unique then exists = 2; and */
/* exists = 1, otherwise. also, w := p + xy[0] * q. */
/* */
/* A[2][2], B[2], xy[2], I0, I1, J0, J1 are used internally within this */
/* macro. */
/* */
#define LineLineIntersection(A, B, xy, I0, J0, I1, J1, p, q, u, v, w, exists) \
{\
A[0][0] = (q).x; \
A[1][0] = (q).y; \
A[0][1] = - (v).x; \
A[1][1] = - (v).y; \
B[0] = (u).x - (p).x; \
B[1] = (u).y - (p).y; \
LinearEqnSolver_2x2(A, B, xy, exists, I0, J0, I1, J1); \
if (exists == 1) { \
(w).x = (p).x + xy[0] * (q).x; \
(w).y = (p).y + xy[0] * (q).y; \
}\
}
/* */
/* P ... query point */
/* U ... start point of segment */
/* A, B, C ... normalized line coefficients, where (B,-A) is the unit */
/* direction vector of the line segment */
/* L ... length of the line segment */
/* */
#define IsInSegConeStrict(U, P, A, B, L) \
(numerics_h_local = ((P).x - (U).x) * (B) - ((P).y - (U).y) * (A), \
((numerics_h_local < (L)) ? ((numerics_h_local <= 0.0) ? -1 : 0) : 1))
#define IsInSegCone(U, P, A, B, L) \
(numerics_h_local = ((P).x - (U).x) * (B) - ((P).y - (U).y) * (A), \
((numerics_h_local <= ((L) + ZERO)) ? ((numerics_h_local < -ZERO) ? -1 : 0) : 1))
#define IsInSegConeZero(U, P, A, B, L, eps) \
(numerics_h_local = ((P).x - (U).x) * (B) - ((P).y - (U).y) * (A), \
((numerics_h_local <= ((L) + (eps))) ? ((numerics_h_local < -(eps)) ? -1 : 0) : 1))
#define PntSegDist(U, P, A, B, C, L, eps) \
((IsInSegConeZero(U, P, A, B, L, eps) == 0) ? \
(PntLineDist(A, B, C, P)) : LARGE)
#define AbsPntSegDist(U, P, A, B, C, L, eps) \
((IsInSegConeZero(U, P, A, B, L, eps) == 0) ? \
(AbsPntLineDist(A, B, C, P)) : LARGE)
#define xParabola(A, a, b, sign, dist, t, k1, k2, r, x) \
{ \
numerics_h_det = r * r + 2.0 * t * (r * k1 - dist * k2) - dist * dist; \
if (numerics_h_det <= 0.0) { \
(x) = A - a * t * k2; \
} \
else { \
(x) = A - a * t * k2 + sign * b * sqrt(numerics_h_det); \
} \
}
#define yParabola(B, a, b, sign, dist, t, k1, k2, r, y) \
{ \
numerics_h_det = r * r + 2.0 * t * (r * k1 - dist * k2) - dist * dist; \
if (numerics_h_det <= 0.0) { \
(y) = B - b * t * k2; \
} \
else { \
(y) = B - b * t * k2 - sign * a * sqrt(numerics_h_det); \
} \
}
#define xHyperEll(A, C, sign, dist, dy, t, k1, k2, r1, r2, r1t, r2t, ht, x) \
{ \
r1t = r1 + k1 * t; \
r2t = r2 + k2 * t; \
ht = (r2t * r2t - r1t * r1t - dist * dist) / (2.0 * dist); \
numerics_h_det = r1t * r1t - ht * ht; \
if (numerics_h_det <= 0.0) { \
(x) = A - C * t; \
} \
else { \
(x) = A - C * t + sign * dy * sqrt(numerics_h_det); \
} \
}
#define yHyperEll(B, D, sign, dist, dx, t, k1, k2, r1, r2, r1t, r2t, ht, y) \
{ \
r1t = r1 + k1 * t; \
r2t = r2 + k2 * t; \
ht = (r2t * r2t - r1t * r1t - dist * dist) / (2.0 * dist); \
numerics_h_det = r1t * r1t - ht * ht; \
if (numerics_h_det <= 0.0) { \
(y) = B - D * t; \
} \
else { \
(y) = B - D * t - sign * dx * sqrt(numerics_h_det); \
} \
}
/* */
/* A, B, C ... normalized coefficients of the equation of the arc's chord */
/* such that the arc's center is to the left of the chord */
/* P ... query point */
/* */
/* note: we assume that the arc is oriented CCW, and that a point-on-circle */
/* test has been performed! */
/* */
#define IsOnArc(A, B, C, P) \
(PntLineDist(A, B, C, P) <= ZERO)
#define IsOnArcStrict(A, B, C, P) \
(PntLineDist(A, B, C, P) < 0.0)
#define IsOnArcZero(A, B, C, P, eps) \
(PntLineDist(A, B, C, P) <= (eps))
/* */
/* VS ... unit outwards normal vector of arc at start point */
/* VE ... unit outwards normal vector of arc at end point */
/* CP ... vector from arc's center to query point */
/* */
/* note: (1) we assume that the arc is oriented CCW, and */
/* that it spans less than 180 degrees! */
/* (2) if a point is inside a circle then its distance to the circle */
/* is negative. */
/* */
#define IsInArcCone(VS, VE, CP) \
((((VS).x * (CP).y - (VS).y * (CP).x) >= -ZERO) ? \
((((VE).y * (CP).x - (VE).x * (CP).y) >= -ZERO) ? 0 : -1) : 1)
#define IsInArcConeZero(VS, VE, CP, eps) \
((((VS).x * (CP).y - (VS).y * (CP).x) >= -(eps)) ? \
((((VE).y * (CP).x - (VE).x * (CP).y) >= -(eps)) ? 0 : -1) : 1)
#define IsInArcConeStrict(VS, VE, CP) \
((((VS).x * (CP).y - (VS).y * (CP).x) > 0.0) ? \
((((VE).y * (CP).x - (VE).x * (CP).y) > 0.0) ? 0 : -1) : 1)
#define PntArcDist(VS, VE, CP, R, eps) \
((((VS).x * (CP).y - (VS).y * (CP).x) >= -(eps)) ? \
((((VE).y * (CP).x - (VE).x * (CP).y) >= -(eps)) ? (VecLen(CP) - R) \
: LARGE) : LARGE)
#define AbsPntArcDist(VS, VE, CP, R, Z) \
((((VS).x * (CP).y - (VS).y * (CP).x) >= -(Z)) ? \
((((VE).y * (CP).x - (VE).x * (CP).y) >= -(Z)) ? \
(numerics_h_local = VecLen(CP) - R, \
((numerics_h_local < 0.0) ? -numerics_h_local : numerics_h_local)) : \
LARGE) : LARGE)
#endif
-116
View File
@@ -66,122 +66,6 @@
#include "io_dxf.h"
#define BLOCK_SIZE 32768
#define HALF_BLOCK_SIZE 1024
#define NewOffsetCurve \
{ \
cur_offset_list = num_offset_list; \
if (cur_offset_list >= max_num_offset_list) { \
max_num_offset_list += 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 += 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 += 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)
void vroniObject::SetMaxOffset(double_arg t)
{
max_t_offset = t;
-101
View File
@@ -1,101 +0,0 @@
/*****************************************************************************/
/* */
/* 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
/* */
/* 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; \
} \
} \
}
#endif
-69
View File
@@ -1,69 +0,0 @@
/*****************************************************************************/
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_RANDOM_H
#define VRONI_RANDOM_H
#ifndef RAND
#define RND_MAX 2147483647
#define UniformRandom(x) \
{\
x = ((double) random()) / RND_MAX; }
#define RandomInteger(N) \
(\
assert(N > 0), \
random() % N)
#define InitRandom(seed) \
{\
srandom(seed); }
#else
#ifdef RAND_MAX
#define RND_MAX RAND_MAX
#else
#define RND_MAX 32767
#endif
#define UniformRandom(x) \
{\
x = ((double) rand()) / RND_MAX; \
}
#define RandomInteger(N) \
(\
assert(N > 0), \
rand() % N)
#define InitRandom(seed) \
{\
srand(seed); }
#endif
#endif
-273
View File
@@ -1,273 +0,0 @@
/*****************************************************************************/
/* */
/* 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_ROOTS_H
#define VRONI_ROOTS_H
int Roots3(double lead, double a, double b, double c, double roots[]);
int Roots4(double lead, double a, double b, double c, double d,
double roots[]);
#define ROOTS_ZERO 1.0e-50
#define ROOTS_ZERO2 1.0e-100
//#define ROOTS_ZERO 1.0e-14
//#define ROOTS_ZERO2 1.0e-28
#define DISCR_ZERO 1.0e-8
#define ROOT_SMALL 0.125 /* ROOT_SMALL = 1/8 >> ZERO */
#define ROOT_INV_SMALL 8.0 /* ROOT_INV_SMALL = 1/ROOT_SMALL */
/* */
/* This macro solves the following second-degree polynomial equation: */
/* */
/* a * x^2 + b * x + c = 0. */
/* */
/* The roots are stored in roots[0] and roots[1]. Note that only real */
/* roots are sought. The number of real roots found is stored in num_roots. */
/* */
#define Roots2abc(a, b, c, roots, num_roots) \
{ \
while (eq(a, ROOT_SMALL) && eq(b, ROOT_SMALL) && eq(c, ROOT_SMALL) && ((a != 0.0) || (b != 0.0) || (c != 0.0))) { \
a *= 2.0; \
b *= 2.0; \
c *= 2.0; \
} \
while ((Abs(a) > ROOT_INV_SMALL) && (Abs(b) > ROOT_INV_SMALL) && (Abs(c) > ROOT_INV_SMALL)) { \
a /= 2.0; \
b /= 2.0; \
c /= 2.0; \
} \
if (eq(a, ROOTS_ZERO)) { \
if (eq(b, ROOTS_ZERO)) { \
if (eq(c, ROOTS_ZERO)) { \
num_roots = -1; \
} \
else { \
num_roots = 0; \
} \
} \
else { \
roots[0] = - c / b; \
num_roots = 1; \
} \
} \
else { \
basic_h_local_delta = b * b - 4 * a * c; \
if (basic_h_local_delta > 0.0) { \
if (b > 0) { \
basic_h_local = - 0.5 * (b + sqrt(basic_h_local_delta)); \
} \
else { \
basic_h_local = - 0.5 * (b - sqrt(basic_h_local_delta)); \
} \
if (eq(basic_h_local, ROOTS_ZERO)) { \
roots[0] = basic_h_local / a; \
num_roots = 1; \
} \
else { \
roots[0] = basic_h_local / a; \
roots[1] = c / basic_h_local; \
num_roots = 2; \
} \
} \
else if (eq(basic_h_local_delta, DISCR_ZERO)) { \
roots[0] = - b / (2.0 * a); \
num_roots = 1; \
} \
else { \
num_roots = 0; \
} \
} \
}
/* */
/* This macro solves the following second-degree polynomial equation: */
/* */
/* x^2 + p * x + q = 0. */
/* */
/* The roots are stored in roots[0] and roots[1]. Note that only real */
/* roots are sought. The number of real roots found is stored in num_roots. */
/* */
#define Roots2pq(p, q, roots, num_roots) \
{ \
basic_h_local_delta = p * p - 4 * q; \
if (basic_h_local_delta > 0.0) { \
if (p > 0) { \
basic_h_local = - 0.5 * (p + sqrt(basic_h_local_delta)); \
} \
else { \
basic_h_local = - 0.5 * (p - sqrt(basic_h_local_delta)); \
} \
if (eq(basic_h_local, ROOTS_ZERO)) { \
roots[0] = basic_h_local; \
num_roots = 1; \
} \
else { \
roots[0] = basic_h_local; \
roots[1] = q / basic_h_local; \
num_roots = 2; \
} \
} \
else if (eq(basic_h_local_delta, ROOTS_ZERO2)) { \
roots[0] = - 0.5 * p; \
num_roots = 1; \
} \
else { \
num_roots = 0; \
} \
}
/* */
/* This macro solves the following 2x2 linear system: */
/* */
/* A[0][0] * x + A[0][1] * y = B[0] */
/* A[1][1] * x + A[1][1] * y = B[1] */
/* */
/* If a unique solution exists, then exists := 1, and the solution is stored */
/* in xy[2]. If the solution is not unique, then exists := 2, and a solution */
/* is stored in xy[2]. Otherwise, exists := 0. */
/* */
/* i, j, I, J are dummy integers needed within the macro. */
/* */
#define LinearEqnSolver_2x2(A, B, xy, exists, i, j, I, J) \
{ \
/* */ \
/* find a column with a non-zero element */ \
/* */ \
exists = 0; \
if (!eq((A)[0][0], ROOTS_ZERO) || !eq((A)[1][0], ROOTS_ZERO)) { \
I = 0; \
J = 1; \
} \
else if (!eq((A)[0][1], ROOTS_ZERO) || !eq((A)[1][1], ROOTS_ZERO)) { \
I = 1; \
J = 0; \
} \
else { \
if (eq((B)[0], ROOTS_ZERO) && eq((B)[1], ROOTS_ZERO)) { \
(xy)[0] = (xy)[1] = 0.0; \
(exists) = 2; \
} \
I = J = 0; \
} \
\
/* */ \
/* determine i s.t. Abs(A[i][I]) is maximum. */ \
/* */ \
if ((I > 0) || (J > 0)) { \
if (Abs((A)[0][I]) > Abs((A)[1][I])) { \
i = 0; \
j = 1; \
} \
else { \
i = 1; \
j = 0; \
} \
\
basic_h_local_quot = (A)[j][I] / (A)[i][I]; \
basic_h_local_delta = (A)[j][J] - basic_h_local_quot * (A)[i][J]; \
if (!eq(basic_h_local_delta, ROOTS_ZERO)) { \
(xy)[J] = ((B)[j] - basic_h_local_quot * (B)[i]) / basic_h_local_delta; \
(xy)[I] = ((B)[i] - (xy)[J] * (A)[i][J]) / (A)[i][I]; \
(exists) = 1; \
} \
else { \
basic_h_local_delta = (B)[j] - basic_h_local_quot * (B)[i]; \
if (eq(basic_h_local_delta, ROOTS_ZERO)) { \
(xy)[J] = 0.0; \
(xy)[I] = (B)[i] / (A)[i][I]; \
(exists) = 2; \
} \
else { \
(exists) = 0; \
} \
} \
} \
}
/* */
/* This macro solves the following 2x2 linear system: */
/* */
/* A[0][0] * x + A[0][1] * y = B[0] */
/* A[1][1] * x + A[1][1] * y = B[1] */
/* */
/* If a unique solution exists, then exists := 1, and the solution is stored */
/* in xy[2]. If the solution is not unique, then exists := 2, and a solution */
/* is stored in xy[2]. Otherwise, exists := 0. */
/* */
/* i, j, I, J are dummy integers needed within the macro. */
/* */
#define LinearEqnSolver_2x2_Zero(A, B, xy, exists, i, j, I, J) \
{ \
/* */ \
/* find a column with a non-zero element */ \
/* */ \
exists = 0; \
if (!eq((A)[0][0], ROOTS_ZERO) || !eq((A)[1][0], ROOTS_ZERO)) { \
I = 0; \
J = 1; \
} \
else if (!eq((A)[0][1], ROOTS_ZERO) || !eq((A)[1][1], ROOTS_ZERO)) { \
I = 1; \
J = 0; \
} \
else { \
if (eq((B)[0], ROOTS_ZERO) && eq((B)[1], ROOTS_ZERO)) { \
(xy)[0] = (xy)[1] = 0.0; \
(exists) = 2; \
} \
I = J = 0; \
} \
\
/* */ \
/* determine i s.t. Abs(A[i][I]) is maximum. */ \
/* */ \
if ((I > 0) || (J > 0)) { \
if (Abs((A)[0][I]) > Abs((A)[1][I])) { \
i = 0; \
j = 1; \
} \
else { \
i = 1; \
j = 0; \
} \
\
basic_h_local_quot = (A)[j][I] / (A)[i][I]; \
basic_h_local_delta = (A)[j][J] - basic_h_local_quot * (A)[i][J]; \
if (!eq(basic_h_local_delta, ROOTS_ZERO)) { \
(xy)[J] = ((B)[j] - basic_h_local_quot * (B)[i]) / basic_h_local_delta; \
(xy)[I] = ((B)[i] - (xy)[J] * (A)[i][J]) / (A)[i][I]; \
(exists) = 1; \
} \
else { \
basic_h_local_delta = (B)[j] - basic_h_local_quot * (B)[i]; \
if (eq(basic_h_local_delta, ROOTS_ZERO)) { \
(xy)[J] = 0.0; \
(xy)[I] = (B)[i] / (A)[i][I]; \
(exists) = 2; \
} \
else { \
(exists) = 0; \
} \
} \
} \
}
#endif
+1 -1
View File
@@ -104,7 +104,7 @@ vr_bool vroniObject::SegPntPntCntr(int i, int j, int k, int e, coord *cntr,
/* */
/* check whether one of the points is an endpoint of segs[i]. */
/* */
if (IsSegStartPnt(i, k) || IsSegEndPnt(i, k)) Swap(j, k, n1);
if (IsSegStartPnt(i, k) || IsSegEndPnt(i, k)) VroniSwap(j, k, n1);
p = GetPntCoords(j);
q = GetPntCoords(k);
+1 -1
View File
@@ -137,7 +137,7 @@ vr_bool vroniObject::SegSegPntCntr(int i, int j, int k, int e, coord *cntr,
/* segs[j]. */
/* */
p = GetPntCoords(k);
if (IsSegStartPnt(j, k) || IsSegEndPnt(j, k)) Swap(i, j, n1);
if (IsSegStartPnt(j, k) || IsSegEndPnt(j, k)) VroniSwap(i, j, n1);
if (IsSegStartPnt(j, k) || IsSegEndPnt(j, k)) {
/* */
/* pnts[k] is an endpoint of both segs[i] and segs[j]. */
-53
View File
@@ -1,53 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2000-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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-172 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_STACK_H
#define VRONI_STACK_H
#define Push(data) \
{\
++num_stack; \
if (num_stack >= max_num_stack) { \
max_num_stack += STACK_INCR; \
stack = (STACK_TYPE*) ReallocateArray(stack, max_num_stack, sizeof(STACK_TYPE), STACK_STRING); \
} \
stack[num_stack] = data; \
}
#define Pop(data) \
{\
assert(num_stack > 0); \
data = stack[num_stack]; \
--num_stack; \
}
#define GetStackSize (num_stack)
#define StackIsNotEmpty (num_stack > 0)
#define StackIsEmpty (num_stack <= 0)
#define ResetStack { num_stack = 0; }
#endif
-3
View File
@@ -63,9 +63,6 @@
#include "numerics.h"
#include "heap.cc"
#define Initial_Depth 2
-42
View File
@@ -1,42 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2001-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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber */
/* Modified: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_TYPES_H
#define VRONI_TYPES_H
#ifdef HAVE_BOOL
#include <stdbool.h>
typedef bool vr_bool;
#else
#define false 0
#define true (!false)
typedef unsigned char vr_bool;
#endif
#endif
-287
View File
@@ -1,287 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2010-2023 M. Held, S. Huber */
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber, Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_UTIL_H
#define VRONI_UTIL_H
#ifndef DOUBLE_OVERRIDE
#include <math.h>
#endif
#include "consts.h"
inline static int Sign(double_arg x)
{
if ((x == 0.0) || (x == -0.0))
return 0;
if ( x > 0.0)
return 1;
else
return -1;
}
/** Like Sign but closed interval (-eps, eps) is identified with 0 */
inline static int SignEps(double_arg x, double_arg eps)
{
if (x > eps)
return 1;
else if (x < -eps)
return -1;
else
return 0;
}
inline static double Abs(double_arg x)
{
return fabs(x);
}
inline static void Swap_d(double* x, double* y)
{
double t = *y;
*y = *x;
*x = t;
}
inline static void Swap_i(int* x, int* y)
{
int t = *y;
*y = *x;
*x = t;
}
inline static double Ceiling(double_arg x)
{
return ceil(x);
}
#ifndef DOUBLE_OVERRIDE
//function currently unused. In case it is used later, it requires
//another way to calculate the CubicRoot for CORE and possibly MPFR
inline static double CubicRoot(double_arg x)
{
const double r = pow(x, M_1_3);
if(Sign(x)<0)
return -r;
else
return r;
}
#endif
#define Sq(x) ((x) * (x))
#define Swap(i1, i2, i) \
{(i) = (i1); \
(i1) = (i2); \
(i2) = (i); }
#define Min(a, b) ((a) < (b) ? (a) : (b))
#define Max(a, b) ((b) < (a) ? (a) : (b))
#define Min3(a, b, c) (((a) < (b)) ? \
(((a) < (c)) ? \
(a) : (c)) \
: \
(((b) < (c)) ? \
(b) : (c)))
#define Max3(a, b, c) (((a) < (b)) ? \
(((b) < (c)) ? \
(c) : (b)) \
: \
(((a) < (c)) ? \
(c) : (a)))
#define Min4(a, b, c, d) (((a) < (b)) ? \
(((a) < (c)) ? \
(((a) < (d)) ?\
(a) : (d)) \
: \
(((c) < (d)) ? \
(c) : (d))) \
: \
(((b) < (c)) ? \
(((b) < (d)) ? \
(b) : (d)) \
: \
(((c) < (d)) ? \
(c) : (d))))
#define Max4(a, b, c, d) (((a) < (b)) ? \
(((b) < (c)) ? \
(((c) < (d)) ?\
(d) : (c)) \
: \
(((b) < (d)) ? \
(d) : (b))) \
: \
(((a) < (c)) ? \
(((c) < (d)) ? \
(d) : (c)) \
: \
(((a) < (d)) ? \
(d) : (a))))
#define MinMax3(a, b, c, min, max) {\
if ((a) < (b)) {\
if ((a) < (c)) {\
min = (a); \
if ((b) < (c)) max = (c); \
else max = (b); \
}\
else { \
min = (c); \
max = (b); \
}\
}\
else { \
if ((a) < (c)) {\
min = (b); \
max = (c); \
} \
else { \
max = (a); \
if ((b) < (c)) min = (b); \
else min = (c); \
} \
}\
}
#define MinMax4(a, b, c, d, min, max) {\
if ((a) < (b)) {\
if ((a) < (c)) {\
min = (a); \
if ((b) < (c)) max = (c); \
else max = (b); \
} \
else { \
min = (c); \
max = (b); \
} \
}\
else { \
if ((a) < (c)) { \
min = (b); \
max = (c); \
} \
else { \
max = (a); \
if ((b) < (c)) min = (b); \
else min = (c); \
}\
} \
if ((d) < min) min = (d); \
else if ((d) > max) max = (d); \
}
#define SortTwoNumbers(a, b, c) {\
if (a > b) { \
c = a; \
a = b; \
b = c; \
} \
}
#define SortThreeNumbers(a, b, c, d) {\
if (a < b) {\
if (a < c) {\
if (b > c) {\
d = b; \
b = c; \
c = d; \
}\
}\
else { \
d = a; \
a = c; \
c = b; \
b = d; \
}\
}\
else { \
if (a < c) { \
d = a; \
a = b; \
b = d; \
} \
else { \
if (b < c) {\
d = a; \
a = b; \
b = c; \
c = d; \
}\
else { \
d = a; \
a = c; \
c = d; \
}\
}\
}\
}
#define MinMax(a, b, min, max) {\
if ((b) < (a)) {\
min = (b); \
max = (a); \
} \
else { \
min = (a); \
max = (b); \
} \
}
#define MinMaxQ(a, b, min, max) \
(((b) < (a)) ? (min = (b), max = (a)) : (min = (a), max = (b)))
#define MinMax3Q(a, b, c, min, max) \
(((b) < (a)) ? (((c) < (b)) ? (min = (c), max = (a)) : \
(((c) > (a)) ? (min = (b), max = (c)) : \
(min = (b), max = (a)))) : \
(((c) > (b)) ? (min = (a), max = (c)) : \
(((c) > (a)) ? (min = (a), max = (b)) : \
(min = (c), max = (b)))))
/* */
/* some macros for epsilon-based comparisons with respect to zero... */
/* */
#define lt(a, b) ( ((a) < -b) )
#define ge(a, b) (! ((a) < -b) )
#define le(a, b) ( ((a) <= b) )
#define gt(a, b) (! ((a) <= b) )
#define eq(a, eps) ( (((a) <= eps) && !((a) < -eps)) )
#define ne(a, eps) ( !eq(a,eps) )
#endif
+1 -1
View File
@@ -1340,7 +1340,7 @@ void vroniObject::DeleteDummyNodes(void)
assert(IsNodeDummy(n));
if (GetStartNode(e1) == n) {
Swap(e1, e2, e);
VroniSwap(e1, e2, e);
}
assert(GetEndNode(e1) == n);
assert(GetStartNode(e2) == n);
-1167
View File
File diff suppressed because it is too large Load Diff
-342
View File
@@ -1,342 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2010-2023 M. Held, S. Huber */
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Stefan Huber, Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_VDDATA_H
#define VRONI_VDDATA_H
#ifndef DOUBLE_OVERRIDE
#include <assert.h>
#endif
#include "consts.h"
#include "ext_appl_defs.h"
#include "wmat.h"
#if defined(OGL_GRAPHICS)
#ifndef GRAPHICS
#define GRAPHICS
#endif
#endif
/** Different types of input sites, Voronoi diagram objects, Delaunay
* triangulation object, and offsetting object */
typedef enum
{
/** Segment */
SEG,
/** Arc */
ARC,
/** Point */
PNT,
/** Voronoi node */
VDN,
/** Voronoi edge */
VDE,
/** Delaunay triangulation edge */
DTE,
/** CCW offset arc */
CCW,
/** CW offset arc */
CW,
UNKNOWN
} t_site;
/** Status of voronoi node */
typedef enum
{
/** not yet checked */
UNCHECKED,
/** keep this node */
CHECKED,
/** delete this node */
DELETED,
/** already visited, marked for deletion */
VISITED,
/** this is a dummy node */
DUMMY,
MISC
} n_status;
/** Input vertex */
struct pnt
{
/** Position of vertex */
coord p;
/** An edge to the Voronoi cell of this point */
int vd;
/** A Voronoi node that concides with it */
int node;
/** Already visited */
vr_bool vis;
/** Segment/arc that is incident has already been inserted. */
vr_bool s;
/** Will be deleted during next restart */
vr_bool del;
#ifdef WRITE_VD
int vd_edge;
int idx;
#endif
#ifdef GRAPHICS
/** We draw this point */
vr_bool draw;
#endif
#ifdef ORDERED
/** number assinged in increasing order for every pnt */
int key;
#endif
#ifdef EXT_APPL_PNTS
eap_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline pnt() {}
};
/** Input segment */
struct seg
{
/** Start point */
int i1;
/** End point */
int i2;
/** parameter in a*x + b*x + c = 0 */
double a;
/** parameter in a*x + b*x + c = 0 */
double b;
/** parameter in a*x + b*x + c = 0 */
double c;
/** length of line segment */
double lgth;
/** an edge of the Voroni cell of this seg*/
int vd;
#ifdef WRITE_VD
int vd_edge;
#endif
#ifdef GRAPHICS
/** We draw this point */
vr_bool draw;
#endif
#ifdef ORDERED
/** number assigned in increasing order for every pnt */
int key;
#endif
#ifdef EXT_APPL_SITES
eas_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline seg() {}
};
/** Input arc */
struct arc
{
/** start point */
int i1;
/** end point */
int i2;
/** center point */
coord c;
/** radius */
double r;
/** orientation */
vr_bool ccw;
/** unit normal vector at start point point outwards */
coord ns;
/** unit normal vector at end point point outwards */
coord ne;
/** parameter of chord line equation a*x + b*y + d = 0 */
double a;
/** parameter of chord line equation a*x + b*y + d = 0 */
double b;
/** parameter of chord line equation a*x + b*y + d = 0 */
double d;
/** an edge of the voronoi cell of this arc */
int vd;
#ifdef GRAPHICS
/** We draw this point */
vr_bool draw;
#endif
#ifdef ORDERED
/** number assigned in increasing order for every pnt */
int key;
#endif
#ifdef EXT_APPL_SITES
eas_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline arc() {}
};
/** Voronoi node */
struct node
{
/** Position */
coord p;
/** Clearance.
* Attention: During pnt-VD generation this is the squared clearance!!! */
double r2;
/** A degree-two node */
vr_bool deg2;
/** Current status of node */
n_status status;
/** an incident edge */
int edge;
/** an input point, if node coincides with some. NIL otherwise. */
int site;
#ifdef WRITE_VD
int idx;
#endif
#ifdef EXT_APPL_VD
ean_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline node() {}
};
struct edge {
int n1; /* start node */
int n2; /* end node */
int lft; /* left defining site */
int rgt; /* right defining site */
t_site ltype; /* type of left defining site: PNT, SEG, or ARC */
t_site rtype; /* type of right defining site: PNT, SEG, or ARC */
int s_ccw; /* next edge in CCW order around start node */
int s_cw; /* next edge in CW order around start node */
int e_ccw; /* next edge in CCW order around end node */
int e_cw; /* next edge in CW order around end node */
vr_bool del; /* edge to be deleted during the incremental insertion? */
#ifdef MAT
w_mat_data w_mat; /* data for the (weighted) medial axis */
#endif
#ifdef EXT_APPL_VD
eae_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline edge() {}
}; /********** Voronoi edge ******************************/
typedef struct {
vr_bool active; /* for repeated offsetting: true if the offset value is */
/* less than the maximum of the clearances of the nodes */
/* of this VD edge. */
vr_bool e_new; /* true if no offset curve (at the current offset) has */
/* already intersected this bisector. */
vr_bool deg; /* true if the clearance of the start node of this edge */
/* is identical to the clearance of the end node */
} e_flag; /************* status flags for Voronoi edges ***********/
struct e_formula {
vr_bool init; /* true if a parameterization of this bisectors has not */
/* yet been computed. */
double A; /* coefficient of parameterization; see data_off.c */
double B; /* coefficient of parameterization; see data_off.c */
#ifdef GENUINE_ARCS
double C; /* coefficient of parameterization; see data_off.c */
double D; /* coefficient of parameterization; see data_off.c */
#endif
double d; /* coefficient of parameterization; see data_off.c */
vr_bool k1; /* positive or negative sliding direction of site #1 */
vr_bool k2; /* positive or negative sliding direction of site #2 */
vr_bool sign; /* positive or negative sign in the parameterization? */
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline e_formula() {}
}; /******* parameterization data for Voronoi edges ********/
#ifdef ORDERED
struct ordered_sites
{
int ind;
int key;
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline ordered_sites() {}
};
#endif
#ifdef SORTED
struct sorted_sites
{
int ind;
double lgth;
//Ensure construction doesn't implicitly initialize elements - done explicitly later anyway
inline sorted_sites() {}
};
#endif
#endif
-71
View File
@@ -1,71 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2001-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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* Date: Sep 23, 2001 */
/* Modified: */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
/* */
/* get standard libraries */
/* */
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <float.h>
#include <stack>
/* */
/* get my header files */
/* */
#include "fpkernel.h"
#include "vronivector.h"
#include "vroni_object.h"
#include "defs.h"
#include "numerics.h"
#include "util.h"
/* */
/* we include the definitions of static data structures and the macros */
/* associated */
/* */
#include "vd_data.cc"
/* */
/* we include the routines for InsertPntIntoVD(). */
/* */
#include "vd_pnt.cc"
/* */
/* we include the routines for InsertSegIntoVD(). */
/* */
#include "vd_seg.cc"
#ifdef GENUINE_ARCS
/* */
/* we include the routines for InsertArcIntoVD(). */
/* */
#include "vd_arc.cc"
#endif
+9 -39
View File
@@ -86,9 +86,10 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;NO_CPUTIME;HAVE_BOOL;MAT;MIC;GENUINE_ARCS;VRONI_INFO;RANDOM;RAND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>\EgtDev\Extern\vroni\Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -104,7 +105,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;NO_CPUTIME;HAVE_BOOL;MAT;MIC;GENUINE_ARCS;VRONI_INFO;RANDOM;RAND</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<WholeProgramOptimization>false</WholeProgramOptimization>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -112,6 +113,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<AdditionalIncludeDirectories>\EgtDev\Extern\vroni\Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -127,10 +129,11 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;NO_CPUTIME;HAVE_BOOL;MAT;MIC;GENUINE_ARCS;VRONI_INFO;RANDOM;RAND;_CRT_SECURE_NO_WARNINGS;NO_CPUTIME;HAVE_BOOL;MAT;MIC;GENUINE_ARCS;VRONI_INFO;RANDOM;RAND</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>\EgtDev\Extern\vroni\Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -146,7 +149,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;NO_CPUTIME;HAVE_BOOL;MAT;MIC;GENUINE_ARCS;VRONI_INFO;RANDOM;RAND;_CRT_SECURE_NO_WARNINGS;NO_CPUTIME;HAVE_BOOL;MAT;MIC;GENUINE_ARCS;VRONI_INFO;RANDOM;RAND</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<DebugInformationFormat>None</DebugInformationFormat>
@@ -154,6 +157,7 @@
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>\EgtDev\Extern\vroni\Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -165,38 +169,6 @@
<Command>copy $(TargetDir)$(TargetName).lib \EgtDev\Extern\vroni\Lib\</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="approx.h" />
<ClInclude Include="arc_common.h" />
<ClInclude Include="basic.h" />
<ClInclude Include="consts.h" />
<ClInclude Include="coord.h" />
<ClInclude Include="coreatan2.h" />
<ClInclude Include="defs.h" />
<ClInclude Include="dvi_graphics_header.h" />
<ClInclude Include="elapsed.h" />
<ClInclude Include="ext_appl_defs.h" />
<ClInclude Include="ext_appl_inout.h" />
<ClInclude Include="ext_appl_vroni_object.h" />
<ClInclude Include="fpkernel.h" />
<ClInclude Include="geom.h" />
<ClInclude Include="header.h" />
<ClInclude Include="intersections.h" />
<ClInclude Include="io_dxf.h" />
<ClInclude Include="ipe_io.h" />
<ClInclude Include="numerics.h" />
<ClInclude Include="offset.h" />
<ClInclude Include="random.h" />
<ClInclude Include="roots.h" />
<ClInclude Include="stack.h" />
<ClInclude Include="types.h" />
<ClInclude Include="util.h" />
<ClInclude Include="vddata.h" />
<ClInclude Include="vd_data.h" />
<ClInclude Include="vronivector.h" />
<ClInclude Include="vroni_object.h" />
<ClInclude Include="wmat.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="api_functions.cc" />
<ClCompile Include="approx.cc" />
@@ -210,7 +182,6 @@
<ClCompile Include="arg_eval.cc" />
<ClCompile Include="clean_data.cc" />
<ClCompile Include="compute.cc" />
<ClCompile Include="coord.cc" />
<ClCompile Include="data.cc" />
<ClCompile Include="data_off.cc" />
<ClCompile Include="desperate.cc" />
@@ -228,7 +199,6 @@
<ClCompile Include="ext_appl_vroni_object.cc" />
<ClCompile Include="ext_appl_wmat.cc" />
<ClCompile Include="geom.cc" />
<ClCompile Include="graphics_ogl.cc" />
<ClCompile Include="grid.cc" />
<ClCompile Include="heap.cc" />
<ClCompile Include="intersections.cc" />
@@ -259,7 +229,7 @@
<ClCompile Include="vd_data.cc" />
<ClCompile Include="vd_pnt.cc" />
<ClCompile Include="vd_seg.cc" />
<ClCompile Include="voronoi.cc" />
<ClCompile Include="vroni_added_functions.cpp" />
<ClCompile Include="vroni_object.cc" />
<ClCompile Include="wmat.cc" />
</ItemGroup>
+6 -104
View File
@@ -15,101 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="approx.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="arc_common.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="basic.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="consts.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="coord.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="coreatan2.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="defs.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="dvi_graphics_header.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="elapsed.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="ext_appl_defs.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="ext_appl_inout.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="ext_appl_vroni_object.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="fpkernel.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="geom.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="header.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="intersections.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="io_dxf.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="ipe_io.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="numerics.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="offset.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="random.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="roots.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="stack.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="types.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="util.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="vd_data.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="vddata.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="vroni_object.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="vronivector.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="wmat.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="api_functions.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="approx.cc">
<Filter>File di origine</Filter>
</ClCompile>
@@ -143,9 +48,6 @@
<ClCompile Include="compute.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="coord.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="data.cc">
<Filter>File di origine</Filter>
</ClCompile>
@@ -197,9 +99,6 @@
<ClCompile Include="geom.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="graphics_ogl.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="grid.cc">
<Filter>File di origine</Filter>
</ClCompile>
@@ -290,14 +189,17 @@
<ClCompile Include="vddata.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="voronoi.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="vroni_object.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="wmat.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="api_functions.cc">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="vroni_added_functions.cpp">
<Filter>File di origine</Filter>
</ClCompile>
</ItemGroup>
</Project>
+306
View File
@@ -0,0 +1,306 @@
/*****************************************************************************/
/* */
/* Funzioni aggiunte per integrare vroni con le nostre librerie */
/* */
/*****************************************************************************/
#include "vroni_object.h"
#include "offset.h"
//----------------------------------------------------------------------------
void
vroniObject::GetPointFromCoord( coord ptCoord, double p[3])
{
// trasformo vroni::coord in un array compatibile con il nostro Point3d
p[0] = ptCoord.x ;
p[1] = ptCoord.y ;
p[2] = 0.0 ;
// scalo
if ( unscaleXYZ) {
p[0] = UnscaleX( p[0]) ;
p[1] = UnscaleY( p[1]) ;
}
}
//----------------------------------------------------------------------------
int
vroniObject::GetOffsetCurveCount( int i)
{
return GetOffsetListEnd(i) - GetOffsetListStart(i) + 1 ;
}
//----------------------------------------------------------------------------
vr_bool
vroniObject::GetOffsetCurve( int nOffs, int nCrv, int& nType, double ptS[3], double ptE[3], double ptC[3],
int& nOrigLoop, int& nOrigCrv, int& nOrigPnt)
{
// sito originale
nOrigLoop = -1 ;
nOrigCrv = -1 ;
nOrigPnt = -1 ;
if ( nOffs > num_offset_list)
return false ;
int k = GetOffsetListStart( nOffs) + nCrv ;
if ( k > GetOffsetListEnd( nOffs))
return false ;
assert( InOffsetData(k)) ;
// recupero il punto iniziale
coord start = GetOffsetPntCoords( k) ;
GetPointFromCoord( start, ptS) ;
// recupero punto finale
int m = k + 1 ;
if ( m > GetOffsetListEnd( nOffs))
m = GetOffsetListStart( nOffs) ;
coord end = GetOffsetPntCoords( m) ;
GetPointFromCoord( end, ptE) ;
if ( GetOffsetEleType( k) == PNT) {
int c = GetOffsetEleSite( k) ;
assert( InPntsList( c)) ;
coord center = GetPntCoords( c) ;
vr_bool ori = false ;
if ( ScrutinizeArc( start, end, center, &ori, ZERO_IO, HasIncidentSite( c))) {
nType = CW ;
// recupero le coordinate del centro
GetPointFromCoord( center, ptC) ;
}
else
nType = SEG ;
// recupero il sito
nOrigLoop = pnts[c].ext_appl.first ;
nOrigPnt = pnts[c].ext_appl.second ;
}
else if ( GetOffsetEleType( k) == SEG) {
nType = SEG ;
// recupero il sito
int c = GetOffsetEleSite( k) ;
nOrigLoop = segs[c].ext_appl.first ;
nOrigCrv = segs[c].ext_appl.second ;
}
else if ( GetOffsetEleType( k) == CCW || GetOffsetEleType( k) == CW) {
int c = GetOffsetEleSite( k) ;
assert( InArcsList( c)) ;
coord center = GetArcCenter( c) ;
vr_bool ori = ( GetOffsetEleType( k) == CCW ? true : false) ;
if ( ScrutinizeArc( start, end, center, &ori, ZERO_IO, true)) {
nType = ori ? CCW : CW ;
// recupero le coordinate del centro
GetPointFromCoord( center, ptC) ;
}
else
nType = SEG ;
// recupero il sito
nOrigLoop = arcs[c].ext_appl.first ;
nOrigCrv = arcs[c].ext_appl.second ;
}
return true ;
}
//----------------------------------------------------------------------------
void vroniObject::ResetVoronoiDiagram(void)
{
/* */
/* reset global and static data within individual files */
/* */
#ifdef GRAPHICS
if (graphics) {
#if defined (OGL_GRAPHICS)
ResetGraphicsData();
#else
ExtApplResetGraphicsData;
#endif
ResetBufferData();
}
#endif
// sistemo i 4 punti estremi
SetXCoord( 0, -DBL_MAX) ;
SetYCoord( 0, -DBL_MAX) ;
SetXCoord( 1, -DBL_MAX) ;
SetYCoord( 1, DBL_MAX) ;
int i = num_pnts - 2 ;
SetXCoord( i, DBL_MAX) ;
SetYCoord( i, -DBL_MAX) ;
i = num_pnts - 1 ;
SetXCoord( i, DBL_MAX) ;
SetYCoord( i, DBL_MAX) ;
ResetVDData();
ResetVDConstructionData();
ResetEdgeData();
ResetOffsetData();
#ifdef MAT
ResetWMATStatus();
#endif
ResetIntersectionData();
ResetIntersectionStatus();
ResetCleanStatus();
isolated_pnts = false;
/* */
/* let the user call some application-specific function */
/* */
ExtApplFuncReset;
return;
}
//----------------------------------------------------------------------------
void
vroniObject::GetVDBisectorPointAtParam( int nEdge, double dPar, double pt[3])
{
int nTmp = 0 ;
InitializeEdgeData( true, true, false, &nTmp) ;
dPar = ScaleV( dPar) ;
coord ptCoord ;
EvaluateBisectorData( nEdge, dPar, &ptCoord) ;
GetPointFromCoord( ptCoord, pt) ;
}
//----------------------------------------------------------------------------
void
vroniObject::GetVDBisectorParams( int i, double& dParS, double& dParE)
{
GetEdgeParam( i, &dParS, &dParE) ;
dParS = UnscaleV( dParS) ;
dParE = UnscaleV( dParE) ;
}
//----------------------------------------------------------------------------
void
vroniObject::GetVDBisectorPoints( int i, double ptS[3], double ptE[3])
{
coord coordS = GetNodeCoord( edges[i].n1) ;
GetPointFromCoord( coordS, ptS) ;
coord coordE = GetNodeCoord( edges[i].n2) ;
GetPointFromCoord( coordE, ptE) ;
}
//----------------------------------------------------------------------------
BisectorType
vroniObject::GetVDBisectorType( int i)
{
int lft, rgt ;
t_site t_lft, t_rgt ;
GetLftSiteData(i, &lft, &t_lft) ;
GetRgtSiteData(i, &rgt, &t_rgt) ;
BisectorType conic = NONE ;
if ( t_lft == UNKNOWN || t_rgt == UNKNOWN || lft == NIL || rgt == NIL)
return NONE ;
if (( t_lft == PNT) && ( t_rgt == PNT)) {
conic = HYPERBOLA ;
}
else if (( t_lft == PNT) || ( t_lft == ARC)) {
if (( t_rgt == PNT) || ( t_rgt == ARC)) {
if ( t_lft == PNT) {
assert( t_rgt == ARC) ;
assert( InArcsList( rgt)) ;
if ( IsArcStartPnt( rgt, lft) || IsArcEndPnt( rgt, lft))
conic = LINE ;
else
conic = HYPERELL ;
}
else if ( t_rgt == PNT) {
assert( t_lft == ARC) ;
assert( InArcsList( lft)) ;
if ( IsArcStartPnt( lft, rgt) || IsArcEndPnt( lft, rgt))
conic = LINE ;
else
conic = HYPERELL ;
}
else {
conic = HYPERELL ;
}
}
else {
assert( t_rgt == SEG);
assert( InSegsList( rgt));
if (( t_lft == PNT) &&
( IsSegStartPnt( rgt, lft) || IsSegEndPnt( rgt, lft)))
conic = LINE ;
else
conic = PARABOLA ;
}
}
else {
if (( t_rgt == PNT) || ( t_rgt == ARC)) {
assert( t_lft == SEG) ;
assert( InSegsList( lft)) ;
if (( t_rgt == PNT) &&
( IsSegStartPnt( lft, rgt) || IsSegEndPnt( lft, rgt)))
conic = LINE ;
else
conic = PARABOLA ;
}
else {
conic = LINE ;
}
}
return conic ;
}
//----------------------------------------------------------------------------
vr_bool
vroniObject::IsWMATEdge( int nEdge)
{
return edges[nEdge].w_mat.in_w_mat ;
}
//----------------------------------------------------------------------------
void
vroniObject::MyWriteVoronoiRegion( FILE *output)
{
fprintf(output, "\n\nEDGES DATA \n\n") ;
for ( int i = 0 ; i < num_edges ; i ++) {
fprintf(output, "\nVoronoi edge %i", i) ;
fprintf(output, "\n n1 = %i", edges[i].n1) ;
fprintf(output, "\n n2 = %i", edges[i].n2) ;
fprintf(output, "\n lft = %i", edges[i].lft) ;
fprintf(output, "\n rgt = %i", edges[i].rgt) ;
fprintf(output, "\n lft type = %i", edges[i].ltype) ;
fprintf(output, "\n rgt type = %i", edges[i].rtype) ;
fprintf(output, "\n s_ccw = %i", edges[i].s_ccw) ;
fprintf(output, "\n s_cw = %i", edges[i].s_cw) ;
fprintf(output, "\n e_ccw = %i", edges[i].e_ccw) ;
fprintf(output, "\n e_cw = %i", edges[i].e_cw) ;
if (IsWmatEdge(i)) {
fprintf(output, "\n wmat = %i", edges[i].w_mat.in_w_mat) ;
// fprintf(output, "\n-- wmat rmin = %f", UnscaleV( edges[i].w_mat.r_min)) ; // solo con WMAT
// fprintf(output, "\n-- wmat rmax= %f", UnscaleV( edges[i].w_mat.r_max)) ; // solo con WMAT
}
// BisectorType nType = EvaluateBisectorType( i) ;
// fprintf(output, "\n-- type = %i", nType) ;
// double p1, p2 ;
// GetEdgeParam( i, &p1, &p2) ;
// fprintf(output, "\n-- line param %f %f", UnscaleV( p1), UnscaleV( p2)) ;
}
fprintf(output, "\n\nNODES DATA\n\n") ;
for ( int i = 0 ; i < num_nodes ; i ++) {
fprintf(output, "\n Voronoi node %i", i) ;
auto p = GetNodeCoord(i) ;
fprintf(output, "\n pt = %f %f", UnscaleX(p.x), UnscaleY(p.y)) ;
fprintf(output, "\n r2 = %f", UnscaleV( nodes[i].r2)) ;
fprintf(output, "\n deg2 = %i", nodes[i].deg2) ;
fprintf(output, "\n edge = %i", nodes[i].edge) ;
fprintf(output, "\n site = %i", nodes[i].site) ;
}
return ;
}
-3076
View File
File diff suppressed because it is too large Load Diff
-109
View File
@@ -1,109 +0,0 @@
/*****************************************************************************/
/* */
/* 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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_VECTOR_H
#define VRONI_VECTOR_H
#include <stdlib.h>
#include <new>
#include <iostream>
#include <exception>
template<typename T>
class vronivector {
private:
unsigned int arraysize;
T * array;
public:
inline vronivector() : arraysize(0), array(NULL) {}
inline ~vronivector() {
free(array);
}
T * begin() {
return array;
}
T * end() {
return array + arraysize;
}
unsigned int size() {
return arraysize;
}
void inline reserve(unsigned int ) {}
void resize(unsigned int newsize) {
/* */
/* Call destructor of elements no longer needed if the size of the */
/* array is reduced */
/* */
for(unsigned int i = newsize; i < arraysize; ++i) {
array[i].~T();
}
// Reallocate
T * newarray = (T*) realloc(array, newsize * sizeof(T));
if (newarray == NULL) throw std::bad_alloc();
//Initialize new elements of array
for(unsigned int i = arraysize; i < newsize; ++i) {
new (&newarray[i]) T();
}
array = newarray;
arraysize = newsize;
}
void clear() {
free(array);
array = NULL;
arraysize = 0;
}
inline T & operator[](unsigned int ind) {
return array[ind];
}
};
template <class vtype>
inline void gentlyResizeSTLVector(vtype & v, unsigned int newsize,
const char * vname) {
try {
v.reserve(newsize);
v.resize(newsize);
}
catch (std::bad_alloc& c) {
std::cerr << "\n" << "VRONI exception while trying to resize vector "
<< vname << " (" << c.what() << ")" << std::endl;
throw std::runtime_error("VRONI error: gentlyResizeSTLVector() - memory reallocation failed!");
}
}
#endif
+12 -10
View File
@@ -154,7 +154,9 @@ void vroniObject::CheckWMAT(double wmat_dist, double wmat_angle)
wmat_cosine = cos(wmat_angle);
wmat_dist_sq = wmat_dist * wmat_dist;
delta = 0.1 * wmat_dist;
if (lt(delta, SMALL)) delta = SMALL; /* must not be equal to 0.0!!!! */
// if (lt(delta, SMALL)) delta = SMALL; /* must not be equal to 0.0!!!! */ // KO ?
if ( delta < SMALL)
delta = SMALL; /* must not be equal to 0.0!!!! */
for (i = 4; i < num_edges; ++i) {
if (IsWmatEdge(i)) {
@@ -163,7 +165,7 @@ void vroniObject::CheckWMAT(double wmat_dist, double wmat_angle)
GetNodeData(n1, &p1, &t1);
GetNodeData(n2, &p2, &t2);
if (t1 > t2) {
Swap(t1, t2, r1);
VroniSwap(t1, t2, r1);
}
else {
p1 = p2;
@@ -175,7 +177,7 @@ void vroniObject::CheckWMAT(double wmat_dist, double wmat_angle)
GetLftSiteData(i, &lft, &t_lft);
GetRgtSiteData(i, &rgt, &t_rgt);
if ((t_lft == PNT) && (t_rgt == SEG)) {
Swap(lft, rgt, j);
VroniSwap(lft, rgt, j);
t_lft = SEG;
t_rgt = PNT;
}
@@ -303,8 +305,8 @@ void vroniObject::ComputeWMATParabola(int i, int i1, int i2)
GetNodeData(n1, &p1, &t1);
GetNodeData(n2, &p2, &t2);
if (t2 < t1) {
Swap(t1, t2, t_min);
Swap(p1, p2, p);
VroniSwap(t1, t2, t_min);
VroniSwap(p1, p2, p);
}
if (le(t2, ZERO)) { /* degenerate segment */
@@ -442,8 +444,8 @@ void vroniObject::ComputeWMATHyperbola(int i)
GetNodeData(n1, &p1, &t1);
GetNodeData(n2, &p2, &t2);
if (t2 < t1) {
Swap(t1, t2, t_max);
Swap(p1, p2, p);
VroniSwap(t1, t2, t_max);
VroniSwap(p1, p2, p);
}
if (le(t2, ZERO)) { /* degenerate segment */
@@ -546,7 +548,7 @@ void vroniObject::ComputeWMATLine(int i)
}
else {
q1 = p1;
Swap(t1, t2, t_min);
VroniSwap(t1, t2, t_min);
}
if (le(t2, ZERO)) { /* degnerate segment */
@@ -904,8 +906,8 @@ void vroniObject::AddWMATToBuffer(void)
GetNodeData(n1, &u, &t1);
GetNodeData(n2, &v, &t2);
if (t2 < t1) {
Swap(t1, t2, t);
Swap(u, v, dummy);
VroniSwap(t1, t2, t);
VroniSwap(u, v, dummy);
}
#endif
GetLftSiteData(i, &lft, &t_lft);
-150
View File
@@ -1,150 +0,0 @@
/*****************************************************************************/
/* */
/* Copyright (C) 2001-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". */
/* */
/*****************************************************************************/
/* */
/* Written by: Martin Held */
/* */
/* E-Mail: held@cs.sbg.ac.at */
/* Fax Mail: (+43 662) 8044-611 */
/* Voice Mail: (+43 662) 8044-6304 */
/* Snail Mail: Martin Held */
/* FB Informatik */
/* Universitaet Salzburg */
/* A-5020 Salzburg, Austria */
/* */
/*****************************************************************************/
#ifndef VRONI_WMAT_H
#define VRONI_WMAT_H
#include "types.h"
#ifdef WMAT
#ifndef MAT
#define MAT
#endif
#endif
#ifdef MAT
typedef struct {
vr_bool in_w_mat; /* true if a portion of this VD edge belongs also to */
/* WMAT or MAT */
#ifdef WMAT
double r_min; /* minimum contour clearance of this edge */
double r_max; /* maximum contour clearance of this edge */
coord lft_mn_pnt; /* left contact point for disk with radius r_min */
coord lft_mx_pnt; /* left contact point for disk with radius r_max */
coord rgt_mn_pnt; /* right contact point for disk with radius r_min */
coord rgt_mx_pnt; /* right contact point for disk with radius r_max */
#endif
#ifdef EXT_APPL_WMAT
eam_type ext_appl;/* this field can be set by an application program to */
/* refer to a user-defined entity. */
#endif
} w_mat_data; /*********** (weighted) medial axis *********************/
#define IsWmatEdge(E) \
(\
assert(InEdgesList(E)), \
(edges[E].w_mat.in_w_mat))
#define SetWmatEdge(E, B) \
{\
assert(InEdgesList(E)); \
edges[E].w_mat.in_w_mat = B; \
}
#endif
#ifdef WMAT
#define GetWmatRMin(E) \
(\
assert(InEdgesList(E)), \
(edges[E].w_mat.r_min))
#define SetWmatRMin(E, R) \
{\
assert(InEdgesList(E)); \
edges[E].w_mat.r_min = R; \
}
#define GetWmatRMax(E) \
(\
assert(InEdgesList(E)), \
(edges[E].w_mat.r_max))
#define SetWmatRMax(E, R) \
{\
assert(InEdgesList(E)); \
edges[E].w_mat.r_max = R; \
}
#define GetWmatLftMnPnt(E) \
(\
assert(InEdgesList(E)), \
(edges[E].w_mat.lft_mn_pnt))
#define SetWmatLftMnPnt(E, P) \
{\
assert(InEdgesList(E)); \
edges[E].w_mat.lft_mn_pnt = P; \
}
#define GetWmatRgtMnPnt(E) \
(\
assert(InEdgesList(E)), \
(edges[E].w_mat.rgt_mn_pnt))
#define SetWmatRgtMnPnt(E, P) \
{\
assert(InEdgesList(E)); \
edges[E].w_mat.rgt_mn_pnt = P; \
}
#define GetWmatLftMxPnt(E) \
(\
assert(InEdgesList(E)), \
(edges[E].w_mat.lft_mx_pnt))
#define SetWmatLftMxPnt(E, P) \
{\
assert(InEdgesList(E)); \
edges[E].w_mat.lft_mx_pnt = P; \
}
#define GetWmatRgtMxPnt(E) \
(\
assert(InEdgesList(E)), \
(edges[E].w_mat.rgt_mx_pnt))
#define SetWmatRgtMxPnt(E, P) \
{\
assert(InEdgesList(E)); \
edges[E].w_mat.rgt_mx_pnt = P; \
}
#endif
#endif