Skip to content

Commit

Permalink
fixed angle labeling in 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
jemmybutton committed Oct 4, 2023
1 parent 121c074 commit 300cad6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container: texlive/texlive
steps:
- uses: actions/checkout@v3
Expand Down
10 changes: 9 additions & 1 deletion byrne.mp
Original file line number Diff line number Diff line change
Expand Up @@ -3201,10 +3201,18 @@ vardef byNamedAngleSidesFull (text anglesList)(text linesList)=
enddef;

vardef byLabelAngleSide(suffix centerPoint, targetPoint) =
save labelVector;
pair labelVector;
image(
if (textLabels):
if (attributeExists("point", "XYZ", str centerPoint)
and attributeExists("point", "XYZ", str targetPoint)):
labelVector := projectPointIfInSpace(unitvectorXYZ(pointXYZ.targetPoint - pointXYZ.centerPoint));
else:
labelVector := unitvector(targetPoint-centerPoint);
fi;
draw byTextLabel(pointLabel)(str targetPoint,
centerPoint + (unitvector(targetPoint-centerPoint)*1/2angleSize*angleScale)/scaleFactor, angle(targetPoint - centerPoint), textLabelShift);
centerPoint + (labelVector*1/2angleSize*angleScale)/scaleFactor, angle(targetPoint - centerPoint), textLabelShift);
fi;
)
enddef;
Expand Down

0 comments on commit 300cad6

Please sign in to comment.