package OSCADml
OCaml DSL for 3D solid modelling in OpenSCAD
Install
Dune Dependency
Authors
Maintainers
Sources
OSCADml-0.2.2.tbz
sha256=8c0eeb5055dd16bb0f9b25b4d21d5312c431969fd0871fc045df2f93147ae39a
sha512=b28bd304ef3196193ba6fe33f51f0f1e2c6bb3cd41c47335a513d9fb4b1f5eca8bcbabcf8683d9b35e3cbd4f3dabe2c7bcc8f5c4b087f96a7ac70117fc4babfa
doc/spline.html
Cublic Spline
open OCADml
open OSCADml
Control points that our cubic spline will pass through.
let control = [ v2 0. 10.; v2 10. 40.; v2 20. 40.; v2 30. (-20.); v2 40. (-40.) ]
Mark our control
points with the debugging helper Debug.show_path2
for reference. We don't really need to number these, so we'll ignore the index parameter and use the same sphere for each point.
let marks = Debug.show_path2 Scad.(fun _ -> color Color.Magenta @@ sphere 2.) control
Fit a cubic spline to the control
points, and interpolate fn
points along it using the helper Path2.cubic_spline
(lower level functions available in the CubicSpline
module), then sweep a rectangle
along it.
let line =
let rectangle = Poly2.square ~center:true (v2 2. 5.)
and path = Path3.of_path2 @@ Path2.cubic_spline ~fn:100 control in
Scad.of_mesh @@ Mesh.path_extrude ~path rectangle
Union our control point marks
and line
sweep shapes and output to file.
let () = Scad.to_file "spline.scad" (Scad.union [ line; marks ])
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>