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
+14.3k Golang : Get uploaded file name or access uploaded files
+5.5k Golang : Display advertisement images or strings on random order
+10.6k Golang : How to delete element(data) from map ?
+9.5k Golang : Changing a RGBA image number of channels with OpenCV
+25.2k Golang : Storing cookies in http.CookieJar example
+11.1k Golang : Simple image viewer with Go-GTK
+6.4k CodeIgniter : form input set_value cause " to become & quot
+14.6k Golang : GUI with Qt and OpenCV to capture image from camera
+5k Golang : Calculate a pip value and distance to target profit example
+17.9k Golang : How to make a file read only and set it to writable again?
+20.4k nginx: [emerg] unknown directive "passenger_enabled"
+18k Golang : Get all upper case or lower case characters from string example