Correctly draw vector text for constraints free in 3d.

This commit is contained in:
whitequark 2016-08-13 10:48:48 +00:00
parent efd358d734
commit 4c30c09792
7 changed files with 350 additions and 3 deletions

View File

@ -437,7 +437,7 @@ void Constraint::DoArcForAngle(Canvas *canvas, Canvas::hStroke hcs,
Vector trans =
(*ref).Plus(gu.ScaledBy(-1.5*VectorFont::Builtin()->GetCapHeight(textHeight)));
canvas->DrawVectorText("angle between skew lines", textHeight,
trans, gr.WithMagnitude(pixels), gu.WithMagnitude(pixels),
trans, gr.WithMagnitude(1), gu.WithMagnitude(1),
hcs);
}
}
@ -925,7 +925,8 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
}
Vector ex = VectorFont::Builtin()->GetExtents(textHeight, "T");
canvas->DrawVectorText("T", textHeight, textAt.Minus(ex.ScaledBy(0.5)), u, v, hcs);
canvas->DrawVectorText("T", textHeight, textAt.Minus(ex.ScaledBy(0.5)),
u.WithMagnitude(1), v.WithMagnitude(1), hcs);
if(refs) refs->push_back(textAt);
return;
}
@ -1122,7 +1123,8 @@ s:
}
Vector o = m.Plus(offset).Plus(u.WithMagnitude(textHeight/5)),
ex = VectorFont::Builtin()->GetExtents(textHeight, s);
canvas->DrawVectorText(s, textHeight, o.Minus(ex.ScaledBy(0.5)), r, u, hcs);
canvas->DrawVectorText(s, textHeight, o.Minus(ex.ScaledBy(0.5)),
r.WithMagnitude(1), u.WithMagnitude(1), hcs);
if(refs) refs->push_back(o);
} else {
Vector a = SK.GetEntity(ptA)->PointGetNum();

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -0,0 +1,340 @@
±²³SolveSpaceREVa
Group.h.v=00000001
Group.type=5000
Group.name=#references
Group.color=ff000000
Group.skipFirst=0
Group.predef.swapUV=0
Group.predef.negateU=0
Group.predef.negateV=0
Group.visible=1
Group.suppress=0
Group.relaxConstraints=0
Group.allowRedundant=0
Group.allDimsReference=0
Group.remap={
}
AddGroup
Group.h.v=00000002
Group.type=5001
Group.order=1
Group.name=sketch-in-plane
Group.activeWorkplane.v=80020000
Group.color=ff000000
Group.subtype=6000
Group.skipFirst=0
Group.predef.q.w=1.00000000000000000000
Group.predef.origin.v=00010001
Group.predef.swapUV=0
Group.predef.negateU=0
Group.predef.negateV=0
Group.visible=1
Group.suppress=0
Group.relaxConstraints=0
Group.allowRedundant=0
Group.allDimsReference=0
Group.remap={
}
AddGroup
Param.h.v.=00010010
AddParam
Param.h.v.=00010011
AddParam
Param.h.v.=00010012
AddParam
Param.h.v.=00010020
Param.val=1.00000000000000000000
AddParam
Param.h.v.=00010021
AddParam
Param.h.v.=00010022
AddParam
Param.h.v.=00010023
AddParam
Param.h.v.=00020010
AddParam
Param.h.v.=00020011
AddParam
Param.h.v.=00020012
AddParam
Param.h.v.=00020020
Param.val=0.50000000000000000000
AddParam
Param.h.v.=00020021
Param.val=0.50000000000000000000
AddParam
Param.h.v.=00020022
Param.val=0.50000000000000000000
AddParam
Param.h.v.=00020023
Param.val=0.50000000000000000000
AddParam
Param.h.v.=00030010
AddParam
Param.h.v.=00030011
AddParam
Param.h.v.=00030012
AddParam
Param.h.v.=00030020
Param.val=0.50000000000000000000
AddParam
Param.h.v.=00030021
Param.val=-0.50000000000000000000
AddParam
Param.h.v.=00030022
Param.val=-0.50000000000000000000
AddParam
Param.h.v.=00030023
Param.val=-0.50000000000000000000
AddParam
Param.h.v.=00040010
Param.val=-5.00000000000000000000
AddParam
Param.h.v.=00040011
Param.val=10.00000000000000000000
AddParam
Param.h.v.=00040013
Param.val=5.00000000000000000000
AddParam
Param.h.v.=00040014
Param.val=10.00000000000000000000
AddParam
Param.h.v.=00050010
Param.val=-5.00000000000000000000
AddParam
Param.h.v.=00050011
Param.val=5.00000000000000000000
AddParam
Param.h.v.=00050013
Param.val=5.00000000000000000000
AddParam
Param.h.v.=00050014
Param.val=5.00000000000000000000
AddParam
Request.h.v=00000001
Request.type=100
Request.group.v=00000001
Request.construction=0
AddRequest
Request.h.v=00000002
Request.type=100
Request.group.v=00000001
Request.construction=0
AddRequest
Request.h.v=00000003
Request.type=100
Request.group.v=00000001
Request.construction=0
AddRequest
Request.h.v=00000004
Request.type=200
Request.workplane.v=80020000
Request.group.v=00000002
Request.construction=0
AddRequest
Request.h.v=00000005
Request.type=200
Request.workplane.v=00020000
Request.group.v=00000002
Request.construction=0
AddRequest
Entity.h.v=00010000
Entity.type=10000
Entity.construction=0
Entity.point[0].v=00010001
Entity.normal.v=00010020
Entity.actVisible=1
AddEntity
Entity.h.v=00010001
Entity.type=2000
Entity.construction=0
Entity.actVisible=1
AddEntity
Entity.h.v=00010020
Entity.type=3000
Entity.construction=0
Entity.point[0].v=00010001
Entity.actNormal.w=1.00000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=00020000
Entity.type=10000
Entity.construction=0
Entity.point[0].v=00020001
Entity.normal.v=00020020
Entity.actVisible=1
AddEntity
Entity.h.v=00020001
Entity.type=2000
Entity.construction=0
Entity.actVisible=1
AddEntity
Entity.h.v=00020020
Entity.type=3000
Entity.construction=0
Entity.point[0].v=00020001
Entity.actNormal.w=0.50000000000000000000
Entity.actNormal.vx=0.50000000000000000000
Entity.actNormal.vy=0.50000000000000000000
Entity.actNormal.vz=0.50000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=00030000
Entity.type=10000
Entity.construction=0
Entity.point[0].v=00030001
Entity.normal.v=00030020
Entity.actVisible=1
AddEntity
Entity.h.v=00030001
Entity.type=2000
Entity.construction=0
Entity.actVisible=1
AddEntity
Entity.h.v=00030020
Entity.type=3000
Entity.construction=0
Entity.point[0].v=00030001
Entity.actNormal.w=0.50000000000000000000
Entity.actNormal.vx=-0.50000000000000000000
Entity.actNormal.vy=-0.50000000000000000000
Entity.actNormal.vz=-0.50000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=00040000
Entity.type=11000
Entity.construction=0
Entity.point[0].v=00040001
Entity.point[1].v=00040002
Entity.workplane.v=80020000
Entity.actVisible=1
AddEntity
Entity.h.v=00040001
Entity.type=2001
Entity.construction=0
Entity.workplane.v=80020000
Entity.actPoint.x=-5.00000000000000000000
Entity.actPoint.y=10.00000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=00040002
Entity.type=2001
Entity.construction=0
Entity.workplane.v=80020000
Entity.actPoint.x=5.00000000000000000000
Entity.actPoint.y=10.00000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=00050000
Entity.type=11000
Entity.construction=0
Entity.point[0].v=00050001
Entity.point[1].v=00050002
Entity.workplane.v=00020000
Entity.actVisible=1
AddEntity
Entity.h.v=00050001
Entity.type=2001
Entity.construction=0
Entity.workplane.v=00020000
Entity.actPoint.y=-5.00000000000000000000
Entity.actPoint.z=5.00000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=00050002
Entity.type=2001
Entity.construction=0
Entity.workplane.v=00020000
Entity.actPoint.y=5.00000000000000000000
Entity.actPoint.z=5.00000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=80020000
Entity.type=10000
Entity.construction=0
Entity.point[0].v=80020002
Entity.normal.v=80020001
Entity.actVisible=1
AddEntity
Entity.h.v=80020001
Entity.type=3010
Entity.construction=0
Entity.point[0].v=80020002
Entity.actNormal.w=1.00000000000000000000
Entity.actVisible=1
AddEntity
Entity.h.v=80020002
Entity.type=2012
Entity.construction=0
Entity.actVisible=1
AddEntity
Constraint.h.v=00000001
Constraint.type=120
Constraint.group.v=00000002
Constraint.valA=90.00000000000000000000
Constraint.entityA.v=00050000
Constraint.entityB.v=00040000
Constraint.other=0
Constraint.other2=0
Constraint.reference=0
Constraint.disp.offset.x=2.50000000000000044409
Constraint.disp.offset.y=-2.50000000000000000000
Constraint.disp.offset.z=-2.50000000000000000000
AddConstraint

View File

@ -47,3 +47,8 @@ TEST_CASE(reference_free_in_3d_migrate_from_v20) {
CHECK_RENDER("reference_free_in_3d.png");
CHECK_SAVE("reference_free_in_3d.slvs");
}
TEST_CASE(skew_render) {
CHECK_LOAD("skew.slvs");
CHECK_RENDER("skew.png");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB