packages feed

waterfall-cad-examples 0.1.1.1 → 0.1.2.1

raw patch · 4 files changed

+28/−1 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ OffsetExample: offsetExample :: Solid

Files

CHANGELOG.md view
@@ -8,6 +8,12 @@  ## Unreleased +## 0.1.2.1 - 2024-01-09 ++### Added ++- Add an example for `Waterfall.Offset`+ ## 0.1.1.1 - 2023-12-12   ## 0.1.1.0 - 2023-12-12 
app/Main.hs view
@@ -6,6 +6,7 @@ import FilletExample (filletExample) import RevolutionExample (revolutionExample) import SweepExample (sweepExample)+import OffsetExample (offsetExample) import TextExample (textExample) import Waterfall.IO (writeSTL, writeSTEP) import qualified Waterfall.Solids as Solids@@ -26,6 +27,7 @@                 OA.flag' filletExample (OA.long "fillet" <> OA.help "demonstrates adding fillets to an object" ) <|>                 OA.flag' revolutionExample (OA.long "revolution" <> OA.help "demonstrates revolving a path into a solid" ) <|>                 OA.flag' sweepExample (OA.long "sweep" <> OA.help "demonstrates sweeping a shape along a path" ) <|>+                OA.flag' offsetExample (OA.long "offset" <> OA.help "demonstrates offsetting the surface of a shape" ) <|>                 (OA.flag' gearExample (OA.long "gear" <> OA.help "generate an involute gear") <*>                  (OA.option OA.auto (OA.long "thickness" <> OA.help "gear depth") <|> pure 1.0) <*>                  (OA.option OA.auto (OA.long "module" <> OA.help "gear module") <|> pure 5.0) <*>
+ src/OffsetExample.hs view
@@ -0,0 +1,18 @@+module OffsetExample +( offsetExample +) where++import qualified Waterfall.Solids as Solids+import Waterfall.Transforms (translate, rotate, scale)+import Waterfall.Offset (offset)+import Linear ( V3(V3), unit, _x, _y, _z, (^*))++offsetExample :: Solids.Solid+offsetExample = +  let beam axis = rotate axis (pi/2) (scale (V3 2 2 4) Solids.centeredCube)+      cross = foldMap beam [unit _x,  unit _y, unit _z]+      tolerance = 1e-6+      offsetCross amount = offset amount tolerance cross+      offsetCrosses = offsetCross <$> [- 0.5, - 0.25, 0, 0.25, 0.5] +      position = (unit _x ^* 5 ^*) <$> [0..]  +  in mconcat $ zipWith translate position offsetCrosses 
waterfall-cad-examples.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           waterfall-cad-examples-version:        0.1.1.1+version:        0.1.2.1 synopsis:       Examples for Waterfall CAD, a Declarative CAD/Solid Modeling Library description:    Please see the README on GitHub at <https://github.com/joe-warren/opencascade-hs#readme> category:       Graphics@@ -31,6 +31,7 @@       CsgExample       FilletExample       GearExample+      OffsetExample       PrismExample       RevolutionExample       SweepExample