- in FindMostViolatedRecursiveArc aggiunto contatore e controllo per evitare loop infinito
- aggiunta funzione per prendere i messaggi di errore legati ad eccezioni
- migliorie varie alla funzione ausiliaria per debug.
This commit is contained in:
SaraP
2024-02-12 12:11:48 +01:00
parent bb25d970d4
commit b1a75281bc
3 changed files with 366 additions and 309 deletions
-3
View File
@@ -952,9 +952,6 @@ void vroniObject::ComputeVD(vr_bool save_data, vr_bool new_input,
*finished = true;
initialized = false;
// Funzione ausiliaria per debug
// MyWriteVoronoiRegion(vr_file_handle);
return;
}
+282 -272
View File
@@ -90,282 +90,292 @@ vr_bool vroniObject::IsSameSide(int i, t_site t, int j, int i1, coord p_node)
* - Otherwise calc *n and *dist. However, beware of special case of e being on
* boundary of CI of arc j.
*/
void vroniObject::FindMostViolatedRecursiveArc(int e, int k0,
int i1, int j, int k,
int *n, double *dist)
{
coord p, q1, ns, ne, pend, in1center;
double dist2, radius1, r;
int e1, e2, k1, n2, in1;
t_site int1;
assert(InEdgesList(e));
assert(InPntsList(i1));
assert(InNodesList(k0));
assert(InNodesList(k));
assert(InArcsList(j));
assert( IsArcStartPnt(j, i1) || IsArcEndPnt(j, i1) );
k1 = GetOtherNode(e, k);
assert(InNodesList(k1));
//printf("FMRV-arc: e=%d, k0=%d, i1=%d, j=%d, k=%d, k1=%d\n",
// e, k0, i1, j, k, k1);
if (k1 == k0) {
/* */
/* returned to start or reached a dummy node: stop */
/* */
*dist = DBL_MAX;
*n = NIL;
return;
}
q1 = GetNodeCoord(k1);
if ( PntPntDist(q1, GetPntCoords(i1)) < ZERO ) {
/* */
/* node k1 coincides with point i1: keep on searching */
/* */
e1 = GetCCWEdge(e, k1);
e2 = GetCWEdge(e, k1);
FindMostViolatedRecursiveArc(e1, k0, i1, j, k1, n, dist);
if( e1 != e2) {
/* */
/* follow also second path away from point i1 */
/* */
FindMostViolatedRecursiveArc(e2, k0, i1, j, k1, &n2, &dist2);
if (dist2 < *dist) {
*n = n2;
*dist = dist2;
}
}
}
else {
/* */
/* the Voronoi edge e from k to k1 points away from point i1 */
/* */
GetNodeData(k1, &q1, &radius1);
ns = GetArcStartNormal(j);
ne = GetArcEndNormal(j);
p = GetArcCenter(j);
r = GetArcRadius(j);
//Get distance to arc
*dist = AbsPntArcDist(ns, ne, VecSub(q1,p), r, TINY) - radius1;
*n = k1;
//printf(" FMRV-arc: node %d has *dist=%e\n", *n, *dist);
if (eq(*dist, zero)) {
/* */
/* special case: k1 lies on common boundary of CI of two sites */
/* that share the same tangent line */
/* */
//printf(" FMVR-arc: Consider node %d, which is on CI-boundary (*dist=%e)\n", k1, *dist);
pend = IsArcStartPnt(j,i1) ? GetArcEndCoord(j) : GetArcStartCoord(j);
if (IsLftSite(e, i1, PNT))
GetRgtSiteData(e, &in1, &int1);
else
GetLftSiteData(e, &in1, &int1);
assert( int1==SEG || int1==ARC);
//printf(" other site 1: %d, %d\n", in1, int1);
if (!IsSameSide(in1, int1, j, i1, q1)) {
*dist = DBL_MAX;
*n = NIL;
return;
}
if (IsLftSite(e, in1, int1))
GetRgtSiteData(e, &in1, &int1);
else
GetLftSiteData(e, &in1, &int1);
/* */
/* This site could again be the point, but maybe another edge e2 */
/* points back to e1 and its opposite site has to be checked. */
/* */
if (int1 == PNT ) {
e2 = GetCCWEdge(e, k1);
if (!IsLftSite(e2, i1, PNT) && !IsRgtSite(e2, i1, PNT))
/* */
/* CCW-edge does not belong to point i1 --> set e2 to CW-edge */
/* */
e2 = GetCWEdge(e, k1);
if (IsLftSite(e2, i1, PNT) || IsRgtSite(e2, i1, PNT)) {
/* */
/* edge e2 belongs to point i1; select the opposite site */
/* */
if (IsLftSite(e2, i1, PNT) )
GetRgtSiteData(e, &in1, &int1);
else
GetLftSiteData(e, &in1, &int1);
}
}
if (int1 != PNT ) {
//printf(" other site 2: %d, %d\n", in1, int1);
if (!IsSameSide(in1, int1, j, i1, q1)) {
*dist = DBL_MAX;
*n = NIL;
return;
}
}
}
}
return;
}
void vroniObject::FindMostViolatedRecursiveArc(int e, int k0,
int i1, int j, int k,
int *n, double *dist)
{
// MODIF questa funzione non dovrebbe mai scorrere tutti i nodi, quindi se si entra nella ricorsione troppe volte
// viene lanciata eccezione
m_nMostViolatedRecursiveArcCount ++ ;
if ( m_nMostViolatedRecursiveArcCount > 2 * num_nodes)
throw std::runtime_error("VRONI error: ComputeVD() - FindMostViolatedRecursveArc infinite loop");
coord p, q1, ns, ne, pend, in1center;
double dist2, radius1, r;
int e1, e2, k1, n2, in1;
t_site int1;
assert(InEdgesList(e));
assert(InPntsList(i1));
assert(InNodesList(k0));
assert(InNodesList(k));
assert(InArcsList(j));
assert( IsArcStartPnt(j, i1) || IsArcEndPnt(j, i1) );
k1 = GetOtherNode(e, k);
assert(InNodesList(k1));
//printf("FMRV-arc: e=%d, k0=%d, i1=%d, j=%d, k=%d, k1=%d\n",
// e, k0, i1, j, k, k1);
if (k1 == k0) {
/* */
/* returned to start or reached a dummy node: stop */
/* */
*dist = DBL_MAX;
*n = NIL;
return;
}
q1 = GetNodeCoord(k1);
if ( PntPntDist(q1, GetPntCoords(i1)) < ZERO ) {
/* */
/* node k1 coincides with point i1: keep on searching */
/* */
e1 = GetCCWEdge(e, k1);
e2 = GetCWEdge(e, k1);
FindMostViolatedRecursiveArc(e1, k0, i1, j, k1, n, dist);
if( e1 != e2) {
/* */
/* follow also second path away from point i1 */
/* */
FindMostViolatedRecursiveArc(e2, k0, i1, j, k1, &n2, &dist2);
if (dist2 < *dist) {
*n = n2;
*dist = dist2;
}
}
}
else {
/* */
/* the Voronoi edge e from k to k1 points away from point i1 */
/* */
GetNodeData(k1, &q1, &radius1);
ns = GetArcStartNormal(j);
ne = GetArcEndNormal(j);
p = GetArcCenter(j);
r = GetArcRadius(j);
//Get distance to arc
*dist = AbsPntArcDist(ns, ne, VecSub(q1,p), r, TINY) - radius1;
*n = k1;
//printf(" FMRV-arc: node %d has *dist=%e\n", *n, *dist);
if (eq(*dist, zero)) {
/* */
/* special case: k1 lies on common boundary of CI of two sites */
/* that share the same tangent line */
/* */
//printf(" FMVR-arc: Consider node %d, which is on CI-boundary (*dist=%e)\n", k1, *dist);
pend = IsArcStartPnt(j,i1) ? GetArcEndCoord(j) : GetArcStartCoord(j);
if (IsLftSite(e, i1, PNT))
GetRgtSiteData(e, &in1, &int1);
else
GetLftSiteData(e, &in1, &int1);
assert( int1==SEG || int1==ARC);
//printf(" other site 1: %d, %d\n", in1, int1);
if (!IsSameSide(in1, int1, j, i1, q1)) {
*dist = DBL_MAX;
*n = NIL;
return;
}
if (IsLftSite(e, in1, int1))
GetRgtSiteData(e, &in1, &int1);
else
GetLftSiteData(e, &in1, &int1);
/* */
/* This site could again be the point, but maybe another edge e2 */
/* points back to e1 and its opposite site has to be checked. */
/* */
if (int1 == PNT ) {
e2 = GetCCWEdge(e, k1);
if (!IsLftSite(e2, i1, PNT) && !IsRgtSite(e2, i1, PNT))
/* */
/* CCW-edge does not belong to point i1 --> set e2 to CW-edge */
/* */
e2 = GetCWEdge(e, k1);
if (IsLftSite(e2, i1, PNT) || IsRgtSite(e2, i1, PNT)) {
/* */
/* edge e2 belongs to point i1; select the opposite site */
/* */
if (IsLftSite(e2, i1, PNT) )
GetRgtSiteData(e, &in1, &int1);
else
GetLftSiteData(e, &in1, &int1);
}
}
if (int1 != PNT ) {
//printf(" other site 2: %d, %d\n", in1, int1);
if (!IsSameSide(in1, int1, j, i1, q1)) {
*dist = DBL_MAX;
*n = NIL;
return;
}
}
}
}
return;
}
/* */
/* find the Voronoi node on the Voronoi boundary of the point pnts[i1] */
/* whose Voronoi disk is violated the most by the insertion of arcs[j]. */
/* note that pnts[i1] and pnts[i2] are the endpoints of arcs[j]. if */
/* the Voronoi cells of pnts[i1] and pnts[i2] share nodes then we take */
/* one of those nodes, and set node_shared = true. */
/* */
int vroniObject::FindMostViolatedNodeArc(int i1, int i2, int j,
vr_bool *node_shared)
{
int e, e1, e0, k, k_min = NIL, n, n1;
coord p, q, ns, ne;
double r, dist, dist1, dist_min, rad;
vr_bool shared, shared1;
#ifdef TRACE
vr_bool trace_mvna = true;
#endif
assert(InPntsList(i1));
assert(InPntsList(i2));
assert(InArcsList(j));
assert(IsArcStartPnt(j, i1) || IsArcEndPnt(j, i1));
assert(IsArcStartPnt(j, i2) || IsArcEndPnt(j, i2));
*node_shared = false;
/* */
/* we'll scan the Voronoi region of the point in order to find the */
/* node whose Voronoi disk is most violated by the insertion of the */
/* arc arcs[j]. */
/* */
e = GetVDPtr(i1, PNT);
assert(InEdgesList(e));
assert(IsLftSite(e, i1, PNT) || IsRgtSite(e, i1, PNT));
ns = GetArcStartNormal(j);
ne = GetArcEndNormal(j);
p = GetArcCenter(j);
r = GetArcRadius(j);
#ifdef TRACE
if (trace_mvna) {
printf("FindMostViolatedNodeArc() -\n");
printf("center p: (%20.16f, %20.16f)\n", p.x, p.y);
printf("radius r: %20.16f\n", r);
printf("ns: (%20.16f, %20.16f)\n", ns.x, ns.y);
printf("ne: (%20.16f, %20.16f)\n", ne.x, ne.y);
}
#endif
if (IsRgtSite(e, i1, PNT)) k = GetEndNode(e);
else k = GetStartNode(e);
assert(InNodesList(k));
e0 = e;
dist_min = LARGE;
*node_shared = false;
shared = IsLftRgtSite(e, i1, PNT) && IsLftRgtSite(e, i2, PNT);
#ifdef TRACE
if (trace_mvna)
printf("i1 = %d, i2 = %d, j = %d\n", i1, i2, j);
#endif
do {
e1 = GetCCWEdge(e, k);
shared1 = IsLftRgtSite(e1, i1, PNT) && IsLftRgtSite(e1, i2, PNT);
shared = shared || shared1;
#ifdef TRACE
if (trace_mvna) PrintNodeData(k, "checked");
#endif
/* */
/* check whether q is in the cone of influence of arcs[j]. */
/* */
if (GetNodeSite(k) != i1) {
GetNodeData(k, &q, &rad);
q = VecSub(q, p);
dist = AbsPntArcDist(ns, ne, q, r, TINY) - rad;
if (*node_shared && shared && (dist < dist_min)) {
#ifdef TRACE
if (trace_mvna) {
printf("node %d accepted (shared)\n", k);
printf("old distance: %f, new distance: %f\n",
dist_min, dist);
PrintNodeData(k, "FindMostViolatedArc");
}
#endif
dist_min = dist;
k_min = k;
}
else if (dist < dist_min) {
#ifdef TRACE
if (trace_mvna) {
if (shared) printf("node %d accepted (shared)\n", k);
else printf("node %d accepted\n", k);
printf("old distance: %20.16f\nnew distance: %20.16f\n",
dist_min, dist);
PrintNodeData(k, "FindMostViolatedArc");
}
#endif
dist_min = dist;
k_min = k;
if (shared) *node_shared = true;
}
}
e = e1;
k = GetOtherNode(e, k);
shared = shared1;
} while (e != e0);
if (((k_min == NIL) || (ge(dist_min, ZERO))) && HasIncidentSite(i1)) {
/* */
/* at least one seg or arc is already incident at this point. */
/* */
*node_shared = false;
k = GetPntNode(i1);
assert(InNodesList(k));
e = GetIncidentEdge(k);
assert(InEdgesList(e));
//Restore data for calls coming now...
k = GetPntNode(i1);
e = GetIncidentEdge(k);
e1 = GetCCWEdge(e, k);
FindMostViolatedRecursiveArc(e, k, i1, j, k, &n, &dist);
FindMostViolatedRecursiveArc(e1, k, i1, j, k, &n1, &dist1);
if (dist < dist1) k_min = n;
else k_min = n1;
#ifdef TRACE
if (trace_mvna) {
printf("node %d accepted\n", k_min);
printf("old distance: %20.16f, new distance: %20.16f\n",
dist_min, Min(dist, dist1));
PrintNodeData(k_min, "FindMostViolatedArc");
}
#endif
}
return k_min;
}
/* */
/* find the Voronoi node on the Voronoi boundary of the point pnts[i1] */
/* whose Voronoi disk is violated the most by the insertion of arcs[j]. */
/* note that pnts[i1] and pnts[i2] are the endpoints of arcs[j]. if */
/* the Voronoi cells of pnts[i1] and pnts[i2] share nodes then we take */
/* one of those nodes, and set node_shared = true. */
/* */
int vroniObject::FindMostViolatedNodeArc(int i1, int i2, int j,
vr_bool *node_shared)
{
int e, e1, e0, k, k_min = NIL, n, n1;
coord p, q, ns, ne;
double r, dist, dist1, dist_min, rad;
vr_bool shared, shared1;
#ifdef TRACE
vr_bool trace_mvna = true;
#endif
assert(InPntsList(i1));
assert(InPntsList(i2));
assert(InArcsList(j));
assert(IsArcStartPnt(j, i1) || IsArcEndPnt(j, i1));
assert(IsArcStartPnt(j, i2) || IsArcEndPnt(j, i2));
*node_shared = false;
/* */
/* we'll scan the Voronoi region of the point in order to find the */
/* node whose Voronoi disk is most violated by the insertion of the */
/* arc arcs[j]. */
/* */
e = GetVDPtr(i1, PNT);
assert(InEdgesList(e));
assert(IsLftSite(e, i1, PNT) || IsRgtSite(e, i1, PNT));
ns = GetArcStartNormal(j);
ne = GetArcEndNormal(j);
p = GetArcCenter(j);
r = GetArcRadius(j);
#ifdef TRACE
if (trace_mvna) {
printf("FindMostViolatedNodeArc() -\n");
printf("center p: (%20.16f, %20.16f)\n", p.x, p.y);
printf("radius r: %20.16f\n", r);
printf("ns: (%20.16f, %20.16f)\n", ns.x, ns.y);
printf("ne: (%20.16f, %20.16f)\n", ne.x, ne.y);
}
#endif
if (IsRgtSite(e, i1, PNT)) k = GetEndNode(e);
else k = GetStartNode(e);
assert(InNodesList(k));
e0 = e;
dist_min = LARGE;
*node_shared = false;
shared = IsLftRgtSite(e, i1, PNT) && IsLftRgtSite(e, i2, PNT);
#ifdef TRACE
if (trace_mvna)
printf("i1 = %d, i2 = %d, j = %d\n", i1, i2, j);
#endif
do {
e1 = GetCCWEdge(e, k);
shared1 = IsLftRgtSite(e1, i1, PNT) && IsLftRgtSite(e1, i2, PNT);
shared = shared || shared1;
#ifdef TRACE
if (trace_mvna) PrintNodeData(k, "checked");
#endif
/* */
/* check whether q is in the cone of influence of arcs[j]. */
/* */
if (GetNodeSite(k) != i1) {
GetNodeData(k, &q, &rad);
q = VecSub(q, p);
dist = AbsPntArcDist(ns, ne, q, r, TINY) - rad;
if (*node_shared && shared && (dist < dist_min)) {
#ifdef TRACE
if (trace_mvna) {
printf("node %d accepted (shared)\n", k);
printf("old distance: %f, new distance: %f\n",
dist_min, dist);
PrintNodeData(k, "FindMostViolatedArc");
}
#endif
dist_min = dist;
k_min = k;
}
else if (dist < dist_min) {
#ifdef TRACE
if (trace_mvna) {
if (shared) printf("node %d accepted (shared)\n", k);
else printf("node %d accepted\n", k);
printf("old distance: %20.16f\nnew distance: %20.16f\n",
dist_min, dist);
PrintNodeData(k, "FindMostViolatedArc");
}
#endif
dist_min = dist;
k_min = k;
if (shared) *node_shared = true;
}
}
e = e1;
k = GetOtherNode(e, k);
shared = shared1;
} while (e != e0);
if (((k_min == NIL) || (ge(dist_min, ZERO))) && HasIncidentSite(i1)) {
/* */
/* at least one seg or arc is already incident at this point. */
/* */
*node_shared = false;
k = GetPntNode(i1);
assert(InNodesList(k));
e = GetIncidentEdge(k);
assert(InEdgesList(e));
//Restore data for calls coming now...
k = GetPntNode(i1);
e = GetIncidentEdge(k);
e1 = GetCCWEdge(e, k);
m_nMostViolatedRecursiveArcCount = 0 ; // MODIF azzero il contatore per la nuova chiamata
FindMostViolatedRecursiveArc(e, k, i1, j, k, &n, &dist);
m_nMostViolatedRecursiveArcCount = 0 ; // MODIF azzero il contatore per la nuova chiamata
FindMostViolatedRecursiveArc(e1, k, i1, j, k, &n1, &dist1);
if (dist < dist1) k_min = n;
else k_min = n1;
#ifdef TRACE
if (trace_mvna) {
printf("node %d accepted\n", k_min);
printf("old distance: %20.16f, new distance: %20.16f\n",
dist_min, Min(dist, dist1));
PrintNodeData(k_min, "FindMostViolatedArc");
}
#endif
}
return k_min;
}
/* */
+84 -34
View File
@@ -7,6 +7,7 @@
#include "vroni_object.h"
#include "offset.h"
#include <fstream>
//----------------------------------------------------------------------------
void
@@ -340,47 +341,96 @@ vroniObject::IsWMATEdge( int nEdge)
return edges[nEdge].w_mat.in_w_mat ;
}
//----------------------------------------------------------------------------
const char*
vroniObject::GetExceptionMessage()
{
try {
throw ;
}
catch ( const std::runtime_error& VRONIerror) {
return VRONIerror.what() ;
}
catch (const std::exception& VRONIerror) {
return VRONIerror.what() ;
}
catch ( ... ) {
return "VRONI error: unknown type of error" ;
}
return "" ;
}
//----------------------------------------------------------------------------
void
vroniObject::MyWriteVoronoiRegion( FILE *output)
vroniObject::MyWriteVoronoiDiagram()
{
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
}
std::ofstream myfile ;
myfile.open( "C:\\EgtData\\Varie\\Test.lua") ; // percorso del file
// 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)) ;
}
// versione per scrivere i dati del diagramma su un file di testo
// myfile << " EDGES DATA" << std::endl ;
// for ( int i = 0 ; i < num_edges ; i ++) {
// myfile << "Voronoi edge " << i << std::endl ;
// myfile << " n1 = " << edges[i].n1 << std::endl ;
// myfile << " n2 = " << edges[i].n2 << std::endl ;
// myfile << " lft = " << edges[i].lft << std::endl ;
// myfile << " rgt = " << edges[i].rgt << std::endl ;
// myfile << " lft type = " << edges[i].ltype << std::endl ;
// myfile << " rgt type = " << edges[i].rtype << std::endl ;
// myfile << " s_ccw = " << edges[i].s_ccw << std::endl ;
// myfile << " s_cw = " << edges[i].s_cw << std::endl ;
// myfile << " e_ccw = " << edges[i].e_ccw << std::endl ;
// myfile << " e_cw = " << edges[i].e_cw << std::endl ;
// if (IsWmatEdge(i)) {
// myfile << " wmat =" << edges[i].w_mat.in_w_mat << std::endl ;
// // solo con Wmat
// // myfile << " wmat rmin = " << UnscaleV( edges[i].w_mat.r_min) ;
// // myfile << " wmat rmax = " << UnscaleV( edges[i].w_mat.r_max) ;
// }
// myfile.flush() ;
// }
//
// myfile << std::endl << std::endl ;
// myfile << "NODES DATA" << std::endl ;
// for ( int i = 0 ; i < num_nodes ; i ++) {
// myfile << "Voronoi node " << i << std::endl ;
// auto p = GetNodeCoord(i) ;
// myfile << " pt = " << UnscaleX(p.x) << ", " << UnscaleY(p.y) << std::endl ;
// myfile << " r2 = " << UnscaleV( nodes[i].r2) << std::endl ;
// myfile << " deg2 = " << nodes[i].deg2 << std::endl ;
// myfile << " edge = " << nodes[i].edge << std::endl ;
// myfile << " site = " << nodes[i].site << std::endl ;
// }
fprintf(output, "\n\nNODES DATA\n\n") ;
// versione per scrivere un file lua
// N.B. i lati vengono rappresentati tutti con delle linee solo per avere le relazioni tra i nodi, non sono
// rappresentativi dei veri lati del diagramma (parabole, ellissi, ...)
//
myfile << "-- Nodes " << num_nodes << std::endl ;
myfile << "-- Edges " << num_edges << std::endl ;
myfile << "local nId" << std::endl ;
myfile << "local nGrp1 = EgtGroup( GDB_ID.ROOT)" << std::endl ;
myfile << "local nGrp2 = EgtGroup( GDB_ID.ROOT)" << std::endl ;
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) ;
double x1 = UnscaleX( nodes[i].p.x) ;
double y1 = UnscaleY( nodes[i].p.y) ;
myfile << "nId = EgtPoint( nGrp1, Point3d( " << x1 << ", " << y1 << ", 0))" << std::endl ;
myfile << "EgtSetName( nId or GDB_ID.NULL, 'Node" << i << "')" << std::endl ;
myfile.flush() ;
}
for ( int i = 0 ; i < num_edges ; i ++) {
double x1 = UnscaleX( nodes[edges[i].n1].p.x) ;
double y1 = UnscaleY( nodes[edges[i].n1].p.y) ;
double x2 = UnscaleX( nodes[edges[i].n2].p.x) ;
double y2 = UnscaleY( nodes[edges[i].n2].p.y) ;
myfile << "nId = EgtLine( nGrp2, Point3d( " << x1 << ", " << y1 << ", 0), Point3d( " << x2 << ", " << y2 << ", 0))" << std::endl ;
myfile << "EgtSetName( nId or GDB_ID.NULL, 'Edge" << i << "')" << std::endl ;
myfile.flush() ;
}
myfile.close() ;
return ;
}