package OSCADml
OCaml DSL for 3D solid modelling in OpenSCAD
Install
Dune Dependency
Authors
Maintainers
Sources
OSCADml-0.2.3.tbz
sha256=61bc12919734a42004f9f54bb03aa5403eac9cdd645cad1fb97ddd2eba148583
sha512=9aca48afeb2c89ace6b07110b6aadedac7d877fb9b0d1990b0c0b622829ff45ced3841fdae30b5b869293dea1b3ae39f1b00fc767c8e3f69d7e78f6412801ffb
doc/resampled_path.html
Path resampling and scaling/twisting sweeps
open OCADml
open OSCADml
Oftentimes, we would just like to define our paths without colinear points, such that it only consists of corners. However, some applications call for more fine sampling, and in those times we can reach for Path3.resample
or Path3.subdivide
. For this example, the exact number of points isn't a concern, so we'll specify a new point spacing as our ~freq
.
let path = [ v3 0. 0. 0.; v3 5. 5. 5.; v3 5. 5. 15. ]
let resampled = Path3.subdivide ~freq:(`Spacing 0.5) path
Lets visualize our original path
, and the resampled
points with Debug.show_path3
to get a sense of how fine our ~freq
parameter has gotten us.
let () =
let old_marks =
let f _ = Scad.(color ~alpha:0.2 Color.Magenta @@ sphere ~fn:36 0.4) in
Debug.show_path3 f path
and new_marks = Debug.show_path3 (fun _ -> Scad.sphere ~fn:36 0.2) resampled in
Scad.to_file "resampled_path.scad" (Scad.union [ old_marks; new_marks ])
One such alluded to application for resampling, is when additional transformations such as scaling and twisting along a path extrusion is desired.
let () =
let mesh =
Mesh.path_extrude
~scale_ez:(v2 0.42 0., v2 1. 1.)
~twist_ez:(v2 0.42 0., v2 1. 1.)
~scale:(v2 4. 1.)
~twist:(Float.pi *. 4.)
~path:resampled
@@ Poly2.square ~center:true (v2 1. 0.5)
in
Scad.to_file "scaling_twister_extrude.scad" (Scad.of_mesh mesh)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>