goplotter

command module
v0.0.0-...-332e441 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

README

Introduction

goplotter creates animated gifs with the plots of mathematical functions. This repository is created only with educational purposes.

It has no additional dependencies

Usage

goplotter acknowledges the following commands in the command-line interface:

  • width and height are the width and height of the GIF image

  • nbsteps is the number of images to generate in the GIF image

  • filename is the name of the GIF filename

In addition, --help shows the help banner.

The specification of the function to plot is hardcoded as follows:

	gif := plotFunc(image.Rectangle{Min: image.Point{0, 0},
		Max: image.Point{width, height}},
		nbsteps,
		func(x int) int { return int(math.Pow(float64(x), 2.001)) - x*x })

This is, this package actually provides only two services:

  • plotFunc(bounds image.Rectangle, nbsteps int, y func(x int) int) gif.GIF: return a GIF image with nbsteps partial plots of the given function which is constrained to the specified rectangle

  • func saveImage(image *gif.GIF, filename string): writes the contents of the given GIF image into the specified filename

Examples

The following execution:

$ ./goplotter --width 400 --height 1000 --nbsteps 100 --filename example.gif

generates the following GIF animation:

Example 0

Author

Carlos Linares Lopez carlos.linares@uc3m.es
Computer Science and Engineering Department
Universidad Carlos III de Madrid

Documentation

Overview

Description

Description

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL