Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
add thread package
Browse files Browse the repository at this point in the history
  • Loading branch information
soypat committed May 15, 2022
1 parent 0341adb commit 8ef4bd4
Show file tree
Hide file tree
Showing 34 changed files with 1,112 additions and 770 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Exclude CPU and memory profiles
*.prof
*.pprof

*.png
# Exclude all png files except for test files
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Advantages of soypat/sdf:
- Uses gonum's `spatial` package
- `sdfx` has own vector types with methods which [hurt code legibility](https://github.com/deadsy/sdfx/issues/48)
- `spatial` types from gonum library with correct Triangle degeneracy calculation. `deadsy/sdfx`'s Degenerate calculation is incorrect.
- Idiomatic [`thread`](./form3/obj3/thread/thread.go) package. Define arbitrary threads with ease using `Threader` interface.
- `deadsy/sdfx` defines threads with strings i.e. `"M16x2"`. `sdf` Defines threads with types corresponding to standards. i.e: `thread.ISO{D:16, P:2}`, which defines an M16x2 ISO thread.


## Contributing
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Click on image to go to code directory.

| Example | Execution Time | File size |
|---|---|---|
|[ATX Bench power supply mod](atx-bench-supply)|0.5s|4540kB|
|[ATX Bench power supply mod](atx-bench-supply)|1s|4540kB|

[![ATX Bench power supply mod](fig/atx-bench-supply.png)](atx-bench-supply)

Expand Down
4 changes: 2 additions & 2 deletions examples/atx-bench-supply/atx.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ func main() {

// Begin working on regulated step-down block
regOut = sdf.Array2D(bananaPlugSmall, sdf.V2i{2, 1}, r2.Vec{bananaSpacing, bananaSpacing})
bplugX := bbSize(regBlock.Bounds()).X
bplugX := bbSize(regOut.Bounds()).X
vDisp := sdf.Transform2D(voltageDisplay, sdf.Translate2d(r2.Vec{bplugX / 2, vDispH/2 + bananaSpacing/2}))
regOut = sdf.Union2D(regOut, vDisp)
regOut = sdf.Transform2D(regOut, sdf.Translate2d(r2.Vec{-atxW/2 - bplugX/2 + vDispW/2 + 12, atxH/2 - 12 - vDispH/2 - bananaSpacing}))
// Create mound for step up outputs.
regSz := bbSize(regBlock.Bounds())
regSz := bbSize(regOut.Bounds())
regBlock = form2.Box(r2.Vec{regSz.X + regBlockMargin, regSz.Y + regBlockMargin}, regBlockMargin/2)
regBlock = sdf.Transform2D(regBlock, sdf.Translate2d(bbCenter(regOut.Bounds())))
regBlock = sdf.Difference2D(regBlock, regOut)
Expand Down
11 changes: 6 additions & 5 deletions examples/npt-flange/flange.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/soypat/sdf"
form3 "github.com/soypat/sdf/form3/must3"
"github.com/soypat/sdf/form3/obj3"
"github.com/soypat/sdf/form3/obj3/thread"
"github.com/soypat/sdf/render"
"gonum.org/v1/gonum/spatial/r3"
)
Expand All @@ -14,18 +14,19 @@ const (
internalDiameter = 1.5 / 2.
flangeH = 7 / 25.4
flangeD = 60. / 25.4
thread = "npt_1/2"
// internal diameter scaling.
plaScale = 1.03
)

func main() {
var (
npt thread.NPT
flange sdf.SDF3
)
pipe, err := obj3.Nut(obj3.NutParms{
Thread: thread,
Style: obj3.CylinderCircular,
npt.SetFromNominal(1.0 / 2.0)
pipe, err := thread.Nut(thread.NutParms{
Thread: npt,
Style: thread.NutCircular,
})
if err != nil {
panic(err)
Expand Down
314 changes: 0 additions & 314 deletions form2/obj2/thread.go

This file was deleted.

Loading

0 comments on commit 8ef4bd4

Please sign in to comment.