Skip to content

Instantly share code, notes, and snippets.

@tlfrd
Last active December 24, 2017 00:12
Show Gist options
  • Select an option

  • Save tlfrd/0f646e4a6c7da975e63f805d8f43a40b to your computer and use it in GitHub Desktop.

Select an option

Save tlfrd/0f646e4a6c7da975e63f805d8f43a40b to your computer and use it in GitHub Desktop.
Cut Out Tabs
license: mit

A function to draw flaps for a cut out and fold model.

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
var lineCoordinates = [[200, 200],[400, 300]];
var svg = d3.select("body").append("svg")
.attr("width", 960)
.attr("height", 500);
var line = svg.append("line")
.attr("x1", lineCoordinates[0][0])
.attr("y1", lineCoordinates[0][1])
.attr("x2", lineCoordinates[1][0])
.attr("y2", lineCoordinates[1][1])
.style("stroke", "black");
function generateCutOutFlap(line, distance, direction) {
}
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment