Golang image.Point.String and Sub functions example
package image
Golang image.Point.String and Sub functions usage example
package main
import (
"fmt"
"image"
)
func main() {
var aPoint, bPoint image.Point
aPoint = image.Pt(10, 10)
bPoint = image.Pt(200, 200)
// String
fmt.Println("aPoint in string format :", aPoint.String())
fmt.Println("bPoint in string format :", bPoint.String())
// Sub
var pPoint, qPoint image.Point
pPoint = image.Pt(0, 0)
qPoint = image.Pt(20, 20)
pqPoint := pPoint.Sub(qPoint) // Subtract p - q
fmt.Println("p-q vector is : ", pqPoint.String())
}
Output :
aPoint in string format : (10,10)
bPoint in string format : (200,200)
p-q vector is : (-20,-20)
References :
See also : Golang image.Point.In, Mod and Mul functions example
Advertisement
Something interesting
Tutorials
+9.1k Golang : Get curl -I or head data from URL example
+5.1k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
+9.6k Golang : Read file with ioutil
+6.2k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+15.2k Golang : Save(pipe) HTTP response into a file
+13.9k Golang : How to check if a file is hidden?
+6.5k Golang : Handling image beyond OpenCV video capture boundary
+19.4k Golang : How to count the number of repeated characters in a string?
+7.9k Swift : Convert (cast) String to Float
+6.7k Golang : Derive cryptographic key from passwords with Argon2