Highlight normals and circle radii that have a degree of freedom.

This commit is contained in:
whitequark 2017-02-17 03:18:34 +00:00
parent 3bcc376224
commit dea573e156
11 changed files with 59 additions and 2 deletions

2
.gitignore vendored
View File

@ -12,4 +12,4 @@
/debian/libslvs1/
/debian/libslvs1-dev/
/obj-*/
*.slvs
/*.slvs

View File

@ -601,6 +601,20 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
Vector axis = q.RotationV();
canvas->DrawLine(tip, tip.Minus(v.RotatedAbout(axis, 0.6)), hcs);
canvas->DrawLine(tip, tip.Minus(v.RotatedAbout(axis, -0.6)), hcs);
if(type == Type::NORMAL_IN_3D) {
Param *nw = SK.GetParam(param[0]),
*nx = SK.GetParam(param[1]),
*ny = SK.GetParam(param[2]),
*nz = SK.GetParam(param[3]);
if(nw->free || nx->free || ny->free || nz->free) {
Canvas::Stroke analyzeStroke = Style::Stroke(Style::ANALYZE);
analyzeStroke.layer = Canvas::Layer::FRONT;
Canvas::hStroke hcsAnalyze = canvas->GetStroke(analyzeStroke);
canvas->DrawLine(tail, tip, hcsAnalyze);
}
}
}
return;
}
@ -665,6 +679,20 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
if(!canvas->DrawBeziers(*GetOrGenerateBezierCurves(), hcs)) {
canvas->DrawEdges(*GetOrGenerateEdges(), hcs);
}
if(type == Type::CIRCLE) {
Entity *dist = SK.GetEntity(distance);
if(dist->type == Type::DISTANCE) {
Param *p = SK.GetParam(dist->param[0]);
if(p->free) {
Canvas::Stroke analyzeStroke = Style::Stroke(Style::ANALYZE);
analyzeStroke.layer = Canvas::Layer::FRONT;
Canvas::hStroke hcsAnalyze = canvas->GetStroke(analyzeStroke);
if(!canvas->DrawBeziers(*GetOrGenerateBezierCurves(), hcsAnalyze)) {
canvas->DrawEdges(*GetOrGenerateEdges(), hcsAnalyze);
}
}
}
}
return;
}

View File

@ -789,6 +789,7 @@ void GraphicsWindow::MenuEdit(Command id) {
SS.exportMode = false;
SS.GenerateAll(SolveSpaceUI::Generate::ALL);
}
SS.GW.persistentDirty = true;
break;
case Command::SELECT_ALL: {

View File

@ -18,7 +18,7 @@ const Style::Default Style::Defaults[] = {
{ { HOVERED }, "Hovered", RGBf(1.0, 1.0, 0.0), 1.5, 0 },
{ { CONTOUR_FILL }, "ContourFill", RGBf(0.0, 0.1, 0.1), 1.0, 0 },
{ { NORMALS }, "Normals", RGBf(0.0, 0.4, 0.4), 1.0, 0 },
{ { ANALYZE }, "Analyze", RGBf(0.0, 1.0, 1.0), 1.0, 0 },
{ { ANALYZE }, "Analyze", RGBf(0.0, 1.0, 1.0), 3.0, 0 },
{ { DRAW_ERROR }, "DrawError", RGBf(1.0, 0.0, 0.0), 8.0, 0 },
{ { DIM_SOLID }, "DimSolid", RGBf(0.1, 0.1, 0.1), 1.0, 0 },
{ { HIDDEN_EDGE }, "HiddenEdge", RGBf(0.8, 0.8, 0.8), 1.0, 1 },

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -15,3 +15,31 @@ TEST_CASE(normal_migrate_from_v22) {
CHECK_LOAD("normal_v22.slvs");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(free_in_3d_roundtrip) {
CHECK_LOAD("free_in_3d.slvs");
CHECK_RENDER("free_in_3d.png");
CHECK_SAVE("free_in_3d.slvs");
}
TEST_CASE(free_in_3d_migrate_from_v20) {
CHECK_LOAD("free_in_3d_v20.slvs");
CHECK_SAVE("free_in_3d.slvs");
}
TEST_CASE(free_in_3d_migrate_from_v22) {
CHECK_LOAD("free_in_3d_v22.slvs");
CHECK_SAVE("free_in_3d.slvs");
}
TEST_CASE(normal_dof) {
CHECK_LOAD("normal.slvs");
SS.GenerateAll(SolveSpaceUI::Generate::ALL, /*andFindFree=*/true);
CHECK_RENDER("normal_dof.png");
}
TEST_CASE(free_in_3d_dof) {
CHECK_LOAD("free_in_3d.slvs");
SS.GenerateAll(SolveSpaceUI::Generate::ALL, /*andFindFree=*/true);
CHECK_RENDER_ISO("free_in_3d_dof.png");
}