diff --git a/draw.cpp b/draw.cpp index 5c67548..c699a8f 100644 --- a/draw.cpp +++ b/draw.cpp @@ -405,14 +405,17 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { SS.GetParam(hr.param(0))->val = 0; break; - case MNU_ARC: + case MNU_ARC: { if(!SS.GW.LockedInWorkplane()) { Error("Can't draw arc in 3d; select a workplane first."); ClearPending(); break; } hr = AddRequest(Request::ARC_OF_CIRCLE); - SS.GetEntity(hr.entity(1))->PointForceTo(v); + // This fudge factor stops us from immediately failing to solve + // because of the arc's implicit (equal radius) tangent. + Vector adj = SS.GW.projRight.WithMagnitude(2/SS.GW.scale); + SS.GetEntity(hr.entity(1))->PointForceTo(v.Minus(adj)); SS.GetEntity(hr.entity(2))->PointForceTo(v); SS.GetEntity(hr.entity(3))->PointForceTo(v); ConstrainPointByHovered(hr.entity(2)); @@ -423,7 +426,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) { pending.point = hr.entity(3); pending.description = "click to place point"; break; - + } case MNU_CUBIC: hr = AddRequest(Request::CUBIC); SS.GetEntity(hr.entity(1))->PointForceTo(v); diff --git a/polygon.h b/polygon.h index 281bf23..b057e9f 100644 --- a/polygon.h +++ b/polygon.h @@ -221,9 +221,9 @@ public: class SKdTree { public: - static const int BY_X = 1; - static const int BY_Y = 2; - static const int BY_Z = 3; + static const int BY_X = 0; + static const int BY_Y = 1; + static const int BY_Z = 2; int which; double c; diff --git a/win32/w32main.cpp b/win32/w32main.cpp index 5ff0208..21344c6 100644 --- a/win32/w32main.cpp +++ b/win32/w32main.cpp @@ -923,8 +923,23 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, // Create the heap that we use to store Exprs and other temp stuff. FreeAllTemporary(); + // A filename may have been specified on the command line; if so, then + // strip any quotation marks, and make it absolute. + char file[MAX_PATH] = ""; + if(strlen(lpCmdLine)+1 < MAX_PATH) { + char *s = lpCmdLine; + while(*s == ' ' || *s == '"') s++; + strcpy(file, s); + s = strrchr(file, '"'); + if(s) *s = '\0'; + } + char absoluteFile[MAX_PATH] = ""; + if(*file != '\0') { + GetFullPathName(file, sizeof(absoluteFile), absoluteFile, NULL); + } + // Call in to the platform-independent code, and let them do their init - SS.Init(lpCmdLine); + SS.Init(absoluteFile); ShowWindow(TextWnd, SW_SHOWNOACTIVATE); ShowWindow(GraphicsWnd, SW_SHOW);