Skip to content

Commit

Permalink
Monomorphic loft
Browse files Browse the repository at this point in the history
  • Loading branch information
cartesian-theatrics committed May 18, 2024
1 parent 57f31ba commit 1036e50
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ in a hull form to make a convex hull out of those segments:

## Lofts

You can loft between a sequence of isomorphic cross-sections with `loft`. Edges are constructed between corresponding vertices of each cross-section.
You can loft between a sequence of cross-sections with `loft`. Edges are constructed between corresponding vertices of each cross-section.

``` clojure
(-> (extrude
Expand All @@ -154,6 +154,26 @@ You can loft between a sequence of isomorphic cross-sections with `loft`. Edges

![Loft Example](https://github.com/SovereignShop/plexus/blob/main/resources/images/loft-example.png)

Lofted sections don't need to be isomorphic.

``` clojure
(-> (extrude
(result :name :pipes :expr :body)
(frame :cross-section (m/difference (m/circle 20) (m/circle 18)) :name :body)
(loft
(forward :length 1)
(for [i (range 3)]
[(translate :x 8)
(set :cross-section (m/difference (m/square 30 30 true) (m/square 26 26 true)))
(forward :length 20)
(translate :x -8)
(set :cross-section (m/difference (m/circle 20) (m/circle 18)))
(forward :length 20)])))
(export "monomorphic-loft.glb" (m/material :color [0 0.7 0.7 1.0] :metalness 0.2)))
```

![Loft Example 2](resources/images/monomorphic-loft.png)

## Branching

Branches work as you'd expect.
Expand Down
Binary file added resources/images/monomorphic-loft.glb
Binary file not shown.
18 changes: 18 additions & 0 deletions src/examples/pipes.clj
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@
(forward :length 20)])))
(export "loft.glb" (m/material :color [0 0.7 0.7 1.0] :metalness 0.2)))



(-> (extrude
(result :name :pipes :expr :body)
(frame :cross-section (m/difference (m/circle 20) (m/circle 18)) :name :body)
(loft
(forward :length 1)
(for [i (range 3)]
[(translate :x 8)
(set :cross-section (m/difference (m/square 30 30 true) (m/square 26 26 true)))
(forward :length 20)
(translate :x -8)
(set :cross-section (m/difference (m/circle 20) (m/circle 18)))
(forward :length 20)])))
(export "monomorphic-loft.glb" (m/material :color [0 0.7 0.7 1.0] :metalness 0.2)))



;; Branching

(def pi|2 (/ Math/PI 2))
Expand Down

0 comments on commit 1036e50

Please sign in to comment.