Last active
August 3, 2018 19:50
-
-
Save wware/875998248c23ebd86668fd5c354ec737 to your computer and use it in GitHub Desktop.
OpenSCAD code to create a cylinder connecting two given points in 3-space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v1 = [0, 2, -1]; | |
v2 = [1, 3, 3]; | |
y = [v2[0] - v1[0], v2[1] - v1[1], v2[2] - v1[2]]; | |
translate(v1) | |
rotate(-acos(y[2] / norm(y)), cross(y, [0, 0, 1])) | |
cylinder(h=norm(y), d=0.1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment