exp

package
v0.0.0-...-a9d73b1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DPI = 72.0

Variables

View Source
var (
	DefaultFont  *truetype.Font
	DefaultColor *image.Uniform
)

Functions

func DrawLineFixPoint

func DrawLineFixPoint(dst draw.Image, from, to fixed.Point26_6, width float64)

func FixedToFloat

func FixedToFloat(f fixed.Int26_6) float64

func FloatToFixed

func FloatToFixed(f float64) fixed.Int26_6

Types

type Binary

type Binary struct {
	// contains filtered or unexported fields
}

func (Binary) Eval

func (b Binary) Eval(env Env) float64

func (Binary) GetGraphy

func (b Binary) GetGraphy() Graphy

func (Binary) String

func (b Binary) String() string

type BinaryGraphy

type BinaryGraphy struct {
	Op   string //"+"  "-" "*"
	X, Y Graphy
	// contains filtered or unexported fields
}

----------------------------------------------------------------------------

func (*BinaryGraphy) Draw

func (b *BinaryGraphy) Draw(dst draw.Image, dot fixed.Point26_6)

func (*BinaryGraphy) Measure

func (b *BinaryGraphy) Measure(fontSize float64) fixed.Point26_6

type Call

type Call struct {
	// contains filtered or unexported fields
}

func (Call) Eval

func (c Call) Eval(env Env) float64

func (Call) GetGraphy

func (c Call) GetGraphy() Graphy

func (Call) String

func (c Call) String() string

type DivideGraphy

type DivideGraphy struct {
	X Graphy
	Y Graphy
	// contains filtered or unexported fields
}

----------------------------------------------------------------------------

func (*DivideGraphy) Draw

func (d *DivideGraphy) Draw(dst draw.Image, dot fixed.Point26_6)

func (*DivideGraphy) Measure

func (d *DivideGraphy) Measure(fontSize float64) fixed.Point26_6

type Env

type Env map[Var]float64

---------------------------------------------------------------------------------------------

type Expr

type Expr interface {
	Eval(env Env) float64
	String() string
	GetGraphy() Graphy
}

func Parse

func Parse(input string) (_ Expr, err error)

type Graphy

type Graphy interface {
	Measure(fontSize float64) fixed.Point26_6
	Draw(dst draw.Image, dot fixed.Point26_6)
}

type Literal

type Literal string

---------------------------------------------------------------------------------------

func (Literal) Eval

func (l Literal) Eval(env Env) float64

func (Literal) GetGraphy

func (l Literal) GetGraphy() Graphy

func (Literal) String

func (l Literal) String() string

type PowGraphy

type PowGraphy struct {
	X Graphy
	Y Graphy
	// contains filtered or unexported fields
}

----------------------------------------------------------------------------

func (*PowGraphy) Draw

func (p *PowGraphy) Draw(dst draw.Image, dot fixed.Point26_6)

func (*PowGraphy) Measure

func (p *PowGraphy) Measure(fontSize float64) fixed.Point26_6

type SqrtGraphy

type SqrtGraphy struct {
	X Graphy
	// contains filtered or unexported fields
}

----------------------------------------------------------------------------

func (*SqrtGraphy) Draw

func (s *SqrtGraphy) Draw(dst draw.Image, dot fixed.Point26_6)

func (*SqrtGraphy) Measure

func (s *SqrtGraphy) Measure(fontSize float64) fixed.Point26_6

type TriangleGraphy

type TriangleGraphy struct {
	Op string //sin cos tan arcsin ...
	X  Graphy
	// contains filtered or unexported fields
}

----------------------------------------------------------------------------

func (*TriangleGraphy) Draw

func (t *TriangleGraphy) Draw(dst draw.Image, dot fixed.Point26_6)

func (*TriangleGraphy) Measure

func (t *TriangleGraphy) Measure(fontSize float64) fixed.Point26_6

type Unary

type Unary struct {
	// contains filtered or unexported fields
}

--------------------------------------------------------------------------------------

func (Unary) Eval

func (u Unary) Eval(env Env) float64

func (Unary) GetGraphy

func (u Unary) GetGraphy() Graphy

func (Unary) String

func (u Unary) String() string

type UnaryGraphy

type UnaryGraphy struct {
	Op string
	X  Graphy
	// contains filtered or unexported fields
}

----------------------------------------------------------------------------

func (*UnaryGraphy) Draw

func (u *UnaryGraphy) Draw(dst draw.Image, dot fixed.Point26_6)

func (*UnaryGraphy) Measure

func (u *UnaryGraphy) Measure(fontSize float64) fixed.Point26_6

type Var

type Var string

--------------------------------------------------------------------------------------

func (Var) Eval

func (v Var) Eval(env Env) float64

func (Var) GetGraphy

func (v Var) GetGraphy() Graphy

func (Var) String

func (v Var) String() string

type VarGraphy

type VarGraphy struct {
	Name string
	// contains filtered or unexported fields
}

----------------------------------------------------------------------------

func (*VarGraphy) Draw

func (v *VarGraphy) Draw(dst draw.Image, dot fixed.Point26_6)

func (*VarGraphy) Measure

func (v *VarGraphy) Measure(fontSize float64) fixed.Point26_6

Jump to

Keyboard shortcuts

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