File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,40 @@ import (
3030 geom " github.com/gravitton/geometry"
3131)
3232
33+ p1 := geom.Pt (1 , 2 )
34+ p2 := geom.Pt (3 , 4 )
35+
36+ v1 := p2.Subtract (p1)
37+ v2 := geom.Vec (1 , 2 ).Multiply (2 )
38+
39+ if v1.Equal (v2) || v1.IsZero () || v2.Length () > 5 {
40+ // ...
41+ }
42+
43+ r1 := geom.Rect (p1, geom.Sz (3 , 4 ))
44+ r2 := geom.RectFromMin (p1, p2)
45+
46+ if r1.Contains (p2) {
47+ // ...
48+ }
49+
50+ hex1 := geom.Hexagon (p1, geom.SzU (2 ), FlatTop )
51+ hex2 := hex1.MoveTo (geom.Vec (1 , 2 )).Rotate (90 * DegToRad ).Scale (2 )
52+
53+ for _ , p := range hex2.Vertices () {
54+ // ...
55+ }
56+ ```
57+
58+ More complex calculation:
59+
60+ ``` go
61+ package main
62+
63+ import (
64+ geom " github.com/gravitton/geometry"
65+ )
66+
3367type HexLayout struct {
3468 Origin geom.Point [float64 ]
3569 Size geom.Size [float64 ]
You can’t perform that action at this time.
0 commit comments