Created
October 26, 2020 19:41
-
-
Save ivank2139/74118204730f95af141ef5dfa7e408d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func GenNodesFixed() string { | |
var sbldr = strings.Builder{} | |
xray := []float64{100, 56.84, 1.87, 30, 92.66, 81.67, 16, 9.04, 72.8, 97.2, 40.11, 0.1, 46.24, 98.88, 67.12, 5.81, 20.79, 86.21, 89.11, 24.49, 3.91, 62.91, 99.62, 50.66, 0.56, 35.82, 95.56} | |
yray := []float64{50, 99.53, 63.55, 4.17, 23.92, 88.69, 86.66, 21.33, 5.5, 66.5, 99.01, 46.9, 0.14, 39.46, 96.98, 73.39, 9.42, 15.52, 81.15, 93, 30.61, 1.69, 56.18, 100, 57.49, 2.05, 29.4} | |
i := 0 | |
for _, node := range NodeNames { | |
x := decimal.NewFromFloat(xray[i]) | |
y := decimal.NewFromFloat(yray[i]) | |
Nodes[node] = *NewNode(node, x, y) | |
i++ | |
} | |
sbldr.WriteString("\n\nGenerated " + strconv.Itoa(len(Nodes)) + " named nodes with x y data points between " + | |
strconv.Itoa(GridMin) + " and " + strconv.Itoa(GridMax)) | |
for _, node := range Nodes { | |
sbldr.WriteString(", " + node.String()) | |
} | |
radius := decimal.NewFromInt(50) | |
c := radius.Mul(decimal.NewFromFloat(2.0).Mul(decimal.NewFromFloat(math.Pi).Round(2))) | |
sbldr.WriteString("\n\tA circle of radius " + radius.String() + " has a circumference, c = 2 * pi * radius " + c.String()) | |
return sbldr.String() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment