From 3e86050685e712aa777fc945fc06aa74dfd5a460 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sun, 7 Jun 2009 15:00:57 -0800 Subject: [PATCH] Report the number of triangles and surfaces in the naked edges check, hide the coordinate axes at the origin when normals are hidden (but still show the coordinate axes at the bottom left of the screen), and report point-line distance when a point and a line are selected. [git-p4: depot-paths = "//depot/solvespace/": change = 1973] --- drawentity.cpp | 7 +++++++ solvespace.cpp | 16 +++++++++++----- textwin.cpp | 11 +++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/drawentity.cpp b/drawentity.cpp index 88a3ae7..cc8f9be 100644 --- a/drawentity.cpp +++ b/drawentity.cpp @@ -348,6 +348,13 @@ void Entity::DrawOrGetDistance(void) { case NORMAL_IN_2D: { int i; for(i = 0; i < 2; i++) { + if(i == 0 && !SS.GW.showNormals) { + // When the normals are hidden, we will continue to show + // the coordinate axes at the bottom left corner, but + // not at the origin. + continue; + } + hRequest hr = h.request(); double f = (i == 0 ? 0.4 : 1); if(hr.v == Request::HREQUEST_REFERENCE_XY.v) { diff --git a/solvespace.cpp b/solvespace.cpp index c34c67b..0d9b995 100644 --- a/solvespace.cpp +++ b/solvespace.cpp @@ -426,7 +426,8 @@ void SolveSpace::MenuAnalyze(int id) { case GraphicsWindow::MNU_NAKED_EDGES: { SS.nakedEdges.Clear(); - SMesh *m = &(SK.GetGroup(SS.GW.activeGroup)->displayMesh); + Group *g = SK.GetGroup(SS.GW.activeGroup); + SMesh *m = &(g->displayMesh); SKdNode *root = SKdNode::From(m); bool inters, leaks; root->MakeCertainEdgesInto(&(SS.nakedEdges), @@ -441,12 +442,17 @@ void SolveSpace::MenuAnalyze(int id) { "The mesh has naked edges (NOT okay, invalid)." : "The mesh is watertight (okay, valid)."; + char cntMsg[1024]; + sprintf(cntMsg, "\r\n\r\nThe model contains %d triangles, from " + "%d surfaces.", + g->displayMesh.l.n, g->runningShell.surface.n); + if(SS.nakedEdges.l.n == 0) { - Message("%s\r\n\r\n%s\r\n\r\nZero problematic edges, good.", - intersMsg, leaksMsg); + Message("%s\r\n\r\n%s\r\n\r\nZero problematic edges, good.%s", + intersMsg, leaksMsg, cntMsg); } else { - Error("%s\r\n\r\n%s\r\n\r\n%d problematic edges, bad.", - intersMsg, leaksMsg, SS.nakedEdges.l.n); + Error("%s\r\n\r\n%s\r\n\r\n%d problematic edges, bad.%s", + intersMsg, leaksMsg, SS.nakedEdges.l.n, cntMsg); } break; } diff --git a/textwin.cpp b/textwin.cpp index 282998e..bee48e9 100644 --- a/textwin.cpp +++ b/textwin.cpp @@ -441,6 +441,17 @@ void TextWindow::DescribeSelection(void) { Printf(true, " vector = " PT_AS_NUM, CO(v)); double d = (p1.Minus(p0)).Dot(v); Printf(true, " proj_d = %Fi%s", SS.MmToString(d)); + } else if(gs.n == 2 && gs.lineSegments == 1 && gs.points == 1) { + Entity *ln = SK.GetEntity(gs.entity[0]); + Vector lp0 = SK.GetEntity(ln->point[0])->PointGetNum(), + lp1 = SK.GetEntity(ln->point[1])->PointGetNum(); + Printf(false, "%FtLINE SEGMENT AND POINT%E"); + Printf(true, " ln thru " PT_AS_STR, COSTR(lp0)); + Printf(false, " " PT_AS_STR, COSTR(lp1)); + Vector pp = SK.GetEntity(gs.point[0])->PointGetNum(); + Printf(true, " point " PT_AS_STR, COSTR(pp)); + Printf(true, " pt-ln distance = %Fi%s%E", + SS.MmToString(pp.DistanceToLine(lp0, lp1.Minus(lp0)))); } else if(gs.n == 2 && gs.faces == 2) { Printf(false, "%FtTWO PLANE FACES");