|
|
@@ -1,168 +0,0 @@ |
|
|
package basispatroonbroek |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
|
"math" |
|
|
|
|
|
|
|
|
|
|
|
"git.wtrh.nl/patterns/gopatterns/pkg/pattern" |
|
|
|
|
|
"git.wtrh.nl/patterns/gopatterns/pkg/pattern/path" |
|
|
|
|
|
"git.wtrh.nl/patterns/gopatterns/pkg/pattern/point" |
|
|
|
|
|
"git.wtrh.nl/patterns/gopatterns/pkg/vector" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type Basispatroonbroek struct { |
|
|
|
|
|
Heupwijdte float64 |
|
|
|
|
|
Taillewijdte float64 |
|
|
|
|
|
Zithoogte float64 |
|
|
|
|
|
Tussenbeenlengte float64 |
|
|
|
|
|
Pijpbreedte float64 |
|
|
|
|
|
Taillebandbreedte float64 |
|
|
|
|
|
ExtraKniebreedte float64 |
|
|
|
|
|
Eigenaar string |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (b *Basispatroonbroek) GenereerPatroon() *pattern.Pattern { |
|
|
|
|
|
p := pattern.NewPattern() |
|
|
|
|
|
b.generatePoints(p) |
|
|
|
|
|
b.generateLines(p) |
|
|
|
|
|
return p |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (b *Basispatroonbroek) generatePoints(p *pattern.Pattern) { |
|
|
|
|
|
//p0 := point.NewAbsolutePoint(0, 0, 0, "0") |
|
|
|
|
|
//p.AddPoint(p0) |
|
|
|
|
|
//p1 := p.RelativePoint(p0).WithYOffset(-(b.Zithoogte + 10 - b.Taillebandbreedte)).MarkWith("1").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointBelow(p.GetPoint(0), b.Zithoogte+1-b.Taillebandbreedte, 1)) |
|
|
|
|
|
//p2 := p.RelativePoint(p1).WithYOffset(-b.Tussenbeenlengte).MarkWith("2").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointBelow(p.GetPoint(1), b.Tussenbeenlengte, 2)) |
|
|
|
|
|
// |
|
|
|
|
|
//p3 := p.RelativePoint(p2).WithYOffset(p1.Vector().Distance(p2.Vector())/2 + 50). |
|
|
|
|
|
// MarkWith("3").Done() |
|
|
|
|
|
// |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointAbove(p.GetPoint(2), p.GetPoint(1).Vector().Distance(p.GetPoint(2).Vector())/2+5, 3)) |
|
|
|
|
|
//p4 := p.RelativePoint(p1).WithYOffset(b.Zithoogte / 4).MarkWith("4").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointAbove(p.GetPoint(1), b.Zithoogte/4, 4)) |
|
|
|
|
|
//p5 := p.RelativePoint(p1).WithXOffset(-b.Heupwijdte / 12).MarkWith("5").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointLeft(p.GetPoint(1), b.Heupwijdte/12, 5)) |
|
|
|
|
|
//p6 := p.RelativePoint(p4).WithXOffset(-b.Heupwijdte / 12).MarkWith("6").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointLeft(p.GetPoint(4), b.Heupwijdte/12, 6)) |
|
|
|
|
|
//p7 := p.RelativePoint(p0).WithXOffset(-b.Heupwijdte / 12).MarkWith("7").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointLeft(p.GetPoint(0), b.Heupwijdte/12, 7)) |
|
|
|
|
|
//p.RelativePoint(p6).WithXOffset(b.Heupwijdte/4 + 20).MarkWith("8").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointRight(p.GetPoint(6), b.Heupwijdte/4+2, 8)) |
|
|
|
|
|
//p9 := p.RelativePoint(p5).WithXOffset(-(b.Heupwijdte/16 + 5)).MarkWith("9").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointLeft(p.GetPoint(5), b.Heupwijdte/16+0.5, 9)) |
|
|
|
|
|
//p10 := p.RelativePoint(p7).WithXOffset(10).MarkWith("10").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointRight(p.GetPoint(7), 1, 10)) |
|
|
|
|
|
//p.RelativePoint(p10).WithXOffset(b.Taillewijdte/4 + 25).MarkWith("11").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointRight(p.GetPoint(10), b.Taillewijdte/4+2.5, 11)) |
|
|
|
|
|
//p12 := p.RelativePoint(p2).WithXOffset(b.Pijpbreedte / 2).MarkWith("12").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointRight(p.GetPoint(2), b.Pijpbreedte/2, 12)) |
|
|
|
|
|
//p13 := p.RelativePoint(p2).WithXOffset(-b.Pijpbreedte / 2).MarkWith("13").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointLeft(p.GetPoint(2), b.Pijpbreedte/2, 13)) |
|
|
|
|
|
//p14 := p.RelativePoint(p3).WithXOffset(b.Pijpbreedte/2 + b.ExtraKniebreedte).MarkWith("14").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointRight(p.GetPoint(3), b.Pijpbreedte/2+1.5, 14)) |
|
|
|
|
|
//p15 := p.RelativePoint(p3).WithXOffset(-(b.Pijpbreedte/2 + b.ExtraKniebreedte)).MarkWith("15").Done() |
|
|
|
|
|
//// p.AddPoint(point.NewRelativePointLeft(p.GetPoint(3), b.Pijpbreedte/2+1.5, 15)) |
|
|
|
|
|
//p1To5Distance := p1.Vector().Distance(p5.Vector()) |
|
|
|
|
|
//p16 := p.RelativePoint(p5).WithXOffset(p1To5Distance / 4).MarkWith("16").Done() |
|
|
|
|
|
//p17 := p.RelativePoint(p6).WithXOffset(p1To5Distance / 4).MarkWith("17").Done() |
|
|
|
|
|
//p18 := p.RelativePoint(p7).WithXOffset(p1To5Distance / 4).MarkWith("18").Done() |
|
|
|
|
|
//p.AddPoint(point.NewBetweenPoint(p16, p18, 0.5, "19")) |
|
|
|
|
|
//p20 := p.RelativePoint(p18).WithXOffset(20).MarkWith("20").Done() |
|
|
|
|
|
//distance20to21 := 10.0 |
|
|
|
|
|
//p21 := p.RelativePoint(p20).WithYOffset(distance20to21).MarkWith("21").Done() |
|
|
|
|
|
//p22 := p.RelativePoint(p9).WithXOffset(-(p5.Vector().Distance(p9.Vector())/2 + 5)).MarkWith("22").Done() |
|
|
|
|
|
//p.RelativePoint(p22).WithYOffset(-5).MarkWith("23").Done() |
|
|
|
|
|
//distance20to24 := math.Sqrt(math.Pow(b.Taillewijdte/4+45, 2) - math.Pow(distance20to21, 2)) |
|
|
|
|
|
//p24 := p.RelativePoint(p20).WithXOffset(distance20to24).MarkWith("24").Done() |
|
|
|
|
|
//p.AddPoint(point.NewBetweenPoint(p21, p24, 0.5, "25")) |
|
|
|
|
|
//p.RelativePoint(p17).WithXOffset(b.Heupwijdte/4 + 30).MarkWith("26").Done() |
|
|
|
|
|
//p.RelativePoint(p12).WithXOffset(20).MarkWith("27").Done() |
|
|
|
|
|
//p.RelativePoint(p13).WithXOffset(-20).MarkWith("28").Done() |
|
|
|
|
|
//p.RelativePoint(p14).WithXOffset(20).MarkWith("29").Done() |
|
|
|
|
|
//p.RelativePoint(p15).WithXOffset(-20).MarkWith("30").Done() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (b *Basispatroonbroek) generateLines(p *pattern.Pattern) { |
|
|
|
|
|
p.AddLine(path.NewPath(p.GetPoints("15", "13", "12", "14")...)) |
|
|
|
|
|
p.AddLine(path.NewPath(p.GetPoints("6", "10", "11")...)) |
|
|
|
|
|
p15 := p.GetPoint("15") |
|
|
|
|
|
p9 := p.GetPoint("9") |
|
|
|
|
|
p13 := p.GetPoint("13") |
|
|
|
|
|
pstart15 := point.NewBetweenPoint(p13, p15, 1.5, "109") |
|
|
|
|
|
p.AddPoint(pstart15) |
|
|
|
|
|
p.AddLine(path.NewSpline(pstart15, nil, p15, p9)) |
|
|
|
|
|
hp5 := point.NewRelativePointWithVector(p.GetPoint("5"), vector.Vector{X: 30, Y: 0}.Rotate(3*math.Pi/4), "110") |
|
|
|
|
|
p.AddLine(path.NewSpline(nil, nil, p.GetPoint("6"), hp5, p9)) |
|
|
|
|
|
p25 := p.GetPoint("25") |
|
|
|
|
|
p21 := p.GetPoint("21") |
|
|
|
|
|
p24 := p.GetPoint("24") |
|
|
|
|
|
p19 := p.GetPoint("19") |
|
|
|
|
|
hp251 := point.NewRelativePoint(p25).WithYOffset(-25 / 2).Done() |
|
|
|
|
|
hp252 := point.NewRelativePoint(p25).WithYOffset(25 / 2).Done() |
|
|
|
|
|
hp253 := point.NewRelativePoint(p25).WithXOffset(120).Done() |
|
|
|
|
|
p.AddLine(path.NewPath(p19, p21, hp251, hp253, hp252, p24)) |
|
|
|
|
|
|
|
|
|
|
|
hp3 := point.NewBetweenPoint(p.GetPoint("14"), p.GetPoint("8"), 0.5, "17") |
|
|
|
|
|
hp4 := point.NewRelativePointLeft(hp3, 5, "21") |
|
|
|
|
|
|
|
|
|
|
|
hp7 := point.NewBetweenPoint(p.GetPoint("8"), p.GetPoint("11"), 0.5, "17") |
|
|
|
|
|
hp8 := point.NewRelativePointRight(hp7, 20, "22") |
|
|
|
|
|
hp10 := point.NewBetweenPoint(p.GetPoint("12"), p.GetPoint("14"), 1.3, "112") |
|
|
|
|
|
p.AddLine(path.NewSpline(hp10, hp8, p.GetPoint("14"), hp4, p.GetPoint("8"), p.GetPoint("11"))) |
|
|
|
|
|
|
|
|
|
|
|
hp16 := point.NewRelativePointWithVector(p.GetPoint("16"), vector.Vector{X: 45, Y: 0}.Rotate(3*math.Pi/4), "110") |
|
|
|
|
|
hp19 := point.NewBetweenPoint(p21, p19, 1.4, "0") |
|
|
|
|
|
p23 := p.GetPoint("23") |
|
|
|
|
|
hp23 := point.NewRelativePointWithVector(p23, vector.Vector{X: 70, Y: 0}.Rotate(-math.Pi/10), "111") |
|
|
|
|
|
p.AddLine(path.NewSpline(hp19, hp23, p19, hp16, p23)) |
|
|
|
|
|
p30 := p.GetPoint("30") |
|
|
|
|
|
p28 := p.GetPoint("28") |
|
|
|
|
|
hp30 := point.NewBetweenPoint(p28, p30, 1.5, "0") |
|
|
|
|
|
p.AddLine(path.NewSpline(nil, hp30, p23, p30)) |
|
|
|
|
|
p.AddLine(path.NewPath(p30, p28)) |
|
|
|
|
|
|
|
|
|
|
|
p29 := p.GetPoint("29") |
|
|
|
|
|
p27 := p.GetPoint("27") |
|
|
|
|
|
p.AddLine(path.NewPath(p29, p27)) |
|
|
|
|
|
hp28 := point.NewRelativePointRight(point.NewBetweenPoint(p28, p27, 0.5, "0"), 10, "0") |
|
|
|
|
|
p.AddLine(path.NewSpline(nil, nil, p27, hp28, p28)) |
|
|
|
|
|
|
|
|
|
|
|
p26 := p.GetPoint("26") |
|
|
|
|
|
hp13 := point.NewBetweenPoint(p29, p26, 0.5, "17") |
|
|
|
|
|
hp14 := point.NewRelativePointLeft(hp13, 5, "21") |
|
|
|
|
|
|
|
|
|
|
|
hp17 := point.NewBetweenPoint(p26, p24, 0.5, "17") |
|
|
|
|
|
hp18 := point.NewRelativePointRight(hp17, 20, "22") |
|
|
|
|
|
hp110 := point.NewBetweenPoint(p27, p29, 1.3, "112") |
|
|
|
|
|
p.AddLine(path.NewSpline(hp110, hp18, p29, hp14, p26, p24)) |
|
|
|
|
|
// p.AddLine(path.NewStraightLine(p.GetPoint(19), p.GetPoint(21))) |
|
|
|
|
|
// p.AddLine(path.NewStraightLine(hp251, p.GetPoint(21))) |
|
|
|
|
|
// p.AddLine(path.NewStraightLine(hp251, hp253)) |
|
|
|
|
|
// p.AddLine(path.NewStraightLine(hp252, hp253)) |
|
|
|
|
|
// p.AddLine(path.NewStraightLine(hp252, p.GetPoint(24))) |
|
|
|
|
|
// p19 := p.GetPoint(19) |
|
|
|
|
|
// p23 := p.GetPoint(23) |
|
|
|
|
|
// p.AddLine(path.NewMultiPointCurve(0.0, p.GetPoint(21).Position().Direction(p.GetPoint(19).Position()), p23, p19)) |
|
|
|
|
|
// p.AddLine(path.NewMultiPointCurve(-0.18, -math.Pi+0.18, p.GetPoints(28, 27)...)) |
|
|
|
|
|
// hp9 := point.NewBetweenPoint(p.GetPoint(29), p.GetPoint(26), 0.5, 0) |
|
|
|
|
|
// hp10 := point.NewRelativePointLeft(hp9, 0.3, 0) |
|
|
|
|
|
// p.AddLine(path.NewMultiPointCurve(math.Pi/2, -math.Pi/2, p.GetPoint(29), hp10, p.GetPoint(26), p.GetPoint(24))) |
|
|
|
|
|
// p.AddLine(path.NewMultiPointCurve(p.GetPoint(28).Position().Direction(p.GetPoint(30).Position()), -math.Pi/2, p.GetPoint(30), p.GetPoint(23))) |
|
|
|
|
|
// p.AddLine(path.NewStraightLine(p.GetPoint(28), p.GetPoint(30))) |
|
|
|
|
|
// p.AddLine(path.NewStraightLine(p.GetPoint(27), p.GetPoint(29))) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//func (b *Basispatroonbroek) Voorbeen(canvas *svg.SVG) { |
|
|
|
|
|
// p := b.GeneratePoints().Normalize() |
|
|
|
|
|
// p.Draw(canvas) |
|
|
|
|
|
// p.Line(canvas, 15, 13, 12, 14) |
|
|
|
|
|
// p.Line(canvas, 10, 11) |
|
|
|
|
|
// pa := p[14].Above(p[14].Distance(p[8]) / 3) |
|
|
|
|
|
// pb := p[8].Below(p[14].Distance(p[8]) / 3) |
|
|
|
|
|
// util.Bezier(canvas, p[14], pa, pb, p[8]) |
|
|
|
|
|
// p15p9half := p[9].Subtract(p[15]).Divide(2) |
|
|
|
|
|
// pc := p[15].Add(p15p9half).Add(p15p9half.Unit().Rotate(math.Pi / 2).Multiply(3 * float64(b.Eenheid))) |
|
|
|
|
|
// |
|
|
|
|
|
// util.Qbez(canvas, p[9], pc, p[15]) |
|
|
|
|
|
//} |
|
|
|