diff --git a/deps.edn b/deps.edn index 2dd00d7..e2b529d 100644 --- a/deps.edn +++ b/deps.edn @@ -8,12 +8,13 @@ :aliases {:dev {:extra-deps - {org.clojars.cartesiantheatrics/manifold3d$linux-x86_64 {:mvn/version "1.0.79"}}} + {org.clojars.cartesiantheatrics/manifold3d$linux-x86_64 {:mvn/version "1.0.81"}}} - :test {:extra-paths ["test/main"] - :extra-deps {lambdaisland/kaocha {:mvn/version "1.88.1376"} - org.clojure/clojure {:mvn/version "1.11.2"}} - :main-opts ["-m" "kaocha.runner"]} + :test + {:extra-paths ["test/main"] + :extra-deps {lambdaisland/kaocha {:mvn/version "1.88.1376"} + org.clojure/clojure {:mvn/version "1.11.2"}} + :main-opts ["-m" "kaocha.runner"]} :deploy {:extra-paths ["build"] diff --git a/src/main/plexus/core.clj b/src/main/plexus/core.clj index 6c7acfc..d4a326a 100644 --- a/src/main/plexus/core.clj +++ b/src/main/plexus/core.clj @@ -132,7 +132,7 @@ (defop loft "Loft between segments. All lofted cross-sections must have equal number of points. Optional `:to` parameter specifies which frames to loft." - schema/any-map-schema) + schema/loft-schema) (defop hull "Makes a convex hull out of wrapped segments. Optional `:to` parameter specifies which @@ -303,6 +303,12 @@ [& forms] (impl/extrude forms)) +(defn rebuild + "Rebuild an extrusion in the current context. Forms will re-evaluate their args. This can be used + in combination with dynamic binding to achieve specialization of extrusions." + [extrusion] + (extrude (:forms extrusion))) + (def ^{:doc (-> #'plexus.impl/extrusion? meta :doc) :arglists '([x])} extrusion? impl/extrusion?) (def ^{:doc (-> #'plexus.impl/model? meta :doc) :arglists '([x])} model? impl/model?) (def ^{:doc (-> #'plexus.impl/frame? meta :doc) :arglists '([x])} frame? impl/frame?) diff --git a/src/main/plexus/impl.clj b/src/main/plexus/impl.clj index 5ef0cd6..38de686 100644 --- a/src/main/plexus/impl.clj +++ b/src/main/plexus/impl.clj @@ -9,6 +9,8 @@ [plexus.triangles :as triangles] [plexus.transforms :as tf])) +(declare extrude*) + (defrecord Extrusion [result-forms frames state angle-scalar forms transforms models main-model] Object (toString [_] @@ -337,7 +339,8 @@ result-forms)) :plexus.impl/loft - (let [{:keys [to]} form + (let [{:keys [to algorithm] + :or {algorithm :eager-nearest-neighbor}} form loft-forms (normalize-segment (:plexus.impl/list form)) loft-frames (or to current-frame-ids) ret (extrude* state loft-forms frames)] @@ -364,6 +367,7 @@ (m/loft (cons {:frame (-> first-segment :all-transforms (nth 0)) + :algorithm algorithm :cross-section (-> first-segment :cross-section)} (mapcat (fn [{:keys [cross-section all-transforms]}] @@ -661,7 +665,6 @@ (throw e) (let [form @current-form {:keys [line column file]} (meta form) - _ (println "form:" form) op (:op form) error-string (format "Error while applying `%s` (line=%s, column=%s): %s" (name op) line diff --git a/src/main/plexus/schema.clj b/src/main/plexus/schema.clj index 7766dd2..55ecc81 100644 --- a/src/main/plexus/schema.clj +++ b/src/main/plexus/schema.clj @@ -45,6 +45,10 @@ [:cross-section {:optional true} :cross-section] [:cs {:optional true} int?]]) +(def loft-schema + [:map + [:algorithm {:optional true} keyword?]]) + (def any-map-schema [:map])