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
+7.5k Golang : Shuffle strings array
+5.8k Linux : Disable and enable IPv4 forwarding
+7.8k Golang : Getting Echo framework StartAutoTLS to work
+9.8k Golang : Get current, epoch time and display by year, month and day
+8.5k Golang : How to check variable or object type during runtime?
+12.1k Golang : Save webcamera frames to video file
+9.9k Golang : ffmpeg with os/exec.Command() returns non-zero status
+9.1k Golang : How to capture return values from goroutines?
+8.2k Golang : Metaprogramming example of wrapping a function
+23.9k Golang : Use regular expression to validate domain name
+16.6k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+7.6k Golang : Convert(cast) io.Reader type to string